diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2023-03-06 11:33:51 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2023-03-06 14:49:43 -0300 |
| commit | 47860ddf589349cd905b2d9101227c2d8d9ca63c (patch) | |
| tree | 4d5cfca14e011fa0cbbb755f5b17b7883c6b5017 | |
| parent | c2238527e69faa9f922fb5d3fde9494395b299ff (diff) | |
| download | rust-47860ddf589349cd905b2d9101227c2d8d9ca63c.tar.gz rust-47860ddf589349cd905b2d9101227c2d8d9ca63c.zip | |
Add is_impl_trait_in_trait
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index f87bc45e4f2..4aa60f5eebf 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2443,6 +2443,14 @@ impl<'tcx> TyCtxt<'tcx> { pub fn lower_impl_trait_in_trait_to_assoc_ty(self) -> bool { self.sess.opts.unstable_opts.lower_impl_trait_in_trait_to_assoc_ty } + + pub fn is_impl_trait_in_trait(self, def_id: DefId) -> bool { + if self.lower_impl_trait_in_trait_to_assoc_ty() { + self.def_kind(def_id) == DefKind::AssocTy && self.opt_rpitit_info(def_id).is_some() + } else { + self.def_kind(def_id) == DefKind::ImplTraitPlaceholder + } + } } impl<'tcx> TyCtxtAt<'tcx> { |
