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.
Rollup merge of rust-lang#128160 - compiler-errors:auto, r=jackh726
Don't ICE when auto trait has assoc ty in old solver Kinda a pointless change to make, but it's observable w/o the feature gate, so let's just fix it. I reintroduced this ICE when I removed the "auto impl" kind from `ImplSource` in rust-lang#112687. Fixes rust-lang#117829 Fixes rust-lang#127746
- Loading branch information
Showing
6 changed files
with
103 additions
and
23 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
error[E0380]: auto traits cannot have associated items | ||
--> $DIR/assoc-ty.rs:10:10 | ||
| | ||
LL | auto trait Trait { | ||
| ----- auto traits cannot have associated items | ||
LL | | ||
LL | type Output; | ||
| -----^^^^^^- help: remove these associated items | ||
|
||
error[E0658]: auto traits are experimental and possibly buggy | ||
--> $DIR/assoc-ty.rs:8:1 | ||
| | ||
LL | / auto trait Trait { | ||
LL | | | ||
LL | | type Output; | ||
LL | | | ||
LL | | } | ||
| |_^ | ||
| | ||
= note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information | ||
= help: add `#![feature(auto_traits)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/assoc-ty.rs:15:36 | ||
| | ||
LL | let _: <() as Trait>::Output = (); | ||
| --------------------- ^^ expected associated type, found `()` | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected associated type `<() as Trait>::Output` | ||
found unit type `()` | ||
= help: consider constraining the associated type `<() as Trait>::Output` to `()` or calling a method that returns `<() as Trait>::Output` | ||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0308, E0380, E0658. | ||
For more information about an error, try `rustc --explain E0308`. |
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,40 @@ | ||
error[E0380]: auto traits cannot have associated items | ||
--> $DIR/assoc-ty.rs:10:10 | ||
| | ||
LL | auto trait Trait { | ||
| ----- auto traits cannot have associated items | ||
LL | | ||
LL | type Output; | ||
| -----^^^^^^- help: remove these associated items | ||
|
||
error[E0658]: auto traits are experimental and possibly buggy | ||
--> $DIR/assoc-ty.rs:8:1 | ||
| | ||
LL | / auto trait Trait { | ||
LL | | | ||
LL | | type Output; | ||
LL | | | ||
LL | | } | ||
| |_^ | ||
| | ||
= note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information | ||
= help: add `#![feature(auto_traits)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/assoc-ty.rs:15:36 | ||
| | ||
LL | let _: <() as Trait>::Output = (); | ||
| --------------------- ^^ types differ | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected associated type `<() as Trait>::Output` | ||
found unit type `()` | ||
= help: consider constraining the associated type `<() as Trait>::Output` to `()` or calling a method that returns `<() as Trait>::Output` | ||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0308, E0380, E0658. | ||
For more information about an error, try `rustc --explain E0308`. |
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,17 @@ | ||
//@ revisions: current next | ||
//@[next] compile-flags: -Znext-solver | ||
//@ ignore-compare-mode-next-solver (explicit revisions) | ||
|
||
// Tests that projection doesn't explode if we accidentally | ||
// put an associated type on an auto trait. | ||
|
||
auto trait Trait { | ||
//~^ ERROR auto traits are experimental and possibly buggy | ||
type Output; | ||
//~^ ERROR auto traits cannot have associated items | ||
} | ||
|
||
fn main() { | ||
let _: <() as Trait>::Output = (); | ||
//~^ ERROR mismatched types | ||
} |