-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edebf77
commit e34fd54
Showing
12 changed files
with
135 additions
and
47 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 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 @@ | ||
#![feature(auto_traits)] | ||
|
||
// run-rustfix | ||
|
||
auto trait Generic {} | ||
//~^ auto traits cannot have generic parameters [E0567] | ||
auto trait Bound {} | ||
//~^ auto traits cannot have super traits or lifetime bounds [E0568] | ||
auto trait LifetimeBound {} | ||
//~^ auto traits cannot have super traits or lifetime bounds [E0568] | ||
auto trait MyTrait { } | ||
//~^ auto traits cannot have associated items [E0380] | ||
fn main() {} |
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,9 +1,13 @@ | ||
#![feature(auto_traits)] | ||
|
||
// run-rustfix | ||
|
||
auto trait Generic<T> {} | ||
//~^ auto traits cannot have generic parameters [E0567] | ||
auto trait Bound : Copy {} | ||
//~^ auto traits cannot have super traits [E0568] | ||
//~^ auto traits cannot have super traits or lifetime bounds [E0568] | ||
auto trait LifetimeBound : 'static {} | ||
//~^ auto traits cannot have super traits or lifetime bounds [E0568] | ||
auto trait MyTrait { fn foo() {} } | ||
//~^ auto traits cannot have methods or associated items [E0380] | ||
//~^ auto traits cannot have associated items [E0380] | ||
fn main() {} |
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,28 +1,37 @@ | ||
error[E0567]: auto traits cannot have generic parameters | ||
--> $DIR/auto-trait-validation.rs:3:19 | ||
--> $DIR/auto-trait-validation.rs:5:19 | ||
| | ||
LL | auto trait Generic<T> {} | ||
| -------^^^ help: remove the parameters | ||
| | | ||
| auto trait cannot have generic parameters | ||
|
||
error[E0568]: auto traits cannot have super traits | ||
--> $DIR/auto-trait-validation.rs:5:20 | ||
error[E0568]: auto traits cannot have super traits or lifetime bounds | ||
--> $DIR/auto-trait-validation.rs:7:17 | ||
| | ||
LL | auto trait Bound : Copy {} | ||
| ----- ^^^^ help: remove the super traits | ||
| -----^^^^^^^ help: remove the super traits or lifetime bounds | ||
| | | ||
| auto trait cannot have super traits | ||
| auto trait cannot have super traits or lifetime bounds | ||
|
||
error[E0380]: auto traits cannot have methods or associated items | ||
--> $DIR/auto-trait-validation.rs:7:25 | ||
error[E0568]: auto traits cannot have super traits or lifetime bounds | ||
--> $DIR/auto-trait-validation.rs:9:25 | ||
| | ||
LL | auto trait MyTrait { fn foo() {} } | ||
| ------- ^^^ | ||
LL | auto trait LifetimeBound : 'static {} | ||
| -------------^^^^^^^^^^ help: remove the super traits or lifetime bounds | ||
| | | ||
| auto trait cannot have items | ||
| auto trait cannot have super traits or lifetime bounds | ||
|
||
error[E0380]: auto traits cannot have associated items | ||
--> $DIR/auto-trait-validation.rs:11:25 | ||
| | ||
LL | auto trait MyTrait { fn foo() {} } | ||
| ------- ---^^^----- | ||
| | | | ||
| | help: remove these associated items | ||
| auto trait cannot have associated items | ||
|
||
error: aborting due to 3 previous errors | ||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0380, E0567, E0568. | ||
For more information about an error, try `rustc --explain E0380`. |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Regression test for issue #84075. | ||
|
||
#![feature(auto_traits)] | ||
|
||
auto trait Magic where Self: Copy {} //~ ERROR E0568 | ||
impl<T: Magic> Magic for T {} | ||
|
||
fn copy<T: Magic>(x: T) -> (T, T) { (x, x) } | ||
|
||
#[derive(Debug)] | ||
struct NoClone; | ||
|
||
fn main() { | ||
let (a, b) = copy(NoClone); | ||
println!("{:?} {:?}", a, b); | ||
} |
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,11 @@ | ||
error[E0568]: auto traits cannot have super traits or lifetime bounds | ||
--> $DIR/issue-84075.rs:5:18 | ||
| | ||
LL | auto trait Magic where Self: Copy {} | ||
| ----- ^^^^^^^^^^^^^^^^ help: remove the super traits or lifetime bounds | ||
| | | ||
| auto trait cannot have super traits or lifetime bounds | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0568`. |
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
18 changes: 13 additions & 5 deletions
18
src/test/ui/auto-traits/typeck-auto-trait-no-supertraits-2.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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
error[E0568]: auto traits cannot have super traits | ||
--> $DIR/typeck-auto-trait-no-supertraits-2.rs:4:20 | ||
error[E0568]: auto traits cannot have super traits or lifetime bounds | ||
--> $DIR/typeck-auto-trait-no-supertraits-2.rs:4:17 | ||
| | ||
LL | auto trait Magic : Sized where Option<Self> : Magic {} | ||
| ----- ^^^^^ help: remove the super traits | ||
| -----^^^^^^^^ help: remove the super traits or lifetime bounds | ||
| | | ||
| auto trait cannot have super traits | ||
| auto trait cannot have super traits or lifetime bounds | ||
|
||
error: aborting due to previous error | ||
error[E0568]: auto traits cannot have super traits or lifetime bounds | ||
--> $DIR/typeck-auto-trait-no-supertraits-2.rs:4:26 | ||
| | ||
LL | auto trait Magic : Sized where Option<Self> : Magic {} | ||
| ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the super traits or lifetime bounds | ||
| | | ||
| auto trait cannot have super traits or lifetime bounds | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0568`. |
8 changes: 4 additions & 4 deletions
8
src/test/ui/auto-traits/typeck-auto-trait-no-supertraits.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
8 changes: 4 additions & 4 deletions
8
src/test/ui/traits/inductive-overflow/supertrait-auto-trait.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