ast_validation: tweak diagnostic output

This commit is contained in:
Mazdak Farrokhzad 2020-02-11 08:19:21 +01:00
parent 79d139ac70
commit 3341c94006
20 changed files with 96 additions and 81 deletions

View file

@ -14,26 +14,26 @@ fn main() {
//~^ ERROR functions cannot be both `const` and `async`
trait X {
async fn ft1(); //~ ERROR trait fns cannot be declared `async`
async fn ft1(); //~ ERROR functions in traits cannot be declared `async`
unsafe fn ft2(); // OK.
const fn ft3(); //~ ERROR trait fns cannot be declared const
const fn ft3(); //~ ERROR functions in traits cannot be declared const
extern "C" fn ft4(); // OK.
const async unsafe extern "C" fn ft5();
//~^ ERROR trait fns cannot be declared `async`
//~| ERROR trait fns cannot be declared const
//~^ ERROR functions in traits cannot be declared `async`
//~| ERROR functions in traits cannot be declared const
//~| ERROR functions cannot be both `const` and `async`
}
struct Y;
impl X for Y {
async fn ft1() {} //~ ERROR trait fns cannot be declared `async`
async fn ft1() {} //~ ERROR functions in traits cannot be declared `async`
//~^ ERROR method `ft1` has an incompatible type for trait
unsafe fn ft2() {} // OK.
const fn ft3() {} //~ ERROR trait fns cannot be declared const
const fn ft3() {} //~ ERROR functions in traits cannot be declared const
extern "C" fn ft4() {}
const async unsafe extern "C" fn ft5() {}
//~^ ERROR trait fns cannot be declared `async`
//~| ERROR trait fns cannot be declared const
//~^ ERROR functions in traits cannot be declared `async`
//~| ERROR functions in traits cannot be declared const
//~| ERROR method `ft5` has an incompatible type for trait
//~| ERROR functions cannot be both `const` and `async`
}

View file

@ -7,7 +7,7 @@ LL | const async unsafe extern "C" fn ff5() {} // OK.
| | `async` because of this
| `const` because of this
error[E0706]: trait fns cannot be declared `async`
error[E0706]: functions in traits cannot be declared `async`
--> $DIR/fn-header-semantic-fail.rs:17:9
|
LL | async fn ft1();
@ -18,19 +18,19 @@ LL | async fn ft1();
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
error[E0379]: trait fns cannot be declared const
error[E0379]: functions in traits cannot be declared const
--> $DIR/fn-header-semantic-fail.rs:19:9
|
LL | const fn ft3();
| ^^^^^ trait fns cannot be const
| ^^^^^ functions in traits cannot be const
error[E0379]: trait fns cannot be declared const
error[E0379]: functions in traits cannot be declared const
--> $DIR/fn-header-semantic-fail.rs:21:9
|
LL | const async unsafe extern "C" fn ft5();
| ^^^^^ trait fns cannot be const
| ^^^^^ functions in traits cannot be const
error[E0706]: trait fns cannot be declared `async`
error[E0706]: functions in traits cannot be declared `async`
--> $DIR/fn-header-semantic-fail.rs:21:9
|
LL | const async unsafe extern "C" fn ft5();
@ -50,7 +50,7 @@ LL | const async unsafe extern "C" fn ft5();
| | `async` because of this
| `const` because of this
error[E0706]: trait fns cannot be declared `async`
error[E0706]: functions in traits cannot be declared `async`
--> $DIR/fn-header-semantic-fail.rs:29:9
|
LL | async fn ft1() {}
@ -61,19 +61,19 @@ LL | async fn ft1() {}
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
error[E0379]: trait fns cannot be declared const
error[E0379]: functions in traits cannot be declared const
--> $DIR/fn-header-semantic-fail.rs:32:9
|
LL | const fn ft3() {}
| ^^^^^ trait fns cannot be const
| ^^^^^ functions in traits cannot be const
error[E0379]: trait fns cannot be declared const
error[E0379]: functions in traits cannot be declared const
--> $DIR/fn-header-semantic-fail.rs:34:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^ trait fns cannot be const
| ^^^^^ functions in traits cannot be const
error[E0706]: trait fns cannot be declared `async`
error[E0706]: functions in traits cannot be declared `async`
--> $DIR/fn-header-semantic-fail.rs:34:9
|
LL | const async unsafe extern "C" fn ft5() {}