mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-01 09:32:15 +00:00
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