parser: tweak unmatched wording

This commit is contained in:
Mazdak Farrokhzad 2020-02-23 04:49:26 +01:00
parent d446c73e6a
commit ab84914fe4
17 changed files with 45 additions and 32 deletions

View file

@ -3,7 +3,7 @@ fn main() {}
trait Foo {
default!(); //~ ERROR cannot find macro `default` in this scope
default do
//~^ ERROR unmatched `default`
//~^ ERROR `default` not followed by an item
//~| ERROR non-item in item list
}
@ -11,6 +11,6 @@ struct S;
impl S {
default!(); //~ ERROR cannot find macro `default` in this scope
default do
//~^ ERROR unmatched `default`
//~^ ERROR `default` not followed by an item
//~| ERROR non-item in item list
}

View file

@ -1,8 +1,10 @@
error: unmatched `default`
error: `default` not followed by an item
--> $DIR/default-unmatched-assoc.rs:5:5
|
LL | default do
| ^^^^^^^ the unmatched `default`
| ^^^^^^^ the `default` qualifier
|
= note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
error: non-item in item list
--> $DIR/default-unmatched-assoc.rs:5:13
@ -16,11 +18,13 @@ LL | default do
LL | }
| - item list ends here
error: unmatched `default`
error: `default` not followed by an item
--> $DIR/default-unmatched-assoc.rs:13:5
|
LL | default do
| ^^^^^^^ the unmatched `default`
| ^^^^^^^ the `default` qualifier
|
= note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
error: non-item in item list
--> $DIR/default-unmatched-assoc.rs:13:13

View file

@ -3,6 +3,6 @@ fn main() {}
extern "C" {
default!(); //~ ERROR cannot find macro `default` in this scope
default do
//~^ ERROR unmatched `default`
//~^ ERROR `default` not followed by an item
//~| ERROR non-item in item list
}

View file

@ -1,8 +1,10 @@
error: unmatched `default`
error: `default` not followed by an item
--> $DIR/default-unmatched-extern.rs:5:5
|
LL | default do
| ^^^^^^^ the unmatched `default`
| ^^^^^^^ the `default` qualifier
|
= note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
error: non-item in item list
--> $DIR/default-unmatched-extern.rs:5:13

View file

@ -1,6 +1,6 @@
mod foo {
default!(); // OK.
default do
//~^ ERROR unmatched `default`
//~^ ERROR `default` not followed by an item
//~| ERROR expected item, found reserved keyword `do`
}

View file

@ -1,8 +1,10 @@
error: unmatched `default`
error: `default` not followed by an item
--> $DIR/default-unmatched.rs:3:5
|
LL | default do
| ^^^^^^^ the unmatched `default`
| ^^^^^^^ the `default` qualifier
|
= note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
error: expected item, found reserved keyword `do`
--> $DIR/default-unmatched.rs:3:13

View file

@ -20,7 +20,7 @@ impl Foo for u16 {
impl Foo for u32 { //~ ERROR not all trait items implemented, missing: `foo`
default pub fn foo<T: Default>() -> T { T::default() }
//~^ ERROR unmatched `default`
//~^ ERROR `default` not followed by an item
//~| ERROR non-item in item list
}

View file

@ -1,8 +1,10 @@
error: unmatched `default`
error: `default` not followed by an item
--> $DIR/default.rs:22:5
|
LL | default pub fn foo<T: Default>() -> T { T::default() }
| ^^^^^^^ the unmatched `default`
| ^^^^^^^ the `default` qualifier
|
= note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
error: non-item in item list
--> $DIR/default.rs:22:13

View file

@ -2,6 +2,6 @@ fn main() {}
extern {
pub pub fn foo();
//~^ ERROR unmatched visibility `pub`
//~^ ERROR visibility `pub` not followed by an item
//~| ERROR non-item in item list
}

View file

@ -1,8 +1,8 @@
error: unmatched visibility `pub`
error: visibility `pub` not followed by an item
--> $DIR/duplicate-visibility.rs:4:5
|
LL | pub pub fn foo();
| ^^^ the unmatched visibility
| ^^^ the visibility
|
= help: you likely meant to define an item, e.g., `pub fn foo() {}`

View file

@ -7,4 +7,4 @@ impl ?Sized for Type {} //~ ERROR expected a trait, found type
impl ?Sized for .. {} //~ ERROR expected a trait, found type
default unsafe FAIL //~ ERROR expected item, found keyword `unsafe`
//~^ ERROR unmatched `default`
//~^ ERROR `default` not followed by an item

View file

@ -22,11 +22,13 @@ error: expected a trait, found type
LL | impl ?Sized for .. {}
| ^^^^^^
error: unmatched `default`
error: `default` not followed by an item
--> $DIR/impl-parsing.rs:9:1
|
LL | default unsafe FAIL
| ^^^^^^^ the unmatched `default`
| ^^^^^^^ the `default` qualifier
|
= note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
error: expected item, found keyword `unsafe`
--> $DIR/impl-parsing.rs:9:9

View file

@ -1,7 +1,7 @@
struct S;
impl S {
pub //~ ERROR unmatched visibility `pub`
pub //~ ERROR visibility `pub` not followed by an item
} //~ ERROR non-item in item list
fn main() {}

View file

@ -1,8 +1,8 @@
error: unmatched visibility `pub`
error: visibility `pub` not followed by an item
--> $DIR/issue-41155.rs:4:5
|
LL | pub
| ^^^ the unmatched visibility
| ^^^ the visibility
|
= help: you likely meant to define an item, e.g., `pub fn foo() {}`