@@ -437,34 +437,44 @@ fn rewrite_placeholder_outlives<'tcx>(
437
437
438
438
let annotation = annotations[ scc] ;
439
439
440
- let Some ( ( max_u, max_u_rvid) ) = annotation. unnameable_placeholder ( ) else {
440
+ let Some ( ( unnameable_u, unnameable_placeholder) ) = annotation. unnameable_placeholder ( )
441
+ else {
441
442
continue ;
442
443
} ;
443
444
444
445
debug ! (
445
- "Placeholder universe {max_u :?} is too large for its SCC, represented by {:?}" ,
446
+ "Placeholder {unnameable_placeholder :?} with universe {unnameable_u:?} unnameable from {scc:?} represented by {:?}" ,
446
447
annotation. representative
447
448
) ;
448
449
449
- // We only add one `r: 'static` constraint per SCC, where `r` is the SCC representative.
450
- // That constraint is annotated with some placeholder `unnameable` where
451
- // `unnameable` is unnameable from `r` and there is a path in the constraint graph
452
- // between them.
453
- if annotation. representative . rvid ( ) != max_u_rvid {
454
- // FIXME: if we can extract a useful blame span here, future error
455
- // reporting and constraint search can be simplified.
456
-
457
- added_constraints = true ;
458
- outlives_constraints. push ( OutlivesConstraint {
459
- sup : annotation. representative . rvid ( ) ,
460
- sub : fr_static,
461
- category : ConstraintCategory :: OutlivesUnnameablePlaceholder ( max_u_rvid) ,
462
- locations : Locations :: All ( rustc_span:: DUMMY_SP ) ,
463
- span : rustc_span:: DUMMY_SP ,
464
- variance_info : VarianceDiagInfo :: None ,
465
- from_closure : false ,
466
- } ) ;
450
+ let representative_rvid = annotation. representative . rvid ( ) ;
451
+
452
+ // If we got here, our representative is a placeholder and it reaches some
453
+ // region that can't name it. That's a separate error!
454
+ if representative_rvid == unnameable_placeholder {
455
+ debug ! (
456
+ "No need to add constraints for a placeholder reaching an existential that can't name it; that's a separate error."
457
+ ) ;
458
+ assert ! (
459
+ matches!( annotation. representative, Representative :: Placeholder ( _) ) ,
460
+ "Representative wasn't a placeholder, which should not be possible!"
461
+ ) ;
462
+ continue ;
467
463
}
464
+
465
+ // FIXME: if we can extract a useful blame span here, future error
466
+ // reporting and constraint search can be simplified.
467
+
468
+ added_constraints = true ;
469
+ outlives_constraints. push ( OutlivesConstraint {
470
+ sup : representative_rvid,
471
+ sub : fr_static,
472
+ category : ConstraintCategory :: OutlivesUnnameablePlaceholder ( unnameable_placeholder) ,
473
+ locations : Locations :: All ( rustc_span:: DUMMY_SP ) ,
474
+ span : rustc_span:: DUMMY_SP ,
475
+ variance_info : VarianceDiagInfo :: None ,
476
+ from_closure : false ,
477
+ } ) ;
468
478
}
469
479
added_constraints
470
480
}
0 commit comments