add test to guard against inaccurate diagnostic
Also replaces an incomplete test
This commit is contained in:
parent
3a917cdfcb
commit
e3859d206c
10
tests/ui/macros/invalid-fragment-specifier.rs
Normal file
10
tests/ui/macros/invalid-fragment-specifier.rs
Normal file
@ -0,0 +1,10 @@
|
||||
macro_rules! test {
|
||||
($wrong:id) => {};
|
||||
} //~^ ERROR: invalid fragment specifier `id`
|
||||
|
||||
// guard against breaking raw identifier diagnostic
|
||||
macro_rules! test_raw_identifer {
|
||||
($wrong:r#if) => {};
|
||||
} //~^ ERROR: invalid fragment specifier `r#if`
|
||||
|
||||
fn main() {}
|
18
tests/ui/macros/invalid-fragment-specifier.stderr
Normal file
18
tests/ui/macros/invalid-fragment-specifier.stderr
Normal file
@ -0,0 +1,18 @@
|
||||
error: invalid fragment specifier `id`
|
||||
--> $DIR/invalid-fragment-specifier.rs:2:6
|
||||
|
|
||||
LL | ($wrong:id) => {};
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
|
||||
|
||||
error: invalid fragment specifier `r#if`
|
||||
--> $DIR/invalid-fragment-specifier.rs:7:6
|
||||
|
|
||||
LL | ($wrong:r#if) => {};
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -1,8 +0,0 @@
|
||||
macro_rules! foo(
|
||||
($x:foo) => ()
|
||||
//~^ ERROR invalid fragment specifier
|
||||
);
|
||||
|
||||
fn main() {
|
||||
foo!(foo);
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
error: invalid fragment specifier `foo`
|
||||
--> $DIR/macro-invalid-fragment-spec.rs:2:6
|
||||
|
|
||||
LL | ($x:foo) => ()
|
||||
| ^^^^^^
|
||||
|
|
||||
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
Loading…
Reference in New Issue
Block a user