Skip to content

Commit

Permalink
Add quote!() example to reserved_prefix lint test.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se authored and lrh2000 committed Jun 26, 2021
1 parent 0eeeebc commit c7f7c2e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/test/ui/rust-2021/reserved-prefixes-migration.fixed
Expand Up @@ -26,3 +26,13 @@ fn main() {
//~^ WARNING prefix `hey` is unknown [reserved_prefix]
//~| WARNING become a hard error
}

macro_rules! quote {
(# name = # kind # value) => {};
}

quote! {
#name = #kind #value
//~^ WARNING prefix `kind` is unknown [reserved_prefix]
//~| WARNING become a hard error
}
10 changes: 10 additions & 0 deletions src/test/ui/rust-2021/reserved-prefixes-migration.rs
Expand Up @@ -26,3 +26,13 @@ fn main() {
//~^ WARNING prefix `hey` is unknown [reserved_prefix]
//~| WARNING become a hard error
}

macro_rules! quote {
(# name = # kind # value) => {};
}

quote! {
#name = #kind#value
//~^ WARNING prefix `kind` is unknown [reserved_prefix]
//~| WARNING become a hard error
}
15 changes: 14 additions & 1 deletion src/test/ui/rust-2021/reserved-prefixes-migration.stderr
Expand Up @@ -55,5 +55,18 @@ help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021
LL | m3!(hey #hey);
| --

warning: 4 warnings emitted
warning: prefix `kind` is unknown
--> $DIR/reserved-prefixes-migration.rs:35:14
|
LL | #name = #kind#value
| ^^^^ unknown prefix
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= note: for more information, see issue #84978 <https://github.com/rust-lang/rust/issues/84978>
help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021
|
LL | #name = #kind #value
| --

warning: 5 warnings emitted

0 comments on commit c7f7c2e

Please sign in to comment.