diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2020-12-18 20:01:02 +0100 |
|---|---|---|
| committer | Jonas Schievink <jonasschievink@gmail.com> | 2020-12-18 20:01:02 +0100 |
| commit | 382ee2fa037a3ec293d332dd70f04975396b5513 (patch) | |
| tree | ea3ea6ec6423d27568c0afc90492c46d2a744abe | |
| parent | d42d1d33f029ac09d4848c102b53ca39da6d0f4e (diff) | |
| download | rust-382ee2fa037a3ec293d332dd70f04975396b5513.tar.gz rust-382ee2fa037a3ec293d332dd70f04975396b5513.zip | |
Add test
| -rw-r--r-- | crates/hir_def/src/nameres/tests/diagnostics.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs index 1a7b988318e..4093f8bd0b4 100644 --- a/crates/hir_def/src/nameres/tests/diagnostics.rs +++ b/crates/hir_def/src/nameres/tests/diagnostics.rs @@ -119,3 +119,19 @@ fn inactive_item() { "#, ); } + +/// Tests that `cfg` attributes behind `cfg_attr` is handled properly. +#[test] +fn inactive_via_cfg_attr() { + check_diagnostics( + r#" + //- /lib.rs + #[cfg_attr(not(never), cfg(no))] fn f() {} + //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ code is inactive due to #[cfg] directives: no is disabled + + #[cfg_attr(not(never), cfg(not(no)))] fn f() {} + + #[cfg_attr(never, cfg(no))] fn g() {} + "#, + ); +} |
