-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inform the solver if evaluation is concurrent #130094
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
27 changes: 27 additions & 0 deletions
27
tests/ui/traits/next-solver/global-cache-and-parallel-frontend.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//@ compile-flags: -Zthreads=16 | ||
workingjubilee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
workingjubilee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// original issue: https://github.com/rust-lang/rust/issues/129112 | ||
// Previously, the "next" solver asserted that each successful solution is only obtained once. | ||
// This test exhibits a repro that, with next-solver + -Zthreads, triggered that old assert. | ||
// In the presence of multithreaded solving, it's possible to concurrently evaluate things twice, | ||
// which leads to replacing already-solved solutions in the global solution cache! | ||
// We assume this is fine if we check to make sure they are solved the same way each time. | ||
|
||
// This test only nondeterministically fails but that's okay, as it will be rerun by CI many times, | ||
// so it should almost always fail before anything is merged. As other thread tests already exist, | ||
// we already face this difficulty, probably. If we need to fix this by reducing the error margin, | ||
// we should improve compiletest. | ||
|
||
#[derive(Clone, Eq)] //~ ERROR [E0277] | ||
pub struct Struct<T>(T); | ||
|
||
impl<T: Clone, U> PartialEq<U> for Struct<T> | ||
where | ||
U: Into<Struct<T>> + Clone | ||
{ | ||
fn eq(&self, _other: &U) -> bool { | ||
todo!() | ||
} | ||
} | ||
|
||
fn main() {} |
24 changes: 24 additions & 0 deletions
24
tests/ui/traits/next-solver/global-cache-and-parallel-frontend.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,24 @@ | ||
error[E0277]: the trait bound `T: Clone` is not satisfied | ||
--> $DIR/global-cache-and-parallel-frontend.rs:15:17 | ||
| | ||
LL | #[derive(Clone, Eq)] | ||
| ^^ the trait `Clone` is not implemented for `T`, which is required by `Struct<T>: PartialEq` | ||
| | ||
note: required for `Struct<T>` to implement `PartialEq` | ||
--> $DIR/global-cache-and-parallel-frontend.rs:18:19 | ||
| | ||
LL | impl<T: Clone, U> PartialEq<U> for Struct<T> | ||
| ----- ^^^^^^^^^^^^ ^^^^^^^^^ | ||
| | | ||
| unsatisfied trait bound introduced here | ||
note: required by a bound in `Eq` | ||
--> $SRC_DIR/core/src/cmp.rs:LL:COL | ||
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
help: consider restricting type parameter `T` | ||
| | ||
LL | pub struct Struct<T: std::clone::Clone>(T); | ||
| +++++++++++++++++++ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows redundant duplicate work and checks. Ideally the second thread should wait for the first thread to calculate the cached result, but there should be at least a FIXME for this.