Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/expr_store/tests/body.rs')
| -rw-r--r-- | crates/hir-def/src/expr_store/tests/body.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/crates/hir-def/src/expr_store/tests/body.rs b/crates/hir-def/src/expr_store/tests/body.rs index 98cbcb2450..dda5a8189c 100644 --- a/crates/hir-def/src/expr_store/tests/body.rs +++ b/crates/hir-def/src/expr_store/tests/body.rs @@ -716,3 +716,48 @@ fn foo() -> i64 { }"#]], ); } + +#[test] +fn weird_cfgs() { + pretty_print( + r#" +macro_rules! falsify { + ( $($t:tt)* ) => { #[cfg(false)] $($t)* }; +} + +struct Foo(); + +fn foo() { + foo(falsify!(1)); + (falsify!(1),); + [falsify!(1)]; + Foo(falsify!(1)); + foo(#[cfg(false)] 1); + (#[cfg(false)] 1,); + [#[cfg(false)] 1]; + Foo(#[cfg(false)] 1); + (|#[cfg(false)] a| {})(); + + builtin # asm( + "", + #[cfg(false)] x = const 4, + #[cfg(false)] options(), + #[cfg(false)] clobber_abi("C"), + ); +} + "#, + expect![[r#" + fn foo() { + foo(); + (); + []; + Foo(); + foo(); + (); + []; + Foo(); + (|| {})(); + builtin#asm(_); + }"#]], + ); +} |