Rollup merge of #153482 - DanielEScherzer:test-references-macros, r=ehuss

tests/ui/macros: add annotations for reference rules
This commit is contained in:
Trevor Gross
2026-04-23 20:32:48 -04:00
committed by GitHub
46 changed files with 184 additions and 149 deletions
+1
View File
@@ -1,5 +1,6 @@
//@ check-pass
//@ edition: 2015
//@ reference: macro.decl.meta.edition2024
// Ensures expr_2021 fragment specifier is accepted in old editions
@@ -1,5 +1,5 @@
error: no rules expected keyword `const`
--> $DIR/expr_2021_inline_const.rs:23:12
--> $DIR/expr_2021_inline_const.rs:24:12
|
LL | macro_rules! m2021 {
| ------------------ when calling this macro
@@ -8,13 +8,13 @@ LL | m2021!(const { 1 });
| ^^^^^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr_2021`
--> $DIR/expr_2021_inline_const.rs:7:6
--> $DIR/expr_2021_inline_const.rs:8:6
|
LL | ($e:expr_2021) => {
| ^^^^^^^^^^^^
error: no rules expected keyword `const`
--> $DIR/expr_2021_inline_const.rs:24:12
--> $DIR/expr_2021_inline_const.rs:25:12
|
LL | macro_rules! m2024 {
| ------------------ when calling this macro
@@ -23,7 +23,7 @@ LL | m2024!(const { 1 });
| ^^^^^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr`
--> $DIR/expr_2021_inline_const.rs:13:6
--> $DIR/expr_2021_inline_const.rs:14:6
|
LL | ($e:expr) => {
| ^^^^^^^
@@ -1,5 +1,5 @@
error: no rules expected keyword `const`
--> $DIR/expr_2021_inline_const.rs:23:12
--> $DIR/expr_2021_inline_const.rs:24:12
|
LL | macro_rules! m2021 {
| ------------------ when calling this macro
@@ -8,7 +8,7 @@ LL | m2021!(const { 1 });
| ^^^^^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr_2021`
--> $DIR/expr_2021_inline_const.rs:7:6
--> $DIR/expr_2021_inline_const.rs:8:6
|
LL | ($e:expr_2021) => {
| ^^^^^^^^^^^^
@@ -1,6 +1,7 @@
//@ revisions: edi2021 edi2024
//@[edi2024] edition: 2024
//@[edi2021] edition: 2021
//@ reference: macro.decl.meta.edition2024
// This test ensures that the inline const match only on edition 2024
macro_rules! m2021 {
@@ -1,5 +1,5 @@
error: no rules expected reserved identifier `_`
--> $DIR/expr_2024_underscore_expr.rs:19:12
--> $DIR/expr_2024_underscore_expr.rs:20:12
|
LL | macro_rules! m2021 {
| ------------------ when calling this macro
@@ -8,13 +8,13 @@ LL | m2021!(_);
| ^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr_2021`
--> $DIR/expr_2024_underscore_expr.rs:7:6
--> $DIR/expr_2024_underscore_expr.rs:8:6
|
LL | ($e:expr_2021) => {
| ^^^^^^^^^^^^
error: no rules expected reserved identifier `_`
--> $DIR/expr_2024_underscore_expr.rs:20:12
--> $DIR/expr_2024_underscore_expr.rs:21:12
|
LL | macro_rules! m2024 {
| ------------------ when calling this macro
@@ -23,7 +23,7 @@ LL | m2024!(_);
| ^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr`
--> $DIR/expr_2024_underscore_expr.rs:13:6
--> $DIR/expr_2024_underscore_expr.rs:14:6
|
LL | ($e:expr) => {
| ^^^^^^^
@@ -1,5 +1,5 @@
error: no rules expected reserved identifier `_`
--> $DIR/expr_2024_underscore_expr.rs:19:12
--> $DIR/expr_2024_underscore_expr.rs:20:12
|
LL | macro_rules! m2021 {
| ------------------ when calling this macro
@@ -8,7 +8,7 @@ LL | m2021!(_);
| ^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr_2021`
--> $DIR/expr_2024_underscore_expr.rs:7:6
--> $DIR/expr_2024_underscore_expr.rs:8:6
|
LL | ($e:expr_2021) => {
| ^^^^^^^^^^^^
@@ -1,6 +1,7 @@
//@ revisions: edi2021 edi2024
//@[edi2024] edition: 2024
//@[edi2021] edition: 2021
//@ reference: macro.decl.meta.edition2024
// This test ensures that the `_` tok is considered an
// expression on edition 2024.
macro_rules! m2021 {
@@ -1,3 +1,4 @@
//@ reference: macro.decl.transcription.lookahead
fn main() {}
macro_rules! ambiguity {
@@ -1,14 +1,14 @@
error: local ambiguity when calling macro `ambiguity`: multiple parsing options: built-in NTs ident ('i') or ident ('j').
--> $DIR/local-ambiguity-multiple-parsing-options.rs:7:12
|
LL | ambiguity!(error);
| ^^^^^
error: local ambiguity when calling macro `ambiguity`: multiple parsing options: built-in NTs ident ('i') or ident ('j').
--> $DIR/local-ambiguity-multiple-parsing-options.rs:8:12
|
LL | ambiguity!(error);
| ^^^^^
error: local ambiguity when calling macro `ambiguity`: multiple parsing options: built-in NTs ident ('i') or ident ('j').
--> $DIR/local-ambiguity-multiple-parsing-options.rs:9:12
|
LL | ambiguity!(error);
| ^^^^^
error: aborting due to 2 previous errors
+1
View File
@@ -1,3 +1,4 @@
//@ reference: macro.decl.syntax
macro_rules! foo {
($a:expr) => a; //~ ERROR macro rhs must be delimited
}
+2 -2
View File
@@ -1,11 +1,11 @@
error: macro rhs must be delimited
--> $DIR/macro-error.rs:2:18
--> $DIR/macro-error.rs:3:18
|
LL | ($a:expr) => a;
| ^
error: non-type macro in type position: cfg
--> $DIR/macro-error.rs:8:12
--> $DIR/macro-error.rs:9:12
|
LL | let _: cfg!(FALSE) = ();
| ^^^^^^^^^^^
+5
View File
@@ -1,5 +1,10 @@
//@ edition:2015..2021
//@ check-pass
//@ reference: macro.decl.follow-set.token-expr-stmt
//@ reference: macro.decl.follow-set.token-pat
//@ reference: macro.decl.follow-set.edition2021
//@ reference: macro.decl.follow-set.token-path-ty
//@ reference: macro.decl.follow-set.token-other
#![allow(unused_macros)]
// Check the macro follow sets (see corresponding cfail test).
+3 -1
View File
@@ -1,5 +1,7 @@
//@ edition:2015..2021
//
//@ reference: macro.decl.follow-set.token-expr-stmt
//@ reference: macro.decl.follow-set.token-pat
//@ reference: macro.decl.follow-set.token-path-ty
// Check the macro follow sets (see corresponding rpass test).
#![feature(macro_guard_matcher)]
+89 -89
View File
@@ -1,5 +1,5 @@
error: `$p:pat` is followed by `(`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:10:13
--> $DIR/macro-follow.rs:12:13
|
LL | ($p:pat ()) => {};
| ^ not allowed after `pat` fragments
@@ -7,7 +7,7 @@ LL | ($p:pat ()) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `[`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:11:13
--> $DIR/macro-follow.rs:13:13
|
LL | ($p:pat []) => {};
| ^ not allowed after `pat` fragments
@@ -15,7 +15,7 @@ LL | ($p:pat []) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `{`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:12:13
--> $DIR/macro-follow.rs:14:13
|
LL | ($p:pat {}) => {};
| ^ not allowed after `pat` fragments
@@ -23,7 +23,7 @@ LL | ($p:pat {}) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `:`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:13:13
--> $DIR/macro-follow.rs:15:13
|
LL | ($p:pat :) => {};
| ^ not allowed after `pat` fragments
@@ -31,7 +31,7 @@ LL | ($p:pat :) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `>`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:14:13
--> $DIR/macro-follow.rs:16:13
|
LL | ($p:pat >) => {};
| ^ not allowed after `pat` fragments
@@ -39,7 +39,7 @@ LL | ($p:pat >) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `+`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:15:13
--> $DIR/macro-follow.rs:17:13
|
LL | ($p:pat +) => {};
| ^ not allowed after `pat` fragments
@@ -47,7 +47,7 @@ LL | ($p:pat +) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `ident`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:16:13
--> $DIR/macro-follow.rs:18:13
|
LL | ($p:pat ident) => {};
| ^^^^^ not allowed after `pat` fragments
@@ -55,7 +55,7 @@ LL | ($p:pat ident) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$q:pat`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:17:13
--> $DIR/macro-follow.rs:19:13
|
LL | ($p:pat $q:pat) => {};
| ^^^^^^ not allowed after `pat` fragments
@@ -63,7 +63,7 @@ LL | ($p:pat $q:pat) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$e:expr`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:18:13
--> $DIR/macro-follow.rs:20:13
|
LL | ($p:pat $e:expr) => {};
| ^^^^^^^ not allowed after `pat` fragments
@@ -71,7 +71,7 @@ LL | ($p:pat $e:expr) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$t:ty`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:19:13
--> $DIR/macro-follow.rs:21:13
|
LL | ($p:pat $t:ty) => {};
| ^^^^^ not allowed after `pat` fragments
@@ -79,7 +79,7 @@ LL | ($p:pat $t:ty) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$s:stmt`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:20:13
--> $DIR/macro-follow.rs:22:13
|
LL | ($p:pat $s:stmt) => {};
| ^^^^^^^ not allowed after `pat` fragments
@@ -87,7 +87,7 @@ LL | ($p:pat $s:stmt) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$q:path`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:21:13
--> $DIR/macro-follow.rs:23:13
|
LL | ($p:pat $q:path) => {};
| ^^^^^^^ not allowed after `pat` fragments
@@ -95,7 +95,7 @@ LL | ($p:pat $q:path) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$b:block`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:22:13
--> $DIR/macro-follow.rs:24:13
|
LL | ($p:pat $b:block) => {};
| ^^^^^^^^ not allowed after `pat` fragments
@@ -103,7 +103,7 @@ LL | ($p:pat $b:block) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$i:ident`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:23:13
--> $DIR/macro-follow.rs:25:13
|
LL | ($p:pat $i:ident) => {};
| ^^^^^^^^ not allowed after `pat` fragments
@@ -111,7 +111,7 @@ LL | ($p:pat $i:ident) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$t:tt`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:24:13
--> $DIR/macro-follow.rs:26:13
|
LL | ($p:pat $t:tt) => {};
| ^^^^^ not allowed after `pat` fragments
@@ -119,7 +119,7 @@ LL | ($p:pat $t:tt) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$i:item`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:25:13
--> $DIR/macro-follow.rs:27:13
|
LL | ($p:pat $i:item) => {};
| ^^^^^^^ not allowed after `pat` fragments
@@ -127,7 +127,7 @@ LL | ($p:pat $i:item) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$p:pat` is followed by `$m:meta`, which is not allowed for `pat` fragments
--> $DIR/macro-follow.rs:26:13
--> $DIR/macro-follow.rs:28:13
|
LL | ($p:pat $m:meta) => {};
| ^^^^^^^ not allowed after `pat` fragments
@@ -135,7 +135,7 @@ LL | ($p:pat $m:meta) => {};
= note: allowed there are: `=>`, `,`, `=`, `|`, `if`, `if let` or `in`
error: `$e:expr` is followed by `(`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:30:14
--> $DIR/macro-follow.rs:32:14
|
LL | ($e:expr ()) => {};
| ^ not allowed after `expr` fragments
@@ -143,7 +143,7 @@ LL | ($e:expr ()) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `[`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:31:14
--> $DIR/macro-follow.rs:33:14
|
LL | ($e:expr []) => {};
| ^ not allowed after `expr` fragments
@@ -151,7 +151,7 @@ LL | ($e:expr []) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `{`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:32:14
--> $DIR/macro-follow.rs:34:14
|
LL | ($e:expr {}) => {};
| ^ not allowed after `expr` fragments
@@ -159,7 +159,7 @@ LL | ($e:expr {}) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `=`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:33:14
--> $DIR/macro-follow.rs:35:14
|
LL | ($e:expr =) => {};
| ^ not allowed after `expr` fragments
@@ -167,7 +167,7 @@ LL | ($e:expr =) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `|`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:34:14
--> $DIR/macro-follow.rs:36:14
|
LL | ($e:expr |) => {};
| ^ not allowed after `expr` fragments
@@ -175,7 +175,7 @@ LL | ($e:expr |) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `:`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:35:14
--> $DIR/macro-follow.rs:37:14
|
LL | ($e:expr :) => {};
| ^ not allowed after `expr` fragments
@@ -183,7 +183,7 @@ LL | ($e:expr :) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `>`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:36:14
--> $DIR/macro-follow.rs:38:14
|
LL | ($e:expr >) => {};
| ^ not allowed after `expr` fragments
@@ -191,7 +191,7 @@ LL | ($e:expr >) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:37:14
--> $DIR/macro-follow.rs:39:14
|
LL | ($e:expr +) => {};
| ^ not allowed after `expr` fragments
@@ -199,7 +199,7 @@ LL | ($e:expr +) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `ident`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:38:14
--> $DIR/macro-follow.rs:40:14
|
LL | ($e:expr ident) => {};
| ^^^^^ not allowed after `expr` fragments
@@ -207,7 +207,7 @@ LL | ($e:expr ident) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `if`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:39:14
--> $DIR/macro-follow.rs:41:14
|
LL | ($e:expr if) => {};
| ^^ not allowed after `expr` fragments
@@ -215,7 +215,7 @@ LL | ($e:expr if) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `in`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:40:14
--> $DIR/macro-follow.rs:42:14
|
LL | ($e:expr in) => {};
| ^^ not allowed after `expr` fragments
@@ -223,7 +223,7 @@ LL | ($e:expr in) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$p:pat`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:41:14
--> $DIR/macro-follow.rs:43:14
|
LL | ($e:expr $p:pat) => {};
| ^^^^^^ not allowed after `expr` fragments
@@ -231,7 +231,7 @@ LL | ($e:expr $p:pat) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$f:expr`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:42:14
--> $DIR/macro-follow.rs:44:14
|
LL | ($e:expr $f:expr) => {};
| ^^^^^^^ not allowed after `expr` fragments
@@ -239,7 +239,7 @@ LL | ($e:expr $f:expr) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$t:ty`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:43:14
--> $DIR/macro-follow.rs:45:14
|
LL | ($e:expr $t:ty) => {};
| ^^^^^ not allowed after `expr` fragments
@@ -247,7 +247,7 @@ LL | ($e:expr $t:ty) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$s:stmt`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:44:14
--> $DIR/macro-follow.rs:46:14
|
LL | ($e:expr $s:stmt) => {};
| ^^^^^^^ not allowed after `expr` fragments
@@ -255,7 +255,7 @@ LL | ($e:expr $s:stmt) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$p:path`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:45:14
--> $DIR/macro-follow.rs:47:14
|
LL | ($e:expr $p:path) => {};
| ^^^^^^^ not allowed after `expr` fragments
@@ -263,7 +263,7 @@ LL | ($e:expr $p:path) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$b:block`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:46:14
--> $DIR/macro-follow.rs:48:14
|
LL | ($e:expr $b:block) => {};
| ^^^^^^^^ not allowed after `expr` fragments
@@ -271,7 +271,7 @@ LL | ($e:expr $b:block) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$i:ident`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:47:14
--> $DIR/macro-follow.rs:49:14
|
LL | ($e:expr $i:ident) => {};
| ^^^^^^^^ not allowed after `expr` fragments
@@ -279,7 +279,7 @@ LL | ($e:expr $i:ident) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$t:tt`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:48:14
--> $DIR/macro-follow.rs:50:14
|
LL | ($e:expr $t:tt) => {};
| ^^^^^ not allowed after `expr` fragments
@@ -287,7 +287,7 @@ LL | ($e:expr $t:tt) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$i:item`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:49:14
--> $DIR/macro-follow.rs:51:14
|
LL | ($e:expr $i:item) => {};
| ^^^^^^^ not allowed after `expr` fragments
@@ -295,7 +295,7 @@ LL | ($e:expr $i:item) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$m:meta`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:50:14
--> $DIR/macro-follow.rs:52:14
|
LL | ($e:expr $m:meta) => {};
| ^^^^^^^ not allowed after `expr` fragments
@@ -303,7 +303,7 @@ LL | ($e:expr $m:meta) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `$g:guard`, which is not allowed for `expr` fragments
--> $DIR/macro-follow.rs:51:14
--> $DIR/macro-follow.rs:53:14
|
LL | ($e:expr $g:guard) => {};
| ^^^^^^^^ not allowed after `expr` fragments
@@ -311,7 +311,7 @@ LL | ($e:expr $g:guard) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$t:ty` is followed by `(`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:56:12
--> $DIR/macro-follow.rs:58:12
|
LL | ($t:ty ()) => {};
| ^ not allowed after `ty` fragments
@@ -319,7 +319,7 @@ LL | ($t:ty ()) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `+`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:58:12
--> $DIR/macro-follow.rs:60:12
|
LL | ($t:ty +) => {};
| ^ not allowed after `ty` fragments
@@ -327,7 +327,7 @@ LL | ($t:ty +) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `ident`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:59:12
--> $DIR/macro-follow.rs:61:12
|
LL | ($t:ty ident) => {};
| ^^^^^ not allowed after `ty` fragments
@@ -335,7 +335,7 @@ LL | ($t:ty ident) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `if`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:60:12
--> $DIR/macro-follow.rs:62:12
|
LL | ($t:ty if) => {};
| ^^ not allowed after `ty` fragments
@@ -343,7 +343,7 @@ LL | ($t:ty if) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$p:pat`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:61:12
--> $DIR/macro-follow.rs:63:12
|
LL | ($t:ty $p:pat) => {};
| ^^^^^^ not allowed after `ty` fragments
@@ -351,7 +351,7 @@ LL | ($t:ty $p:pat) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$e:expr`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:62:12
--> $DIR/macro-follow.rs:64:12
|
LL | ($t:ty $e:expr) => {};
| ^^^^^^^ not allowed after `ty` fragments
@@ -359,7 +359,7 @@ LL | ($t:ty $e:expr) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$r:ty`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:63:12
--> $DIR/macro-follow.rs:65:12
|
LL | ($t:ty $r:ty) => {};
| ^^^^^ not allowed after `ty` fragments
@@ -367,7 +367,7 @@ LL | ($t:ty $r:ty) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$s:stmt`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:64:12
--> $DIR/macro-follow.rs:66:12
|
LL | ($t:ty $s:stmt) => {};
| ^^^^^^^ not allowed after `ty` fragments
@@ -375,7 +375,7 @@ LL | ($t:ty $s:stmt) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$p:path`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:65:12
--> $DIR/macro-follow.rs:67:12
|
LL | ($t:ty $p:path) => {};
| ^^^^^^^ not allowed after `ty` fragments
@@ -383,7 +383,7 @@ LL | ($t:ty $p:path) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$i:ident`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:67:12
--> $DIR/macro-follow.rs:69:12
|
LL | ($t:ty $i:ident) => {};
| ^^^^^^^^ not allowed after `ty` fragments
@@ -391,7 +391,7 @@ LL | ($t:ty $i:ident) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$r:tt`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:68:12
--> $DIR/macro-follow.rs:70:12
|
LL | ($t:ty $r:tt) => {};
| ^^^^^ not allowed after `ty` fragments
@@ -399,7 +399,7 @@ LL | ($t:ty $r:tt) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$i:item`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:69:12
--> $DIR/macro-follow.rs:71:12
|
LL | ($t:ty $i:item) => {};
| ^^^^^^^ not allowed after `ty` fragments
@@ -407,7 +407,7 @@ LL | ($t:ty $i:item) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$m:meta`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:70:12
--> $DIR/macro-follow.rs:72:12
|
LL | ($t:ty $m:meta) => {};
| ^^^^^^^ not allowed after `ty` fragments
@@ -415,7 +415,7 @@ LL | ($t:ty $m:meta) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$t:ty` is followed by `$g:guard`, which is not allowed for `ty` fragments
--> $DIR/macro-follow.rs:71:12
--> $DIR/macro-follow.rs:73:12
|
LL | ($t:ty $g:guard) => {};
| ^^^^^^^^ not allowed after `ty` fragments
@@ -423,7 +423,7 @@ LL | ($t:ty $g:guard) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$s:stmt` is followed by `(`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:75:14
--> $DIR/macro-follow.rs:77:14
|
LL | ($s:stmt ()) => {};
| ^ not allowed after `stmt` fragments
@@ -431,7 +431,7 @@ LL | ($s:stmt ()) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `[`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:76:14
--> $DIR/macro-follow.rs:78:14
|
LL | ($s:stmt []) => {};
| ^ not allowed after `stmt` fragments
@@ -439,7 +439,7 @@ LL | ($s:stmt []) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `{`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:77:14
--> $DIR/macro-follow.rs:79:14
|
LL | ($s:stmt {}) => {};
| ^ not allowed after `stmt` fragments
@@ -447,7 +447,7 @@ LL | ($s:stmt {}) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `=`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:78:14
--> $DIR/macro-follow.rs:80:14
|
LL | ($s:stmt =) => {};
| ^ not allowed after `stmt` fragments
@@ -455,7 +455,7 @@ LL | ($s:stmt =) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `|`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:79:14
--> $DIR/macro-follow.rs:81:14
|
LL | ($s:stmt |) => {};
| ^ not allowed after `stmt` fragments
@@ -463,7 +463,7 @@ LL | ($s:stmt |) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `:`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:80:14
--> $DIR/macro-follow.rs:82:14
|
LL | ($s:stmt :) => {};
| ^ not allowed after `stmt` fragments
@@ -471,7 +471,7 @@ LL | ($s:stmt :) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `>`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:81:14
--> $DIR/macro-follow.rs:83:14
|
LL | ($s:stmt >) => {};
| ^ not allowed after `stmt` fragments
@@ -479,7 +479,7 @@ LL | ($s:stmt >) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `+`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:82:14
--> $DIR/macro-follow.rs:84:14
|
LL | ($s:stmt +) => {};
| ^ not allowed after `stmt` fragments
@@ -487,7 +487,7 @@ LL | ($s:stmt +) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `ident`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:83:14
--> $DIR/macro-follow.rs:85:14
|
LL | ($s:stmt ident) => {};
| ^^^^^ not allowed after `stmt` fragments
@@ -495,7 +495,7 @@ LL | ($s:stmt ident) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `if`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:84:14
--> $DIR/macro-follow.rs:86:14
|
LL | ($s:stmt if) => {};
| ^^ not allowed after `stmt` fragments
@@ -503,7 +503,7 @@ LL | ($s:stmt if) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `in`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:85:14
--> $DIR/macro-follow.rs:87:14
|
LL | ($s:stmt in) => {};
| ^^ not allowed after `stmt` fragments
@@ -511,7 +511,7 @@ LL | ($s:stmt in) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$p:pat`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:86:14
--> $DIR/macro-follow.rs:88:14
|
LL | ($s:stmt $p:pat) => {};
| ^^^^^^ not allowed after `stmt` fragments
@@ -519,7 +519,7 @@ LL | ($s:stmt $p:pat) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$e:expr`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:87:14
--> $DIR/macro-follow.rs:89:14
|
LL | ($s:stmt $e:expr) => {};
| ^^^^^^^ not allowed after `stmt` fragments
@@ -527,7 +527,7 @@ LL | ($s:stmt $e:expr) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$t:ty`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:88:14
--> $DIR/macro-follow.rs:90:14
|
LL | ($s:stmt $t:ty) => {};
| ^^^^^ not allowed after `stmt` fragments
@@ -535,7 +535,7 @@ LL | ($s:stmt $t:ty) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$t:stmt`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:89:14
--> $DIR/macro-follow.rs:91:14
|
LL | ($s:stmt $t:stmt) => {};
| ^^^^^^^ not allowed after `stmt` fragments
@@ -543,7 +543,7 @@ LL | ($s:stmt $t:stmt) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$p:path`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:90:14
--> $DIR/macro-follow.rs:92:14
|
LL | ($s:stmt $p:path) => {};
| ^^^^^^^ not allowed after `stmt` fragments
@@ -551,7 +551,7 @@ LL | ($s:stmt $p:path) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$b:block`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:91:14
--> $DIR/macro-follow.rs:93:14
|
LL | ($s:stmt $b:block) => {};
| ^^^^^^^^ not allowed after `stmt` fragments
@@ -559,7 +559,7 @@ LL | ($s:stmt $b:block) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$i:ident`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:92:14
--> $DIR/macro-follow.rs:94:14
|
LL | ($s:stmt $i:ident) => {};
| ^^^^^^^^ not allowed after `stmt` fragments
@@ -567,7 +567,7 @@ LL | ($s:stmt $i:ident) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$t:tt`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:93:14
--> $DIR/macro-follow.rs:95:14
|
LL | ($s:stmt $t:tt) => {};
| ^^^^^ not allowed after `stmt` fragments
@@ -575,7 +575,7 @@ LL | ($s:stmt $t:tt) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$i:item`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:94:14
--> $DIR/macro-follow.rs:96:14
|
LL | ($s:stmt $i:item) => {};
| ^^^^^^^ not allowed after `stmt` fragments
@@ -583,7 +583,7 @@ LL | ($s:stmt $i:item) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$m:meta`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:95:14
--> $DIR/macro-follow.rs:97:14
|
LL | ($s:stmt $m:meta) => {};
| ^^^^^^^ not allowed after `stmt` fragments
@@ -591,7 +591,7 @@ LL | ($s:stmt $m:meta) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `$g:guard`, which is not allowed for `stmt` fragments
--> $DIR/macro-follow.rs:96:14
--> $DIR/macro-follow.rs:98:14
|
LL | ($s:stmt $g:guard) => {};
| ^^^^^^^^ not allowed after `stmt` fragments
@@ -599,7 +599,7 @@ LL | ($s:stmt $g:guard) => {};
= note: allowed there are: `=>`, `,` or `;`
error: `$p:path` is followed by `(`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:100:14
--> $DIR/macro-follow.rs:102:14
|
LL | ($p:path ()) => {};
| ^ not allowed after `path` fragments
@@ -607,7 +607,7 @@ LL | ($p:path ()) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `+`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:102:14
--> $DIR/macro-follow.rs:104:14
|
LL | ($p:path +) => {};
| ^ not allowed after `path` fragments
@@ -615,7 +615,7 @@ LL | ($p:path +) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `ident`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:103:14
--> $DIR/macro-follow.rs:105:14
|
LL | ($p:path ident) => {};
| ^^^^^ not allowed after `path` fragments
@@ -623,7 +623,7 @@ LL | ($p:path ident) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `if`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:104:14
--> $DIR/macro-follow.rs:106:14
|
LL | ($p:path if) => {};
| ^^ not allowed after `path` fragments
@@ -631,7 +631,7 @@ LL | ($p:path if) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$q:pat`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:105:14
--> $DIR/macro-follow.rs:107:14
|
LL | ($p:path $q:pat) => {};
| ^^^^^^ not allowed after `path` fragments
@@ -639,7 +639,7 @@ LL | ($p:path $q:pat) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$e:expr`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:106:14
--> $DIR/macro-follow.rs:108:14
|
LL | ($p:path $e:expr) => {};
| ^^^^^^^ not allowed after `path` fragments
@@ -647,7 +647,7 @@ LL | ($p:path $e:expr) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$t:ty`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:107:14
--> $DIR/macro-follow.rs:109:14
|
LL | ($p:path $t:ty) => {};
| ^^^^^ not allowed after `path` fragments
@@ -655,7 +655,7 @@ LL | ($p:path $t:ty) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$s:stmt`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:108:14
--> $DIR/macro-follow.rs:110:14
|
LL | ($p:path $s:stmt) => {};
| ^^^^^^^ not allowed after `path` fragments
@@ -663,7 +663,7 @@ LL | ($p:path $s:stmt) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$q:path`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:109:14
--> $DIR/macro-follow.rs:111:14
|
LL | ($p:path $q:path) => {};
| ^^^^^^^ not allowed after `path` fragments
@@ -671,7 +671,7 @@ LL | ($p:path $q:path) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$i:ident`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:111:14
--> $DIR/macro-follow.rs:113:14
|
LL | ($p:path $i:ident) => {};
| ^^^^^^^^ not allowed after `path` fragments
@@ -679,7 +679,7 @@ LL | ($p:path $i:ident) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$t:tt`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:112:14
--> $DIR/macro-follow.rs:114:14
|
LL | ($p:path $t:tt) => {};
| ^^^^^ not allowed after `path` fragments
@@ -687,7 +687,7 @@ LL | ($p:path $t:tt) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$i:item`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:113:14
--> $DIR/macro-follow.rs:115:14
|
LL | ($p:path $i:item) => {};
| ^^^^^^^ not allowed after `path` fragments
@@ -695,7 +695,7 @@ LL | ($p:path $i:item) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$m:meta`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:114:14
--> $DIR/macro-follow.rs:116:14
|
LL | ($p:path $m:meta) => {};
| ^^^^^^^ not allowed after `path` fragments
@@ -703,7 +703,7 @@ LL | ($p:path $m:meta) => {};
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$p:path` is followed by `$g:guard`, which is not allowed for `path` fragments
--> $DIR/macro-follow.rs:115:14
--> $DIR/macro-follow.rs:117:14
|
LL | ($p:path $g:guard) => {};
| ^^^^^^^^ not allowed after `path` fragments
@@ -1,3 +1,4 @@
//@ reference: macro.decl.follow-set.repetition
// Regression test for issue #25436: check that things which can be
// followed by any token also permit X* to come afterwards.
@@ -1,5 +1,5 @@
error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments
--> $DIR/macro-followed-by-seq-bad.rs:7:15
--> $DIR/macro-followed-by-seq-bad.rs:8:15
|
LL | ( $a:expr $($b:tt)* ) => { };
| ^^^^^ not allowed after `expr` fragments
@@ -7,7 +7,7 @@ LL | ( $a:expr $($b:tt)* ) => { };
= note: allowed there are: `=>`, `,` or `;`
error: `$a:ty` is followed by `$b:tt`, which is not allowed for `ty` fragments
--> $DIR/macro-followed-by-seq-bad.rs:8:13
--> $DIR/macro-followed-by-seq-bad.rs:9:13
|
LL | ( $a:ty $($b:tt)* ) => { };
| ^^^^^ not allowed after `ty` fragments
+1
View File
@@ -1,4 +1,5 @@
//@ check-pass
//@ reference: macro.decl.follow-set.repetition
#![allow(unused_macros)]
// Regression test for issue #25436: check that things which can be
// followed by any token also permit X* to come afterwards.
@@ -1,3 +1,4 @@
//@ reference: macro.decl.hygiene.intro
macro_rules! print_it { {} => { println!("{:?}", it); } }
//~^ ERROR cannot find value `it` in this scope
@@ -1,5 +1,5 @@
error[E0425]: cannot find value `it` in this scope
--> $DIR/macro-hygiene-help-issue-148580.rs:1:50
--> $DIR/macro-hygiene-help-issue-148580.rs:2:50
|
LL | macro_rules! print_it { {} => { println!("{:?}", it); } }
| ^^ not found in this scope
@@ -8,7 +8,7 @@ LL | print_it!();
| ----------- in this macro invocation
|
help: an identifier with the same name exists, but is not accessible due to macro hygiene
--> $DIR/macro-hygiene-help-issue-148580.rs:11:17
--> $DIR/macro-hygiene-help-issue-148580.rs:12:17
|
LL | let it = ();
| ^^
@@ -1,3 +1,4 @@
//@ reference: macro.decl.hygiene.intro
macro_rules! let_it { {} => { let it = (); } }
macro_rules! print_it { {} => { println!("{:?}", it); } }
//~^ ERROR cannot find value `it` in this scope
@@ -1,11 +1,11 @@
error[E0425]: cannot find value `it` in this scope
--> $DIR/macro-hygiene-help-issue-149604.rs:7:14
--> $DIR/macro-hygiene-help-issue-149604.rs:8:14
|
LL | let () = it;
| ^^ not found in this scope
|
help: an identifier with the same name is defined here, but is not accessible due to macro hygiene
--> $DIR/macro-hygiene-help-issue-149604.rs:1:35
--> $DIR/macro-hygiene-help-issue-149604.rs:2:35
|
LL | macro_rules! let_it { {} => { let it = (); } }
| ^^
@@ -15,7 +15,7 @@ LL | let_it!();
= note: this error originates in the macro `let_it` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `it` in this scope
--> $DIR/macro-hygiene-help-issue-149604.rs:2:50
--> $DIR/macro-hygiene-help-issue-149604.rs:3:50
|
LL | macro_rules! print_it { {} => { println!("{:?}", it); } }
| ^^ not found in this scope
@@ -24,7 +24,7 @@ LL | print_it!();
| ----------- in this macro invocation
|
help: an identifier with the same name is defined here, but is not accessible due to macro hygiene
--> $DIR/macro-hygiene-help-issue-149604.rs:1:35
--> $DIR/macro-hygiene-help-issue-149604.rs:2:35
|
LL | macro_rules! let_it { {} => { let it = (); } }
| ^^
@@ -1,3 +1,4 @@
//@ reference: macro.decl.hygiene.intro
//! Regression test for https://github.com/rust-lang/rust/issues/15167
// macro f should not be able to inject a reference to 'n'.
@@ -1,5 +1,5 @@
error[E0425]: cannot find value `n` in this scope
--> $DIR/macro-hygiene-scope-15167.rs:5:25
--> $DIR/macro-hygiene-scope-15167.rs:6:25
|
LL | macro_rules! f { () => (n) }
| ^ not found in this scope
@@ -8,14 +8,14 @@ LL | println!("{}", f!());
| ---- in this macro invocation
|
help: an identifier with the same name exists, but is not accessible due to macro hygiene
--> $DIR/macro-hygiene-scope-15167.rs:12:9
--> $DIR/macro-hygiene-scope-15167.rs:13:9
|
LL | for n in 0..1 {
| ^
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `n` in this scope
--> $DIR/macro-hygiene-scope-15167.rs:5:25
--> $DIR/macro-hygiene-scope-15167.rs:6:25
|
LL | macro_rules! f { () => (n) }
| ^ not found in this scope
@@ -24,14 +24,14 @@ LL | println!("{}", f!());
| ---- in this macro invocation
|
help: an identifier with the same name exists, but is not accessible due to macro hygiene
--> $DIR/macro-hygiene-scope-15167.rs:16:17
--> $DIR/macro-hygiene-scope-15167.rs:17:17
|
LL | if let Some(n) = None {
| ^
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `n` in this scope
--> $DIR/macro-hygiene-scope-15167.rs:5:25
--> $DIR/macro-hygiene-scope-15167.rs:6:25
|
LL | macro_rules! f { () => (n) }
| ^ not found in this scope
@@ -40,14 +40,14 @@ LL | println!("{}", f!());
| ---- in this macro invocation
|
help: an identifier with the same name exists, but is not accessible due to macro hygiene
--> $DIR/macro-hygiene-scope-15167.rs:21:24
--> $DIR/macro-hygiene-scope-15167.rs:22:24
|
LL | } else if let Some(n) = None {
| ^
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `n` in this scope
--> $DIR/macro-hygiene-scope-15167.rs:5:25
--> $DIR/macro-hygiene-scope-15167.rs:6:25
|
LL | macro_rules! f { () => (n) }
| ^ not found in this scope
@@ -56,7 +56,7 @@ LL | println!("{}", f!());
| ---- in this macro invocation
|
help: an identifier with the same name exists, but is not accessible due to macro hygiene
--> $DIR/macro-hygiene-scope-15167.rs:25:20
--> $DIR/macro-hygiene-scope-15167.rs:26:20
|
LL | while let Some(n) = None {
| ^
@@ -1,6 +1,7 @@
//@ edition:2015
//@ run-rustfix
//@ aux-build:or-pattern.rs
//@ reference: macro.decl.follow-set.edition2021
#![deny(rust_2021_incompatible_or_patterns)]
#![allow(unused_macros)]
@@ -1,6 +1,7 @@
//@ edition:2015
//@ run-rustfix
//@ aux-build:or-pattern.rs
//@ reference: macro.decl.follow-set.edition2021
#![deny(rust_2021_incompatible_or_patterns)]
#![allow(unused_macros)]
@@ -1,5 +1,5 @@
error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
--> $DIR/macro-or-patterns-back-compat.rs:11:21
--> $DIR/macro-or-patterns-back-compat.rs:12:21
|
LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
| ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
@@ -7,13 +7,13 @@ LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html>
note: the lint level is defined here
--> $DIR/macro-or-patterns-back-compat.rs:5:9
--> $DIR/macro-or-patterns-back-compat.rs:6:9
|
LL | #![deny(rust_2021_incompatible_or_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
--> $DIR/macro-or-patterns-back-compat.rs:14:23
--> $DIR/macro-or-patterns-back-compat.rs:15:23
|
LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} }
| ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
@@ -22,7 +22,7 @@ LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} }
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html>
error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
--> $DIR/macro-or-patterns-back-compat.rs:20:21
--> $DIR/macro-or-patterns-back-compat.rs:21:21
|
LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} }
| ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
@@ -31,7 +31,7 @@ LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} }
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html>
error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
--> $DIR/macro-or-patterns-back-compat.rs:24:26
--> $DIR/macro-or-patterns-back-compat.rs:25:26
|
LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
| ^^^^^^^^ help: use pat_param to preserve semantics: `$pat:pat_param`
+1
View File
@@ -1,5 +1,6 @@
//@ check-pass
//@ edition:2018
//@ reference: macro.decl.follow-set.edition2021
macro_rules! pat_bar {
($p:pat | $p2:pat) => {{
+1
View File
@@ -1,4 +1,5 @@
//@ run-pass
//@ reference: macro.decl.follow-set.token-pat
macro_rules! pat_in {
($p:pat in $e:expr) => {{
let mut iter = $e.into_iter();
@@ -1,4 +1,5 @@
//@ edition:2021
//@ reference: macro.decl.follow-set.token-pat
#![allow(unused_macros)]
macro_rules! foo { ($x:pat | $y:pat) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
@@ -1,5 +1,5 @@
error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
--> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:3:28
--> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:4:28
|
LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
| ------ ^ not allowed after `pat` fragments
@@ -9,7 +9,7 @@ LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
= note: allowed there are: `=>`, `,`, `=`, `if`, `if let` or `in`
error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
--> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:4:32
--> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:5:32
|
LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} }
| ------ ^ not allowed after `pat` fragments
@@ -19,7 +19,7 @@ LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} }
= note: allowed there are: `=>`, `,`, `=`, `if`, `if let` or `in`
error: `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragments
--> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:7:36
--> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:8:36
|
LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
| -------- ^ not allowed after `pat` fragments
@@ -1,5 +1,7 @@
//@ edition:2015..2021
//@ run-pass
//@ reference: macro.decl.follow-set.token-pat
//@ reference: macro.decl.follow-set.edition2021
#![allow(unused_macros)]
macro_rules! foo { ($x:pat | $y:pat) => {} } // should be ok
macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } // should be ok
@@ -1,4 +1,6 @@
//@ edition:2021
//@ reference: macro.decl.follow-set.token-pat
//@ reference: macro.decl.follow-set.edition2021
#![allow(unused_macros)]
macro_rules! foo { ($x:pat | $y:pat) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
@@ -1,5 +1,5 @@
error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
--> $DIR/macro-pat2021-pattern-followed-by-or.rs:4:28
--> $DIR/macro-pat2021-pattern-followed-by-or.rs:6:28
|
LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
| ------ ^ not allowed after `pat` fragments
@@ -9,7 +9,7 @@ LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
= note: allowed there are: `=>`, `,`, `=`, `if`, `if let` or `in`
error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
--> $DIR/macro-pat2021-pattern-followed-by-or.rs:7:28
--> $DIR/macro-pat2021-pattern-followed-by-or.rs:9:28
|
LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} }
| ------ ^ not allowed after `pat` fragments
@@ -19,7 +19,7 @@ LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} }
= note: allowed there are: `=>`, `,`, `=`, `if`, `if let` or `in`
error: `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragments
--> $DIR/macro-pat2021-pattern-followed-by-or.rs:9:35
--> $DIR/macro-pat2021-pattern-followed-by-or.rs:11:35
|
LL | ( $expr:expr , $( $( $pat:pat)|+ => $expr_arm:pat),+ ) => {
| -------- ^ not allowed after `pat` fragments
@@ -1,3 +1,4 @@
//@ reference: names.namespaces.sub-namespaces.intro
#![crate_type = "lib"]
macro_rules! sample { () => {} }
@@ -1,5 +1,5 @@
error: cannot find attribute `sample` in this scope
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:5:3
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:3
|
LL | macro_rules! sample { () => {} }
| ------ `sample` exists, but has no `attr` rules
@@ -8,7 +8,7 @@ LL | #[sample]
| ^^^^^^
error: cannot find derive macro `sample` in this scope
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:7:10
|
LL | macro_rules! sample { () => {} }
| ------ `sample` exists, but has no `derive` rules
@@ -17,7 +17,7 @@ LL | #[derive(sample)]
| ^^^^^^
error: cannot find derive macro `sample` in this scope
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:6:10
--> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:7:10
|
LL | macro_rules! sample { () => {} }
| ------ `sample` exists, but has no `derive` rules
+2
View File
@@ -1,4 +1,6 @@
//@ aux-build:two_macros.rs
//@ reference: macro.decl.scope.textual.shadow
//@ reference: names.resolution.expansion.macros.ambiguity.more-expanded-vs-outer
#![allow(unused_macros)]
+4 -4
View File
@@ -1,5 +1,5 @@
error: `macro_two` is already in scope
--> $DIR/macro-shadowing.rs:12:5
--> $DIR/macro-shadowing.rs:14:5
|
LL | #[macro_use]
| ^^^^^^^^^^^^
@@ -11,14 +11,14 @@ LL | m1!();
= note: this error originates in the macro `m1` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0659]: `foo` is ambiguous
--> $DIR/macro-shadowing.rs:17:1
--> $DIR/macro-shadowing.rs:19:1
|
LL | foo!();
| ^^^ ambiguous name
|
= note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
note: `foo` could refer to the macro defined here
--> $DIR/macro-shadowing.rs:10:5
--> $DIR/macro-shadowing.rs:12:5
|
LL | macro_rules! foo { () => {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | macro_rules! foo { () => {} }
LL | m1!();
| ----- in this macro invocation
note: `foo` could also refer to the macro defined here
--> $DIR/macro-shadowing.rs:5:1
--> $DIR/macro-shadowing.rs:7:1
|
LL | macro_rules! foo { () => {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1,5 +1,6 @@
//@ check-pass
//@ aux-build:two_macros-rpass.rs
//@ reference: macro.decl.scope.macro_use.duplicates
#![warn(unused_attributes)]
@@ -1,12 +1,12 @@
warning: unused attribute
--> $DIR/macro-use-all-and-none.rs:7:12
--> $DIR/macro-use-all-and-none.rs:8:12
|
LL | #[macro_use()]
| ^^ help: remove these parentheses
|
= note: using `macro_use` with an empty list is equivalent to not using a list at all
note: the lint level is defined here
--> $DIR/macro-use-all-and-none.rs:4:9
--> $DIR/macro-use-all-and-none.rs:5:9
|
LL | #![warn(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
+1
View File
@@ -1,3 +1,4 @@
//@ reference: macro.decl.scope.macro_use.syntax
#![no_std]
#[macro_use(foo(bar))] //~ ERROR malformed `macro_use` attribute input
+1 -1
View File
@@ -1,5 +1,5 @@
error[E0565]: malformed `macro_use` attribute input
--> $DIR/macro-use-bad-args-1.rs:3:1
--> $DIR/macro-use-bad-args-1.rs:4:1
|
LL | #[macro_use(foo(bar))]
| ^^^^^^^^^^^^^^^-----^^
+1
View File
@@ -1,3 +1,4 @@
//@ reference: macro.decl.scope.macro_use.syntax
#![no_std]
#[macro_use(foo="bar")] //~ ERROR malformed `macro_use` attribute input
+1 -1
View File
@@ -1,5 +1,5 @@
error[E0565]: malformed `macro_use` attribute input
--> $DIR/macro-use-bad-args-2.rs:3:1
--> $DIR/macro-use-bad-args-2.rs:4:1
|
LL | #[macro_use(foo="bar")]
| ^^^^^^^^^^^^^^^------^^
+2
View File
@@ -1,5 +1,7 @@
//@ check-pass
//@ aux-build:two_macros.rs
//@ reference: macro.decl.scope.macro_use.syntax
//@ reference: macro.decl.scope.macro_use.prelude
#[macro_use(macro_one, macro_two)]
extern crate two_macros;
@@ -1,3 +1,4 @@
//@ reference: macro.decl.scope.macro_use.syntax
#[macro_use(foo, bar)] //~ ERROR arguments to `macro_use` are not allowed here
mod foo {
}
@@ -1,5 +1,5 @@
error: arguments to `macro_use` are not allowed here
--> $DIR/module-macro_use-arguments.rs:1:1
--> $DIR/module-macro_use-arguments.rs:2:1
|
LL | #[macro_use(foo, bar)]
| ^^^^^^^^^^^^^^^^^^^^^^