@@ -144,18 +144,22 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
144
144
trait_ref : ty:: PolyTraitRef < ' tcx > ,
145
145
obligation : & PredicateObligation < ' tcx > ,
146
146
) -> OnUnimplementedNote {
147
- if self . tcx . opt_rpitit_info ( obligation. cause . body_id . to_def_id ( ) ) . is_some ( ) {
148
- return OnUnimplementedNote :: default ( ) ;
149
- }
150
-
151
147
let ( def_id, substs) = self
152
148
. impl_similar_to ( trait_ref, obligation)
153
149
. unwrap_or_else ( || ( trait_ref. def_id ( ) , trait_ref. skip_binder ( ) . substs ) ) ;
154
150
let trait_ref = trait_ref. skip_binder ( ) ;
155
151
156
- let body_hir = self . tcx . hir ( ) . local_def_id_to_hir_id ( obligation. cause . body_id ) ;
157
- let mut flags =
158
- vec ! [ ( sym:: ItemContext , self . describe_enclosure( body_hir) . map( |s| s. to_owned( ) ) ) ] ;
152
+ let mut flags = vec ! [ ] ;
153
+ // FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty): HIR is not present for RPITITs,
154
+ // but I guess we could synthesize one here. We don't see any errors that rely on
155
+ // that yet, though.
156
+ let enclosure =
157
+ if let Some ( body_hir) = self . tcx . opt_local_def_id_to_hir_id ( obligation. cause . body_id ) {
158
+ self . describe_enclosure ( body_hir) . map ( |s| s. to_owned ( ) )
159
+ } else {
160
+ None
161
+ } ;
162
+ flags. push ( ( sym:: ItemContext , enclosure) ) ;
159
163
160
164
match obligation. cause . code ( ) {
161
165
ObligationCauseCode :: BuiltinDerivedObligation ( ..)
0 commit comments