diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-06-14 17:07:40 +0000 |
|---|---|---|
| committer | lrh2000 <lrh2000@pku.edu.cn> | 2021-06-26 23:11:14 +0800 |
| commit | c7f7c2efe02170850428e435b5a616f0bbc4ac37 (patch) | |
| tree | 567296572b20d4b6df5be3b2d0ea1b3db148742b | |
| parent | 0eeeebc990719b666a5cf4e3e488c79751596f87 (diff) | |
| download | rust-c7f7c2efe02170850428e435b5a616f0bbc4ac37.tar.gz rust-c7f7c2efe02170850428e435b5a616f0bbc4ac37.zip | |
Add quote!() example to reserved_prefix lint test.
3 files changed, 34 insertions, 1 deletions
diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.fixed b/src/test/ui/rust-2021/reserved-prefixes-migration.fixed index 88e7584c197..5537822e8fd 100644 --- a/src/test/ui/rust-2021/reserved-prefixes-migration.fixed +++ b/src/test/ui/rust-2021/reserved-prefixes-migration.fixed @@ -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 +} diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.rs b/src/test/ui/rust-2021/reserved-prefixes-migration.rs index ee835eb97a2..5fff0f234f8 100644 --- a/src/test/ui/rust-2021/reserved-prefixes-migration.rs +++ b/src/test/ui/rust-2021/reserved-prefixes-migration.rs @@ -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 +} diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr index 2c9d94803be..0c38dbd76c2 100644 --- a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr +++ b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr @@ -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 |
