Closed
Description
rust-analyzer version: rust-analyzer version: 0.3.1148-standalone (2b472f6 2022-07-31)
rustc version: rustc 1.60.0 (7737e0b5c 2022-04-04) and rustc 1.62.0-nightly (90ca44752 2022-04-11)
We discovered an inconsistency between rust-analyzer's expansion of concat!
and rustc when using single quotes. So '\n'
gets expanded to "\'\\n\'"
instead of "\n"
. And '\0'
gets expanded to \'\\0\'
instead of \u{0}
.
Examples to reproduce
Source code
fn main() {
let s = concat!("Hello, World!", '\n');
}
rust-analyzer
fn main() {
let s = "Hello, World!\'\\n\'";
}
cargo-expand
fn main() {
let s = "Hello, World!\n";
}
Source code
fn main() {
let s = concat!("Hello, World!", '\0');
}
rust-analyzer
fn main() {
let s = "Hello, World!\'\\0\'";
}
cargo-expand
fn main() {
let s = "Hello, World!\u{0}";
}