-
Notifications
You must be signed in to change notification settings - Fork 13.4k
elaborate unknowable goals #127574
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
Merged
+122
−2
Merged
elaborate unknowable goals #127574
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 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
13 changes: 13 additions & 0 deletions
13
tests/ui/coherence/super-traits/super-trait-knowable-1.current.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error[E0119]: conflicting implementations of trait `Overlap<_>` for type `()` | ||
--> $DIR/super-trait-knowable-1.rs:16:1 | ||
| | ||
LL | impl<T, U: Sub<T>> Overlap<T> for U {} | ||
| ----------------------------------- first implementation here | ||
LL | impl<T> Overlap<T> for () {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` | ||
| | ||
= note: downstream crates may implement trait `Sub<_>` for type `()` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Added in #124532. While `(): Super` is knowable, `(): Sub<?t>` is not. | ||
// | ||
// We therefore elaborate super trait bounds in the implicit negative | ||
// overlap check. | ||
|
||
//@ revisions: current next | ||
//@ ignore-compare-mode-next-solver (explicit revisions) | ||
//@[next] compile-flags: -Znext-solver | ||
//@[next] check-pass | ||
|
||
trait Super {} | ||
trait Sub<T>: Super {} | ||
|
||
trait Overlap<T> {} | ||
impl<T, U: Sub<T>> Overlap<T> for U {} | ||
impl<T> Overlap<T> for () {} | ||
//[current]~^ ERROR conflicting implementations | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// A regression test for pyella-0.1.5 which broke when | ||
// enabling the new solver in coherence. | ||
// | ||
// `Tensor: TensorValue` is knowable while `Tensor: TensorOp<?t2>` | ||
// may be implemented downstream. We previously didn't check the | ||
// super trait bound in coherence, causing these impls to overlap. | ||
// | ||
// However, we did fail to normalize `<Tensor as TensorValue::Unmasked` | ||
// which caused the old solver to emit a `Tensor: TensorValue` goal in | ||
// `fn normalize_to_error` which then failed, causing this test to pass. | ||
|
||
//@ revisions: current next | ||
//@ ignore-compare-mode-next-solver (explicit revisions) | ||
//@[next] compile-flags: -Znext-solver | ||
//@ check-pass | ||
|
||
pub trait TensorValue { | ||
type Unmasked; | ||
} | ||
|
||
trait TensorCompare<T> {} | ||
pub trait TensorOp<T>: TensorValue {} | ||
|
||
pub struct Tensor; | ||
impl<T2> TensorCompare<T2> for Tensor {} | ||
impl<T1, T2> TensorCompare<T2> for T1 | ||
where | ||
T1: TensorOp<T2>, | ||
T1::Unmasked: Sized, | ||
{} | ||
|
||
|
||
fn main() {} |
13 changes: 13 additions & 0 deletions
13
tests/ui/coherence/super-traits/super-trait-knowable-3.current.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error[E0119]: conflicting implementations of trait `Overlap<_>` for type `()` | ||
--> $DIR/super-trait-knowable-3.rs:19:1 | ||
| | ||
LL | impl<T, U: Bound<W<T>>> Overlap<T> for U {} | ||
| ---------------------------------------- first implementation here | ||
LL | impl<T> Overlap<T> for () {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` | ||
| | ||
= note: downstream crates may implement trait `Sub<_>` for type `()` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Unlike in `super-trait-knowable-1.rs`, the knowable | ||
// super trait bound is in a nested goal so this would not | ||
// compile if we were to only elaborate root goals. | ||
|
||
//@ revisions: current next | ||
//@ ignore-compare-mode-next-solver (explicit revisions) | ||
//@[next] compile-flags: -Znext-solver | ||
//@[next] check-pass | ||
|
||
trait Super {} | ||
trait Sub<T>: Super {} | ||
|
||
struct W<T>(T); | ||
trait Bound<T> {} | ||
impl<T: Sub<U>, U> Bound<W<U>> for T {} | ||
|
||
trait Overlap<T> {} | ||
impl<T, U: Bound<W<T>>> Overlap<T> for U {} | ||
impl<T> Overlap<T> for () {} | ||
//[current]~^ ERROR conflicting implementations of trait `Overlap<_>` for type `()` | ||
|
||
fn main() {} |
2 changes: 1 addition & 1 deletion
2
tests/ui/issues/issue-48728.stderr → tests/ui/issues/issue-48728.current.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
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
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.
Uh oh!
There was an error while loading. Please reload this page.