@@ -172,25 +172,18 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>(
172172 } ;
173173 match pred. kind ( ) {
174174 ty:: PredicateKind :: Projection ( proj) => {
175- // The obligation comes not from the current `impl` nor the `trait` being
176- // implemented, but rather from a "second order" obligation, like in
177- // `src/test/ui/associated-types/point-at-type-on-obligation-failure.rs`.
178- let trait_assoc_item = tcx. associated_item ( proj. projection_def_id ( ) ) ;
179- if let Some ( impl_item_span) =
180- items. iter ( ) . find ( |item| item. ident == trait_assoc_item. ident ) . map ( fix_span)
181- {
182- cause. span = impl_item_span;
183- } else {
184- let kind = & proj. ty ( ) . skip_binder ( ) . kind ;
185- if let ty:: Projection ( projection_ty) = kind {
186- // This happens when an associated type has a projection coming from another
187- // associated type. See `traits-assoc-type-in-supertrait-bad.rs`.
188- let trait_assoc_item = tcx. associated_item ( projection_ty. item_def_id ) ;
189- if let Some ( impl_item_span) =
190- items. iter ( ) . find ( |item| item. ident == trait_assoc_item. ident ) . map ( fix_span)
191- {
192- cause. span = impl_item_span;
193- }
175+ // The obligation comes not from the current `impl` nor the `trait` being implemented,
176+ // but rather from a "second order" obligation, where an associated type has a
177+ // projection coming from another associated type. See
178+ // `src/test/ui/associated-types/point-at-type-on-obligation-failure.rs` and
179+ // `traits-assoc-type-in-supertrait-bad.rs`.
180+ let kind = & proj. ty ( ) . skip_binder ( ) . kind ;
181+ if let ty:: Projection ( projection_ty) = kind {
182+ let trait_assoc_item = tcx. associated_item ( projection_ty. item_def_id ) ;
183+ if let Some ( impl_item_span) =
184+ items. iter ( ) . find ( |item| item. ident == trait_assoc_item. ident ) . map ( fix_span)
185+ {
186+ cause. span = impl_item_span;
194187 }
195188 }
196189 }
0 commit comments