Skip to content

Commit 47860dd

Browse files
committed
Add is_impl_trait_in_trait
1 parent c223852 commit 47860dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_middle/src/ty/context.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,6 +2443,14 @@ impl<'tcx> TyCtxt<'tcx> {
24432443
pub fn lower_impl_trait_in_trait_to_assoc_ty(self) -> bool {
24442444
self.sess.opts.unstable_opts.lower_impl_trait_in_trait_to_assoc_ty
24452445
}
2446+
2447+
pub fn is_impl_trait_in_trait(self, def_id: DefId) -> bool {
2448+
if self.lower_impl_trait_in_trait_to_assoc_ty() {
2449+
self.def_kind(def_id) == DefKind::AssocTy && self.opt_rpitit_info(def_id).is_some()
2450+
} else {
2451+
self.def_kind(def_id) == DefKind::ImplTraitPlaceholder
2452+
}
2453+
}
24462454
}
24472455

24482456
impl<'tcx> TyCtxtAt<'tcx> {

0 commit comments

Comments
 (0)