Files
rust/compiler/rustc_next_trait_solver/src
Jonathan Brouwer a5fd214ec2 Rollup merge of #160831 - sjwang05:equate-again, r=lcnr
re-equate the object bound's trait ref with the goal's when considering object bounds

https://github.com/rust-lang/trait-system-refactor-initiative/issues/295 bisects to rust-lang/rust#152859, which changed `probe_and_consider_object_bound_candidate` to pass the trait object's trait ref in a binder to `predicates_for_object_candidate`, which calls `instantiate_binder_with_infer` on the binder.

Re-instantiating the binder like this, however, loses the constraint that `'x: 'static`, even though earlier in `match_assumption` we actually did equate the object trait ref with the goal's trait ref, which gave us the `eq('x, 'static)` relationship we needed. However, the new inference var has no relationship with the equality we established; hence we lose `'x: 'static` and therefore `Self: 'static` and `'s: 'static`.

We therefore inline `match_assumption` and directly equate the assumption's trait ref with the goal's before passing the assumption to `predicates_for_object_candidate` instead and remove the re-instantiation.

fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/295

cc @lcnr
2026-09-10 14:22:30 +02:00
..
…