Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/macro_expansion_tests/builtin_fn_macro.rs')
| -rw-r--r-- | crates/hir_def/src/macro_expansion_tests/builtin_fn_macro.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests/builtin_fn_macro.rs b/crates/hir_def/src/macro_expansion_tests/builtin_fn_macro.rs index 06039e95c5..6e91301ecd 100644 --- a/crates/hir_def/src/macro_expansion_tests/builtin_fn_macro.rs +++ b/crates/hir_def/src/macro_expansion_tests/builtin_fn_macro.rs @@ -314,6 +314,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( r##" |