-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Apply nested goals certainty to InspectGoals
for normalizes-to
#142127
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
Open
compiler-errors
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
compiler-errors:nested-goals-certainty
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 hidden or 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 was deleted.
Oops, something went wrong.
21 changes: 17 additions & 4 deletions
21
tests/ui/impl-trait/auto-trait-selection-freeze.next.stderr
This file contains hidden or 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 |
---|---|---|
@@ -1,9 +1,22 @@ | ||
error[E0284]: type annotations needed: cannot satisfy `impl Sized == _` | ||
--> $DIR/auto-trait-selection-freeze.rs:19:5 | ||
error[E0283]: type annotations needed | ||
--> $DIR/auto-trait-selection-freeze.rs:19:16 | ||
| | ||
LL | if false { is_trait(foo()) } else { Default::default() } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `impl Sized == _` | ||
| ^^^^^^^^ ----- type must be known at this point | ||
| | | ||
| cannot infer type of the type parameter `T` declared on the function `is_trait` | ||
| | ||
= note: cannot satisfy `_: Trait<_>` | ||
note: required by a bound in `is_trait` | ||
--> $DIR/auto-trait-selection-freeze.rs:11:16 | ||
| | ||
LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { | ||
| ^^^^^^^^ required by this bound in `is_trait` | ||
help: consider specifying the generic arguments | ||
| | ||
LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } | ||
| ++++++++ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0284`. | ||
For more information about this error, try `rustc --explain E0283`. |
This file contains hidden or 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 |
---|---|---|
@@ -1,9 +1,22 @@ | ||
error[E0284]: type annotations needed: cannot satisfy `impl Sized == _` | ||
--> $DIR/auto-trait-selection.rs:15:5 | ||
error[E0283]: type annotations needed | ||
--> $DIR/auto-trait-selection.rs:15:16 | ||
| | ||
LL | if false { is_trait(foo()) } else { Default::default() } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `impl Sized == _` | ||
| ^^^^^^^^ ----- type must be known at this point | ||
| | | ||
| cannot infer type of the type parameter `T` declared on the function `is_trait` | ||
| | ||
= note: cannot satisfy `_: Trait<_>` | ||
note: required by a bound in `is_trait` | ||
--> $DIR/auto-trait-selection.rs:7:16 | ||
| | ||
LL | fn is_trait<T: Trait<U>, U: Default>(_: T) -> U { | ||
| ^^^^^^^^ required by this bound in `is_trait` | ||
help: consider specifying the generic arguments | ||
| | ||
LL | if false { is_trait::<T, U>(foo()) } else { Default::default() } | ||
| ++++++++ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0284`. | ||
For more information about this error, try `rustc --explain E0283`. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
8 changes: 4 additions & 4 deletions
8
tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr
This file contains hidden or 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
error[E0284]: type annotations needed: cannot satisfy `_ == A` | ||
--> $DIR/two_tait_defining_each_other2.rs:12:8 | ||
error[E0282]: type annotations needed | ||
--> $DIR/two_tait_defining_each_other2.rs:12:11 | ||
| | ||
LL | fn muh(x: A) -> B { | ||
| ^ cannot satisfy `_ == A` | ||
| ^ cannot infer type | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0284`. | ||
For more information about this error, try `rustc --explain E0282`. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
6 changes: 3 additions & 3 deletions
6
tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr
This file contains hidden or 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
error[E0271]: type mismatch resolving `impl !Fn<(u32,)> == ()` | ||
error[E0277]: the trait bound `(): !Fn(u32)` is not satisfied | ||
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17 | ||
| | ||
LL | fn produce() -> impl !Fn<(u32,)> {} | ||
| ^^^^^^^^^^^^^^^^ types differ | ||
| ^^^^^^^^^^^^^^^^ the trait bound `(): !Fn(u32)` is not satisfied | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0271`. | ||
For more information about this error, try `rustc --explain E0277`. |
13 changes: 10 additions & 3 deletions
13
tests/ui/traits/next-solver/opaques/dont-type_of-tait-in-defining-scope.is_send.stderr
This file contains hidden or 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 |
---|---|---|
@@ -1,9 +1,16 @@ | ||
error[E0284]: type annotations needed: cannot satisfy `Foo == _` | ||
error[E0283]: type annotations needed: cannot satisfy `Foo: Send` | ||
--> $DIR/dont-type_of-tait-in-defining-scope.rs:16:18 | ||
| | ||
LL | needs_send::<Foo>(); | ||
| ^^^ cannot satisfy `Foo == _` | ||
| ^^^ | ||
| | ||
= note: cannot satisfy `Foo: Send` | ||
note: required by a bound in `needs_send` | ||
--> $DIR/dont-type_of-tait-in-defining-scope.rs:12:18 | ||
| | ||
LL | fn needs_send<T: Send>() {} | ||
| ^^^^ required by this bound in `needs_send` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0284`. | ||
For more information about this error, try `rustc --explain E0283`. |
Oops, something went wrong.
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.
Here's the major change. Instead of evaluating the goal in this probe and throwing away nested obligations, then later constraining the RHS, we now evaluate the goal, constrain the RHS, and evaluate nested obligations all together, and stash the resulting certainty.
Then later on where we used to constrain the RHS in the
InspectGoal::new
constructor, we just apply that certainty.