about summary refs log tree commit diff
path: root/tests/ui/parser
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-04-18 21:31:17 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-04-02 06:20:35 +1100
commit49ed25b5d2d5dc88f9fa3e268d9bd210acc875de (patch)
tree5a204468aeb40c13eb3fc701f31e47d925707eb2 /tests/ui/parser
parent0b4a81a4ef637117b365c3c51a5326f1c4a90ded (diff)
downloadrust-49ed25b5d2d5dc88f9fa3e268d9bd210acc875de.tar.gz
rust-49ed25b5d2d5dc88f9fa3e268d9bd210acc875de.zip
Remove `NtExpr` and `NtLiteral`.
Notes about tests:
- tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs: some messages are
  now duplicated due to repeated parsing.

- tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs: ditto.

- `tests/ui/proc-macro/macro-rules-derive-cfg.rs`: the diff looks large
  but the only difference is the insertion of a single
  invisible-delimited group around a metavar.

- `tests/ui/attributes/nonterminal-expansion.rs`: a slight span
  degradation, somehow related to the recent massive attr parsing
  rewrite (#135726). I couldn't work out exactly what is going wrong,
  but I don't think it's worth holding things up for a single slightly
  suboptimal error message.
Diffstat (limited to 'tests/ui/parser')
-rw-r--r--tests/ui/parser/extern-abi-from-mac-literal-frag.rs4
-rw-r--r--tests/ui/parser/float-field-interpolated.rs8
-rw-r--r--tests/ui/parser/float-field-interpolated.stderr8
-rw-r--r--tests/ui/parser/macro/trait-non-item-macros.rs2
-rw-r--r--tests/ui/parser/macro/trait-non-item-macros.stderr2
5 files changed, 14 insertions, 10 deletions
diff --git a/tests/ui/parser/extern-abi-from-mac-literal-frag.rs b/tests/ui/parser/extern-abi-from-mac-literal-frag.rs
index a4e9134218c..12b6c98705c 100644
--- a/tests/ui/parser/extern-abi-from-mac-literal-frag.rs
+++ b/tests/ui/parser/extern-abi-from-mac-literal-frag.rs
@@ -12,6 +12,8 @@ macro_rules! abi_from_lit_frag {
             fn _import();
         }
 
+        unsafe extern $abi {}
+
         extern $abi fn _export() {}
 
         type _PTR = extern $abi fn();
@@ -24,6 +26,8 @@ macro_rules! abi_from_expr_frag {
             fn _import();
         }
 
+        unsafe extern $abi {}
+
         extern $abi fn _export() {}
 
         type _PTR = extern $abi fn();
diff --git a/tests/ui/parser/float-field-interpolated.rs b/tests/ui/parser/float-field-interpolated.rs
index 990f2926dc8..bf7163039c4 100644
--- a/tests/ui/parser/float-field-interpolated.rs
+++ b/tests/ui/parser/float-field-interpolated.rs
@@ -5,10 +5,10 @@ macro_rules! generate_field_accesses {
         let s = S(0, (0, 0));
 
         s.$a; // OK
-        { s.$b; } //~ ERROR unexpected token: `1.1`
-                  //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found literal `1.1`
-        { s.$c; } //~ ERROR unexpected token: `1.1`
-                  //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found expression `1.1`
+        { s.$b; } //~ ERROR unexpected token: `literal` metavariable
+                  //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `literal` metavariable
+        { s.$c; } //~ ERROR unexpected token: `expr` metavariable
+                  //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `expr` metavariable
     };
 }
 
diff --git a/tests/ui/parser/float-field-interpolated.stderr b/tests/ui/parser/float-field-interpolated.stderr
index 2a1a4926cb3..e2b7e3a7dbe 100644
--- a/tests/ui/parser/float-field-interpolated.stderr
+++ b/tests/ui/parser/float-field-interpolated.stderr
@@ -1,4 +1,4 @@
-error: unexpected token: `1.1`
+error: unexpected token: `literal` metavariable
   --> $DIR/float-field-interpolated.rs:8:13
    |
 LL |         { s.$b; }
@@ -9,7 +9,7 @@ LL |     generate_field_accesses!(1.1, 1.1, 1.1);
    |
    = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: expected one of `.`, `;`, `?`, `}`, or an operator, found literal `1.1`
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `literal` metavariable
   --> $DIR/float-field-interpolated.rs:8:13
    |
 LL |         { s.$b; }
@@ -20,7 +20,7 @@ LL |     generate_field_accesses!(1.1, 1.1, 1.1);
    |
    = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: unexpected token: `1.1`
+error: unexpected token: `expr` metavariable
   --> $DIR/float-field-interpolated.rs:10:13
    |
 LL |         { s.$c; }
@@ -31,7 +31,7 @@ LL |     generate_field_accesses!(1.1, 1.1, 1.1);
    |
    = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: expected one of `.`, `;`, `?`, `}`, or an operator, found expression `1.1`
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `expr` metavariable
   --> $DIR/float-field-interpolated.rs:10:13
    |
 LL |         { s.$c; }
diff --git a/tests/ui/parser/macro/trait-non-item-macros.rs b/tests/ui/parser/macro/trait-non-item-macros.rs
index e93000193b6..b4140613cba 100644
--- a/tests/ui/parser/macro/trait-non-item-macros.rs
+++ b/tests/ui/parser/macro/trait-non-item-macros.rs
@@ -1,7 +1,7 @@
 macro_rules! bah {
     ($a:expr) => {
         $a
-    }; //~^ ERROR macro expansion ignores expression `2` and any tokens following
+    }; //~^ ERROR macro expansion ignores `expr` metavariable and any tokens following
 }
 
 trait Bar {
diff --git a/tests/ui/parser/macro/trait-non-item-macros.stderr b/tests/ui/parser/macro/trait-non-item-macros.stderr
index 1a828483778..62b42fa8b8d 100644
--- a/tests/ui/parser/macro/trait-non-item-macros.stderr
+++ b/tests/ui/parser/macro/trait-non-item-macros.stderr
@@ -1,4 +1,4 @@
-error: macro expansion ignores expression `2` and any tokens following
+error: macro expansion ignores `expr` metavariable and any tokens following
   --> $DIR/trait-non-item-macros.rs:3:9
    |
 LL |         $a