@@ -2321,11 +2321,10 @@ fn assoc_ty_own_obligations<'cx, 'tcx>(
2321
2321
nested : & mut Vec < PredicateObligation < ' tcx > > ,
2322
2322
) {
2323
2323
let tcx = selcx. tcx ( ) ;
2324
- for predicate in tcx
2324
+ let own = tcx
2325
2325
. predicates_of ( obligation. predicate . item_def_id )
2326
- . instantiate_own ( tcx, obligation. predicate . substs )
2327
- . predicates
2328
- {
2326
+ . instantiate_own ( tcx, obligation. predicate . substs ) ;
2327
+ for ( predicate, span) in std:: iter:: zip ( own. predicates , own. spans ) {
2329
2328
let normalized = normalize_with_depth_to (
2330
2329
selcx,
2331
2330
obligation. param_env ,
@@ -2334,9 +2333,30 @@ fn assoc_ty_own_obligations<'cx, 'tcx>(
2334
2333
predicate,
2335
2334
nested,
2336
2335
) ;
2336
+
2337
+ let nested_cause = if matches ! (
2338
+ obligation. cause. code( ) ,
2339
+ super :: CompareImplItemObligation { .. }
2340
+ | super :: CheckAssociatedTypeBounds { .. }
2341
+ | super :: AscribeUserTypeProvePredicate ( ..)
2342
+ ) {
2343
+ obligation. cause . clone ( )
2344
+ } else if span. is_dummy ( ) {
2345
+ ObligationCause :: new (
2346
+ obligation. cause . span ,
2347
+ obligation. cause . body_id ,
2348
+ super :: ItemObligation ( obligation. predicate . item_def_id ) ,
2349
+ )
2350
+ } else {
2351
+ ObligationCause :: new (
2352
+ obligation. cause . span ,
2353
+ obligation. cause . body_id ,
2354
+ super :: BindingObligation ( obligation. predicate . item_def_id , span) ,
2355
+ )
2356
+ } ;
2337
2357
nested. push ( Obligation :: with_depth (
2338
2358
tcx,
2339
- obligation . cause . clone ( ) ,
2359
+ nested_cause ,
2340
2360
obligation. recursion_depth + 1 ,
2341
2361
obligation. param_env ,
2342
2362
normalized,
0 commit comments