File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
compiler/rustc_type_ir/src Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,13 @@ pub enum ExistentialPredicate<I: Interner> {
275275}
276276
277277impl < I : Interner > ty:: Binder < I , ExistentialPredicate < I > > {
278+ pub fn def_id ( & self ) -> I :: DefId {
279+ match self . skip_binder ( ) {
280+ ExistentialPredicate :: Trait ( tr) => tr. def_id ,
281+ ExistentialPredicate :: Projection ( p) => p. def_id ,
282+ ExistentialPredicate :: AutoTrait ( did) => did,
283+ }
284+ }
278285 /// Given an existential predicate like `?Self: PartialEq<u32>` (e.g., derived from `dyn PartialEq<u32>`),
279286 /// and a concrete type `self_ty`, returns a full predicate where the existentially quantified variable `?Self`
280287 /// has been replaced with `self_ty` (e.g., `self_ty: PartialEq<u32>`, in our example).
You can’t perform that action at this time.
0 commit comments