mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Merge #10977
10977: fix: fix `concat!` with captured expression r=jonas-schievink a=jonas-schievink Adds another hack on top of https://github.com/rust-analyzer/rust-analyzer/pull/10623 to fix `concat!`. Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10721 bors r+ Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
This commit is contained in:
commit
bc8efca0c8
2 changed files with 46 additions and 1 deletions
|
@ -313,6 +313,40 @@ fn main() { "foor0bar\nfalse"; }
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_concat_with_captured_expr() {
|
||||
check(
|
||||
r##"
|
||||
#[rustc_builtin_macro]
|
||||
macro_rules! concat {}
|
||||
|
||||
macro_rules! surprise {
|
||||
() => { "s" };
|
||||
}
|
||||
|
||||
macro_rules! stuff {
|
||||
($string:expr) => { concat!($string) };
|
||||
}
|
||||
|
||||
fn main() { concat!(surprise!()); }
|
||||
"##,
|
||||
expect![[r##"
|
||||
#[rustc_builtin_macro]
|
||||
macro_rules! concat {}
|
||||
|
||||
macro_rules! surprise {
|
||||
() => { "s" };
|
||||
}
|
||||
|
||||
macro_rules! stuff {
|
||||
($string:expr) => { concat!($string) };
|
||||
}
|
||||
|
||||
fn main() { "s"; }
|
||||
"##]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_concat_idents_expand() {
|
||||
check(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue