forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#127568 - lcnr:undo-leakcheck, r=oli-obk instantiate higher ranked goals in candidate selection again This reverts rust-lang#119820 as that PR has a significant impact and breaks code which *feels like it should work*. The impact ended up being larger than we expected during the FCP and we've ended up with some ideas for how we can work around this issue in the next solver. This has been discussed in the previous high bandwidth t-types meeting: https://rust-lang.zulipchat.com/#narrow/stream/326132-t-types.2Fmeetings/topic/2024-07-09.20high.20bandwidth.20meeting. We'll therefore keep this inconsistency between the two solvers for now and will have to deal with it before stabilizating the use of the new solver outside of coherence: rust-lang/trait-system-refactor-initiative#120. fixes rust-lang#125194 after a beta-backport. The pattern which is more widely used than expected and feels like it should work, especially without deep knowledge of the type system is ```rust trait Trait<'a> {} impl<'a, T> Trait<'a> for T {} fn trait_bound<T: for<'a> Trait<'a>>() {} // A function with a where-bound which is more restrictive than the impl. fn function1<T: Trait<'static>>() { // stable: ok // with rust-lang#119820: error as we prefer the where-bound over the impl // with this PR: back to ok trait_bound::<T>(); } ``` r? `@rust-lang/types`
- Loading branch information
Showing
21 changed files
with
121 additions
and
299 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
23 changes: 23 additions & 0 deletions
23
tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-1.next.stderr
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,23 @@ | ||
error[E0277]: the trait bound `for<'a> &'a &T: Trait` is not satisfied | ||
--> $DIR/candidate-from-env-universe-err-1.rs:27:16 | ||
| | ||
LL | hr_bound::<&T>(); | ||
| ^^ the trait `for<'a> Trait` is not implemented for `&'a &T` | ||
| | ||
note: required by a bound in `hr_bound` | ||
--> $DIR/candidate-from-env-universe-err-1.rs:14:20 | ||
| | ||
LL | fn hr_bound<T>() | ||
| -------- required by a bound in this function | ||
LL | where | ||
LL | for<'a> &'a T: Trait, | ||
| ^^^^^ required by this bound in `hr_bound` | ||
help: consider removing the leading `&`-reference | ||
| | ||
LL - hr_bound::<&T>(); | ||
LL + hr_bound::<T>(); | ||
| | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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
26 changes: 0 additions & 26 deletions
26
tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-1.stderr
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-2.current.stderr
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-2.next.stderr
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
26 changes: 0 additions & 26 deletions
26
tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-2.old.stderr
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.