forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
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 rust-lang#116219 - compiler-errors:relate-alias-ty-with…
…-variance, r=<try> Relate alias ty with variance In the new solver, turns out that the subst-relate branch of the alias-relate predicate was relating args invariantly even for opaques, which have variance 💀. This change is a bit more invasive, but I'd rather not special-case it [here](https://github.com/rust-lang/rust/blob/aeaa5c30e5c9041264a2e8314b68ad84c2dc3169/compiler/rustc_trait_selection/src/solve/alias_relate.rs#L171-L190) and then have it break elsewhere. I'm doing a perf run to see if the extra call to `def_kind` is that expensive, if it is, I'll reconsider. r? `@lcnr`
- Loading branch information
Showing
4 changed files
with
40 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// check-pass | ||
// compile-flags: -Ztrait-solver=next | ||
|
||
fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Sized { | ||
() | ||
} | ||
|
||
fn main() { | ||
// in NLL, we want to make sure that the `'a` subst of `foo` does not get | ||
// related between `x` and the RHS of the assignment. That would require | ||
// that the temp is live for the lifetime of the variable `x`, which of | ||
// course is not necessary since `'a` is not captured by the RPIT. | ||
let x = foo(&Vec::new()); | ||
} |