unify/improve/simplify attribute parsing
This commit is contained in:
parent
be86b2d37b
commit
addbc5b9df
23 changed files with 140 additions and 173 deletions
|
|
@ -32,11 +32,11 @@ LL | X() {}
|
|||
LL | }
|
||||
| - the item list ends here
|
||||
|
||||
error: expected `[`, found `#`
|
||||
error: expected one of `!` or `[`, found `#`
|
||||
--> $DIR/issue-40006.rs:19:17
|
||||
|
|
||||
LL | fn xxx() { ### }
|
||||
| ^ expected `[`
|
||||
| ^ expected one of `!` or `[`
|
||||
|
||||
error: expected one of `!` or `::`, found `=`
|
||||
--> $DIR/issue-40006.rs:22:7
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
trait Foo {
|
||||
type Bar<,>;
|
||||
//~^ ERROR expected one of `>`, `const`, identifier, or lifetime, found `,`
|
||||
//~^ ERROR expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error: expected one of `>`, `const`, identifier, or lifetime, found `,`
|
||||
error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
|
||||
--> $DIR/empty_generics.rs:5:14
|
||||
|
|
||||
LL | trait Foo {
|
||||
| - while parsing this item list starting here
|
||||
LL | type Bar<,>;
|
||||
| ^ expected one of `>`, `const`, identifier, or lifetime
|
||||
| ^ expected one of `#`, `>`, `const`, identifier, or lifetime
|
||||
LL |
|
||||
LL | }
|
||||
| - the item list ends here
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ type Type_5_<'a> = Type_1_<'a, ()>;
|
|||
|
||||
|
||||
type Type_8<'a,,> = &'a ();
|
||||
//~^ error: expected one of `>`, `const`, identifier, or lifetime, found `,`
|
||||
//~^ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
|
||||
|
||||
|
||||
//type Type_9<T,,> = Box<T>; // error: expected identifier, found `,`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `>`, `const`, identifier, or lifetime, found `,`
|
||||
error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
|
||||
--> $DIR/issue-20616-8.rs:31:16
|
||||
|
|
||||
LL | type Type_8<'a,,> = &'a ();
|
||||
| ^ expected one of `>`, `const`, identifier, or lifetime
|
||||
| ^ expected one of `#`, `>`, `const`, identifier, or lifetime
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@ type Type_5_<'a> = Type_1_<'a, ()>;
|
|||
|
||||
|
||||
type Type_9<T,,> = Box<T>;
|
||||
//~^ error: expected one of `>`, `const`, identifier, or lifetime, found `,`
|
||||
//~^ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `>`, `const`, identifier, or lifetime, found `,`
|
||||
error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
|
||||
--> $DIR/issue-20616-9.rs:34:15
|
||||
|
|
||||
LL | type Type_9<T,,> = Box<T>;
|
||||
| ^ expected one of `>`, `const`, identifier, or lifetime
|
||||
| ^ expected one of `#`, `>`, `const`, identifier, or lifetime
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -6,6 +6,6 @@ type A = for<'a: 'b + 'c> fn(); // OK (rejected later by ast_validation)
|
|||
type A = for<'a: 'b,> fn(); // OK(rejected later by ast_validation)
|
||||
type A = for<'a: 'b +> fn(); // OK (rejected later by ast_validation)
|
||||
type A = for<'a, T> fn(); // OK (rejected later by ast_validation)
|
||||
type A = for<,> fn(); //~ ERROR expected one of `>`, `const`, identifier, or lifetime, found `,`
|
||||
type A = for<,> fn(); //~ ERROR expected one of `#`, `>`, `const`, identifier, or lifetime
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `>`, `const`, identifier, or lifetime, found `,`
|
||||
error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
|
||||
--> $DIR/bounds-lifetime.rs:9:14
|
||||
|
|
||||
LL | type A = for<,> fn();
|
||||
| ^ expected one of `>`, `const`, identifier, or lifetime
|
||||
| ^ expected one of `#`, `>`, `const`, identifier, or lifetime
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
# //~ ERROR expected `[`, found `<eof>`
|
||||
# //~ ERROR expected one of `!` or `[`, found `<eof>`
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected `[`, found `<eof>`
|
||||
error: expected one of `!` or `[`, found `<eof>`
|
||||
--> $DIR/column-offset-1-based.rs:1:1
|
||||
|
|
||||
LL | #
|
||||
| ^ expected `[`
|
||||
| ^ expected one of `!` or `[`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
fn main() {
|
||||
if true /*!*/ {}
|
||||
//~^ ERROR expected `{`, found doc comment `/*!*/`
|
||||
//~| ERROR expected outer doc comment
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,19 @@
|
|||
error: expected outer doc comment
|
||||
--> $DIR/doc-comment-in-if-statement.rs:2:13
|
||||
|
|
||||
LL | if true /*!*/ {}
|
||||
| ^^^^^
|
||||
|
|
||||
= note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
|
||||
|
||||
error: expected `{`, found doc comment `/*!*/`
|
||||
--> $DIR/doc-comment-in-if-statement.rs:2:13
|
||||
|
|
||||
LL | if true /*!*/ {}
|
||||
| -- ^^^^^ expected `{`
|
||||
| |
|
||||
| -- ^^^^^ -- help: try placing this code inside a block: `{ {} }`
|
||||
| | |
|
||||
| | expected `{`
|
||||
| this `if` expression has a condition, but no block
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// error-pattern:expected `[`, found `vec`
|
||||
mod blade_runner {
|
||||
#vec[doc(
|
||||
#vec[doc( //~ ERROR expected one of `!` or `[`, found `vec`
|
||||
brief = "Blade Runner is probably the best movie ever",
|
||||
desc = "I like that in the world of Blade Runner it is always
|
||||
raining, and that it's always night time. And Aliens
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected `[`, found `vec`
|
||||
--> $DIR/issue-1655.rs:3:6
|
||||
error: expected one of `!` or `[`, found `vec`
|
||||
--> $DIR/issue-1655.rs:2:6
|
||||
|
|
||||
LL | #vec[doc(
|
||||
| ^^^ expected `[`
|
||||
| ^^^ expected one of `!` or `[`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
// error-pattern: aborting due to 7 previous errors
|
||||
// error-pattern: aborting due to 5 previous errors
|
||||
|
||||
fn i(n{...,f #
|
||||
|
|
|
|||
|
|
@ -31,23 +31,11 @@ LL | fn i(n{...,f #
|
|||
| | expected `}`
|
||||
| `..` must be at the end and cannot have a trailing comma
|
||||
|
||||
error: expected `[`, found `}`
|
||||
error: expected one of `!` or `[`, found `}`
|
||||
--> $DIR/issue-63135.rs:3:16
|
||||
|
|
||||
LL | fn i(n{...,f #
|
||||
| ^ expected `[`
|
||||
| ^ expected one of `!` or `[`
|
||||
|
||||
error: expected one of `:` or `|`, found `)`
|
||||
--> $DIR/issue-63135.rs:3:16
|
||||
|
|
||||
LL | fn i(n{...,f #
|
||||
| ^ expected one of `:` or `|`
|
||||
|
||||
error: expected `;` or `{`, found `<eof>`
|
||||
--> $DIR/issue-63135.rs:3:16
|
||||
|
|
||||
LL | fn i(n{...,f #
|
||||
| ^ expected `;` or `{`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue