rust/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
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

71 lines
2 KiB
Text

error: `cfg` is not followed by parentheses
--> $DIR/cfg-attr-syntax-validation.rs:1:1
|
LL | #[cfg]
| ^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
error: `cfg` is not followed by parentheses
--> $DIR/cfg-attr-syntax-validation.rs:4:1
|
LL | #[cfg = 10]
| ^^^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
error: `cfg` predicate is not specified
--> $DIR/cfg-attr-syntax-validation.rs:7:1
|
LL | #[cfg()]
| ^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
error: multiple `cfg` predicates are specified
--> $DIR/cfg-attr-syntax-validation.rs:10:10
|
LL | #[cfg(a, b)]
| ^
error: `cfg` predicate key cannot be a literal
--> $DIR/cfg-attr-syntax-validation.rs:13:7
|
LL | #[cfg("str")]
| ^^^^^
error: `cfg` predicate key must be an identifier
--> $DIR/cfg-attr-syntax-validation.rs:16:7
|
LL | #[cfg(a::b)]
| ^^^^
error[E0537]: invalid predicate `a`
--> $DIR/cfg-attr-syntax-validation.rs:19:7
|
LL | #[cfg(a())]
| ^^^
error[E0565]: literal in `cfg` predicate value must be a string
--> $DIR/cfg-attr-syntax-validation.rs:22:11
|
LL | #[cfg(a = 10)]
| ^^
error[E0565]: literal in `cfg` predicate value must be a string
--> $DIR/cfg-attr-syntax-validation.rs:25:11
|
LL | #[cfg(a = b"hi")]
| -^^^^
| |
| help: consider removing the prefix
error: expected unsuffixed literal, found `expr` metavariable
--> $DIR/cfg-attr-syntax-validation.rs:30:25
|
LL | #[cfg(feature = $expr)]
| ^^^^^
...
LL | generate_s10!(concat!("nonexistent"));
| ------------------------------------- in this macro invocation
|
= note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 10 previous errors
Some errors have detailed explanations: E0537, E0565.
For more information about an error, try `rustc --explain E0537`.