Further tweak spans in ast validation errors

This commit is contained in:
Esteban Küber 2020-03-06 10:55:21 -08:00
parent 713a291441
commit 6fba412499
11 changed files with 91 additions and 48 deletions

View file

@ -1,8 +1,8 @@
error: functions cannot be both `const` and `async`
--> $DIR/no-const-async.rs:4:1
--> $DIR/no-const-async.rs:4:5
|
LL | pub const async fn x() {}
| ^^^^-----^-----^^^^^^^^^^
| ----^^^^^-^^^^^----------
| | |
| | `async` because of this
| `const` because of this

View file

@ -1,20 +1,26 @@
error[E0567]: auto traits cannot have generic parameters
--> $DIR/auto-trait-validation.rs:3:1
--> $DIR/auto-trait-validation.rs:3:20
|
LL | auto trait Generic<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
| ------- ^ cannot have this generic parameter
| |
| auto trait cannot have generic parameters
error[E0568]: auto traits cannot have super traits
--> $DIR/auto-trait-validation.rs:5:1
--> $DIR/auto-trait-validation.rs:5:20
|
LL | auto trait Bound : Copy {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| ----- ^^^^ cannot have this super trait
| |
| auto trait cannot have super traits
error[E0380]: auto traits cannot have methods or associated items
--> $DIR/auto-trait-validation.rs:7:1
--> $DIR/auto-trait-validation.rs:7:25
|
LL | auto trait MyTrait { fn foo() {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ------- ^^^
| |
| auto trait cannot have items
error: aborting due to 3 previous errors

View file

@ -3,8 +3,7 @@
#![feature(optin_builtin_traits)]
unsafe auto trait Trait {
//~^ ERROR E0380
type Output;
type Output; //~ ERROR E0380
}
fn call_method<T: Trait>(x: T) {}

View file

@ -1,11 +1,10 @@
error[E0380]: auto traits cannot have methods or associated items
--> $DIR/issue-23080-2.rs:5:1
--> $DIR/issue-23080-2.rs:6:10
|
LL | / unsafe auto trait Trait {
LL | |
LL | | type Output;
LL | | }
| |_^
LL | unsafe auto trait Trait {
| ----- auto trait cannot have items
LL | type Output;
| ^^^^^^
error[E0275]: overflow evaluating the requirement `<() as Trait>::Output`
|

View file

@ -1,8 +1,7 @@
#![feature(optin_builtin_traits)]
unsafe auto trait Trait {
//~^ ERROR E0380
fn method(&self) {
fn method(&self) { //~ ERROR E0380
println!("Hello");
}
}

View file

@ -1,13 +1,10 @@
error[E0380]: auto traits cannot have methods or associated items
--> $DIR/issue-23080.rs:3:1
--> $DIR/issue-23080.rs:4:8
|
LL | / unsafe auto trait Trait {
LL | |
LL | | fn method(&self) {
LL | | println!("Hello");
LL | | }
LL | | }
| |_^
LL | unsafe auto trait Trait {
| ----- auto trait cannot have items
LL | fn method(&self) {
| ^^^^^^
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:13:5
|
LL | const async unsafe extern "C" fn ff5() {} // OK.
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^-^^^^^------------------------------
| | |
| | `async` because of this
| `const` because of this
@ -45,7 +45,7 @@ error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:21:9
|
LL | const async unsafe extern "C" fn ft5();
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^-^^^^^----------------------------
| | |
| | `async` because of this
| `const` because of this
@ -88,7 +88,7 @@ error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:34:9
|
LL | const async unsafe extern "C" fn ft5() {}
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^-^^^^^------------------------------
| | |
| | `async` because of this
| `const` because of this
@ -97,7 +97,7 @@ error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:46:9
|
LL | const async unsafe extern "C" fn fi5() {}
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^-^^^^^------------------------------
| | |
| | `async` because of this
| `const` because of this
@ -160,7 +160,7 @@ error: functions cannot be both `const` and `async`
--> $DIR/fn-header-semantic-fail.rs:55:9
|
LL | const async unsafe extern "C" fn fe5();
| -----^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^-^^^^^----------------------------
| | |
| | `async` because of this
| `const` because of this

View file

@ -1,8 +1,10 @@
error[E0568]: auto traits cannot have super traits
--> $DIR/traits-inductive-overflow-supertrait-oibit.rs:7:1
--> $DIR/traits-inductive-overflow-supertrait-oibit.rs:7:19
|
LL | auto trait Magic: Copy {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| ----- ^^^^ cannot have this super trait
| |
| auto trait cannot have super traits
error[E0277]: the trait bound `NoClone: std::marker::Copy` is not satisfied
--> $DIR/traits-inductive-overflow-supertrait-oibit.rs:15:23

View file

@ -1,8 +1,10 @@
error[E0568]: auto traits cannot have super traits
--> $DIR/typeck-auto-trait-no-supertraits-2.rs:3:1
--> $DIR/typeck-auto-trait-no-supertraits-2.rs:3:20
|
LL | auto trait Magic : Sized where Option<Self> : Magic {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ----- ^^^^^ cannot have this super trait
| |
| auto trait cannot have super traits
error: aborting due to previous error

View file

@ -1,8 +1,10 @@
error[E0568]: auto traits cannot have super traits
--> $DIR/typeck-auto-trait-no-supertraits.rs:27:1
--> $DIR/typeck-auto-trait-no-supertraits.rs:27:19
|
LL | auto trait Magic: Copy {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| ----- ^^^^ cannot have this super trait
| |
| auto trait cannot have super traits
error: aborting due to previous error