nix panictry! in ParserAnyMacro::make
This commit is contained in:
parent
0f2d9686cc
commit
0a8db690a4
10 changed files with 153 additions and 48 deletions
|
|
@ -1,9 +1,15 @@
|
|||
// edition:2018
|
||||
// aux-build:edition-kw-macro-2015.rs
|
||||
|
||||
fn main() {}
|
||||
|
||||
#[macro_use]
|
||||
extern crate edition_kw_macro_2015;
|
||||
|
||||
mod module {
|
||||
pub fn r#async() {}
|
||||
}
|
||||
|
||||
pub fn check_async() {
|
||||
let mut async = 1; //~ ERROR expected identifier, found keyword `async`
|
||||
let mut r#async = 1; // OK
|
||||
|
|
@ -13,7 +19,7 @@ pub fn check_async() {
|
|||
r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
|
||||
r#async = consumes_async_raw!(r#async); // OK
|
||||
|
||||
if passes_ident!(async) == 1 {}
|
||||
if passes_ident!(async) == 1 {} //~ ERROR async closures are unstable
|
||||
if passes_ident!(r#async) == 1 {} // OK
|
||||
module::async(); //~ ERROR expected identifier, found keyword `async`
|
||||
module::r#async(); // OK
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: expected identifier, found keyword `async`
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:8:13
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:14:13
|
||||
|
|
||||
LL | let mut async = 1;
|
||||
| ^^^^^ expected identifier, found keyword
|
||||
|
|
@ -10,7 +10,7 @@ LL | let mut r#async = 1;
|
|||
| ^^^^^^^
|
||||
|
||||
error: expected identifier, found keyword `async`
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:18:13
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:24:13
|
||||
|
|
||||
LL | module::async();
|
||||
| ^^^^^ expected identifier, found keyword
|
||||
|
|
@ -21,13 +21,13 @@ LL | module::r#async();
|
|||
| ^^^^^^^
|
||||
|
||||
error: no rules expected the token `r#async`
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:12:31
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:18:31
|
||||
|
|
||||
LL | r#async = consumes_async!(r#async);
|
||||
| ^^^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `async`
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:13:35
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:19:35
|
||||
|
|
||||
LL | r#async = consumes_async_raw!(async);
|
||||
| ^^^^^ no rules expected this token in macro call
|
||||
|
|
@ -38,10 +38,20 @@ error: macro expansion ends with an incomplete expression: expected one of `move
|
|||
LL | ($i: ident) => ($i)
|
||||
| ^ expected one of `move`, `|`, or `||`
|
||||
|
|
||||
::: $DIR/edition-keywords-2018-2015-parsing.rs:16:8
|
||||
::: $DIR/edition-keywords-2018-2015-parsing.rs:22:8
|
||||
|
|
||||
LL | if passes_ident!(async) == 1 {}
|
||||
| -------------------- in this macro invocation
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error[E0658]: async closures are unstable
|
||||
--> $DIR/edition-keywords-2018-2015-parsing.rs:22:22
|
||||
|
|
||||
LL | if passes_ident!(async) == 1 {}
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
|
||||
= help: add `#![feature(async_closure)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
// edition:2018
|
||||
// aux-build:edition-kw-macro-2018.rs
|
||||
|
||||
fn main() {}
|
||||
|
||||
#[macro_use]
|
||||
extern crate edition_kw_macro_2018;
|
||||
|
||||
mod module {
|
||||
pub fn r#async() {}
|
||||
}
|
||||
|
||||
pub fn check_async() {
|
||||
let mut async = 1; //~ ERROR expected identifier, found keyword `async`
|
||||
let mut r#async = 1; // OK
|
||||
|
|
@ -13,7 +19,7 @@ pub fn check_async() {
|
|||
r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
|
||||
r#async = consumes_async_raw!(r#async); // OK
|
||||
|
||||
if passes_ident!(async) == 1 {}
|
||||
if passes_ident!(async) == 1 {} //~ ERROR async closures are unstable
|
||||
if passes_ident!(r#async) == 1 {} // OK
|
||||
module::async(); //~ ERROR expected identifier, found keyword `async`
|
||||
module::r#async(); // OK
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: expected identifier, found keyword `async`
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:8:13
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:14:13
|
||||
|
|
||||
LL | let mut async = 1;
|
||||
| ^^^^^ expected identifier, found keyword
|
||||
|
|
@ -10,7 +10,7 @@ LL | let mut r#async = 1;
|
|||
| ^^^^^^^
|
||||
|
||||
error: expected identifier, found keyword `async`
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:18:13
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:24:13
|
||||
|
|
||||
LL | module::async();
|
||||
| ^^^^^ expected identifier, found keyword
|
||||
|
|
@ -21,13 +21,13 @@ LL | module::r#async();
|
|||
| ^^^^^^^
|
||||
|
||||
error: no rules expected the token `r#async`
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:12:31
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:18:31
|
||||
|
|
||||
LL | r#async = consumes_async!(r#async);
|
||||
| ^^^^^^^ no rules expected this token in macro call
|
||||
|
||||
error: no rules expected the token `async`
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:13:35
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:19:35
|
||||
|
|
||||
LL | r#async = consumes_async_raw!(async);
|
||||
| ^^^^^ no rules expected this token in macro call
|
||||
|
|
@ -38,10 +38,20 @@ error: macro expansion ends with an incomplete expression: expected one of `move
|
|||
LL | ($i: ident) => ($i)
|
||||
| ^ expected one of `move`, `|`, or `||`
|
||||
|
|
||||
::: $DIR/edition-keywords-2018-2018-parsing.rs:16:8
|
||||
::: $DIR/edition-keywords-2018-2018-parsing.rs:22:8
|
||||
|
|
||||
LL | if passes_ident!(async) == 1 {}
|
||||
| -------------------- in this macro invocation
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error[E0658]: async closures are unstable
|
||||
--> $DIR/edition-keywords-2018-2018-parsing.rs:22:22
|
||||
|
|
||||
LL | if passes_ident!(async) == 1 {}
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
|
||||
= help: add `#![feature(async_closure)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ macro_rules! m {
|
|||
//~| ERROR macro expansion ignores token `typeof`
|
||||
//~| ERROR macro expansion ignores token `;`
|
||||
//~| ERROR macro expansion ignores token `;`
|
||||
//~| ERROR cannot find type `i` in this scope
|
||||
//~| ERROR cannot find value `i` in this scope
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -42,5 +42,29 @@ LL | m!();
|
|||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0412]: cannot find type `i` in this scope
|
||||
--> $DIR/macro-context.rs:3:13
|
||||
|
|
||||
LL | () => ( i ; typeof );
|
||||
| ^ help: a builtin type with a similar name exists: `i8`
|
||||
...
|
||||
LL | let a: m!();
|
||||
| ---- in this macro invocation
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0425]: cannot find value `i` in this scope
|
||||
--> $DIR/macro-context.rs:3:13
|
||||
|
|
||||
LL | () => ( i ; typeof );
|
||||
| ^ help: a local variable with a similar name exists: `a`
|
||||
...
|
||||
LL | let i = m!();
|
||||
| ---- in this macro invocation
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0412, E0425.
|
||||
For more information about an error, try `rustc --explain E0412`.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
fn main() {
|
||||
let _ = Option:Some(vec![0, 1]); //~ ERROR expected type, found
|
||||
//~^ ERROR expected value, found enum `Option`
|
||||
//~| ERROR expected type, found variant `Some`
|
||||
}
|
||||
|
||||
// This case isn't currently being handled gracefully due to the macro invocation.
|
||||
|
|
|
|||
|
|
@ -13,5 +13,35 @@ LL | let _ = Option:Some(vec![0, 1]);
|
|||
= note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0423]: expected value, found enum `Option`
|
||||
--> $DIR/issue-47666.rs:2:13
|
||||
|
|
||||
LL | let _ = Option:Some(vec![0, 1]);
|
||||
| ^^^^^^
|
||||
|
|
||||
help: try using one of the enum's variants
|
||||
|
|
||||
LL | let _ = std::option::Option::None:Some(vec![0, 1]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | let _ = std::option::Option::Some:Some(vec![0, 1]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0573]: expected type, found variant `Some`
|
||||
--> $DIR/issue-47666.rs:2:20
|
||||
|
|
||||
LL | let _ = Option:Some(vec![0, 1]);
|
||||
| ^^^^^^^^^^^^^^^^ not a type
|
||||
|
|
||||
help: try using the variant's enum
|
||||
|
|
||||
LL | let _ = Option:std::option::Option;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
help: maybe you meant to write a path separator here
|
||||
|
|
||||
LL | let _ = Option::Some(vec![0, 1]);
|
||||
| ^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0423, E0573.
|
||||
For more information about an error, try `rustc --explain E0423`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue