-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Treat TAIT equation as always ambiguous in coherence #112780
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
error[E0658]: `impl Trait` in type aliases is unstable | ||
--> $DIR/from_over_into_unfixable.rs:35:15 | ||
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true | ||
--> $DIR/from_over_into_unfixable.rs:11:1 | ||
| | ||
LL | type Opaque = impl Sized; | ||
| ^^^^^^^^^^ | ||
LL | impl Into<InMacro> for String { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information | ||
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable | ||
= help: replace the `Into` implementation with `From<std::string::String>` | ||
= note: `-D clippy::from-over-into` implied by `-D warnings` | ||
|
||
error: aborting due to previous error | ||
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true | ||
--> $DIR/from_over_into_unfixable.rs:19:1 | ||
| | ||
LL | impl Into<WeirdUpperSelf> for &'static [u8] { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: replace the `Into` implementation with `From<&'static [u8]>` | ||
|
||
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true | ||
--> $DIR/from_over_into_unfixable.rs:28:1 | ||
| | ||
LL | impl Into<u8> for ContainsVal { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see | ||
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence | ||
= help: replace the `Into` implementation with `From<ContainsVal>` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
13 changes: 13 additions & 0 deletions
13
tests/ui/impl-trait/coherence-treats-tait-ambig.current.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,13 @@ | ||
error[E0119]: conflicting implementations of trait `Into<T>` for type `Foo` | ||
--> $DIR/coherence-treats-tait-ambig.rs:10:1 | ||
| | ||
LL | impl Into<T> for Foo { | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: conflicting implementation in crate `core`: | ||
- impl<T, U> Into<U> for T | ||
where U: From<T>; | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
13 changes: 13 additions & 0 deletions
13
tests/ui/impl-trait/coherence-treats-tait-ambig.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,13 @@ | ||
error[E0119]: conflicting implementations of trait `Into<T>` for type `Foo` | ||
--> $DIR/coherence-treats-tait-ambig.rs:10:1 | ||
| | ||
LL | impl Into<T> for Foo { | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: conflicting implementation in crate `core`: | ||
- impl<T, U> Into<U> for T | ||
where U: From<T>; | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
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,19 @@ | ||
// revisions: current next | ||
//[next] compile-flags: -Ztrait-solver=next | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
type T = impl Sized; | ||
|
||
struct Foo; | ||
|
||
impl Into<T> for Foo { | ||
//~^ ERROR conflicting implementations of trait `Into<T>` for type `Foo` | ||
fn into(self) -> T { | ||
Foo | ||
} | ||
} | ||
|
||
fn main() { | ||
let _: T = Foo.into(); | ||
} |
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.
Removed this example because it shouldn't pass coherence.