Auto merge of #16048 - Veykril:concat-bytes-fix, r=Veykril

fix: Fix concat_bytes! expansion emitting an identifier

Fixes https://github.com/rust-lang/rust-analyzer/issues/16046 (note that this has always been broken)
This commit is contained in:
bors 2023-12-08 12:27:58 +00:00
commit 86cccc76e3
12 changed files with 107 additions and 49 deletions

View file

@ -468,12 +468,12 @@ macro_rules! concat_bytes {}
fn main() { concat_bytes!(b'A', b"BC", [68, b'E', 70]); }
"##,
expect![[r##"
expect![[r#"
#[rustc_builtin_macro]
macro_rules! concat_bytes {}
fn main() { [b'A', 66, 67, 68, b'E', 70]; }
"##]],
"#]],
);
}

View file

@ -1004,3 +1004,29 @@ fn main() {
"##]],
);
}
#[test]
fn eager_concat_bytes_panic() {
check(
r#"
#[rustc_builtin_macro]
#[macro_export]
macro_rules! concat_bytes {}
fn main() {
let x = concat_bytes!(2);
}
"#,
expect![[r#"
#[rustc_builtin_macro]
#[macro_export]
macro_rules! concat_bytes {}
fn main() {
let x = /* error: unexpected token in input */[];
}
"#]],
);
}