Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #71896 - spastorino:existential-assoc-types-variance, r…
…=nikomatsakis Relate existential associated types with variance Invariant Fixes #71550 #72315 r? @nikomatsakis The test case reported in that issue now errors with the following message ... ``` error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in function call due to conflicting requirements --> /tmp/test.rs:25:5 | 25 | bad(&Bar(PhantomData), x) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 24:11... --> /tmp/test.rs:24:11 | 24 | fn extend<'a, T>(x: &'a T) -> &'static T { | ^^ note: ...so that reference does not outlive borrowed content --> /tmp/test.rs:25:28 | 25 | bad(&Bar(PhantomData), x) | ^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that the types are compatible --> /tmp/test.rs:25:9 | 25 | bad(&Bar(PhantomData), x) | ^^^^^^^^^^^^^^^^^ = note: expected `&'static T` found `&T` error: aborting due to previous error For more information about this error, try `rustc --explain E0495`. ``` I could also add that test case if we want to have a weaponized one too.
- Loading branch information