1
Fork 0
rust/tests/ui/parser/float-field-interpolated.rs
Nicholas Nethercote 49ed25b5d2 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.
2025-04-02 06:20:35 +11:00

17 lines
574 B
Rust

struct S(u8, (u8, u8));
macro_rules! generate_field_accesses {
($a:tt, $b:literal, $c:expr) => {
let s = S(0, (0, 0));
s.$a; // OK
{ 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
};
}
fn main() {
generate_field_accesses!(1.1, 1.1, 1.1);
}