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.
Auto merge of rust-lang#126024 - oli-obk:candidate_key_caching_is_uns…
…ound_yay, r=<try> Do not use global cache for selection candidates if opaque types can be constrained fixes rust-lang#105787 r? `@ghost` This is certainly the crudest way to make the cache sound wrt opaque types, but if perf lets us get away with this, let's do it in the old solver and let the new solver fix this correctly once and for all. If perf is prohibitively bad, I'll look into alternatives (using canonical queries, checking whether any opaque types got constrained or whether decisions based on the availability of opaque types were made, still using the cache for things that can't possibly constrain opaque types (probably sound, famous last words), ..) cc rust-lang#122192 (comment) * [ ] check if this actually fixes rust-lang#105787 or if it just fixes the opaque type reproducer
- Loading branch information
Showing
7 changed files
with
56 additions
and
12 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
3 changes: 2 additions & 1 deletion
3
tests/crashes/119272.rs → ...traits/opaque_type_candidate_selection.rs
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
21 changes: 21 additions & 0 deletions
21
tests/ui/auto-traits/opaque_type_candidate_selection.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,21 @@ | ||
error[E0284]: type annotations needed | ||
--> $DIR/opaque_type_candidate_selection.rs:7:20 | ||
| | ||
LL | pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> { | ||
| ^ cannot infer type | ||
| | ||
= note: cannot satisfy `<Alias<T> as Trait<T>>::Assoc == _` | ||
note: required because it appears within the type `Container<Alias<T>, T>` | ||
--> $DIR/opaque_type_candidate_selection.rs:13:8 | ||
| | ||
LL | struct Container<T: Trait<U>, U> { | ||
| ^^^^^^^^^ | ||
= help: unsized fn params are gated as an unstable feature | ||
help: function arguments must have a statically known size, borrowed types always have a known size | ||
| | ||
LL | pub fn cast<T>(x: &Container<Alias<T>, T>) -> Container<T, T> { | ||
| + | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0284`. |
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,21 @@ | ||
error[E0284]: type annotations needed | ||
--> $DIR/opaques.rs:11:20 | ||
| | ||
LL | pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> { | ||
| ^ cannot infer type | ||
| | ||
= note: cannot satisfy `<Alias<T> as Trait<T>>::Assoc == _` | ||
note: required because it appears within the type `Container<Alias<T>, T>` | ||
--> $DIR/opaques.rs:17:8 | ||
| | ||
LL | struct Container<T: Trait<U>, U> { | ||
| ^^^^^^^^^ | ||
= help: unsized fn params are gated as an unstable feature | ||
help: function arguments must have a statically known size, borrowed types always have a known size | ||
| | ||
LL | pub fn cast<T>(x: &Container<Alias<T>, T>) -> Container<T, T> { | ||
| + | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0284`. |
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