You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
macro_rules! t {($item: literal) => { stringify!($item)}}fnmain(){println!("{}", t!(-1));}
The macro system recognizes -1 as a single literal in this case.
Instead, this happened:
error: expected a literal
--> src/main.rs:2:28
|
2 | println!("{}", concat!(-1));
| ^^
|
= note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()`
error: could not compile `playground` due to previous error
Meta
rustc --version --verbose:
Tried on playground, all channels:
Stable 1.66.1
Beta 1.67.0-beta.7 (2023-01-11 275123c)
Nightly 1.68.0-nightly (2023-01-13 0b90256)
Activity
Ezrashaw commentedon Jan 14, 2023
Hmm, this actually looks like fun to fix.
@rustbot claim
Rollup merge of rust-lang#106844 - Ezrashaw:concat-negative-int-lit, …
Rollup merge of rust-lang#106844 - Ezrashaw:concat-negative-int-lit, …