Open compiler-errors opened 12 months ago
The current trait solver avoids this by normalizing the param-env, so the bound in test
above becomes where T: 'static
.
This is not fixed by rust-lang/rust#119101, MIR borrowck doesn't normalize type-outlives yet. That will happen soon.
With https://github.com/rust-lang/rust/pull/119101 and https://github.com/rust-lang/rust/pull/120513
TypeOutlives
obligations and assumptions are now eagerly normalized at the start of regionck and borrowck.previous issue
Type-outlives bounds can be proven several ways -- via item bounds, via param-env clauses, and by recursively applying to the type's components. When applying param-env clauses that may satisfy a type-outlives bounds, we use the
Match
relation, which only considers types structurally.That causes this code to go from passing to failing in the new trait solver: