mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Merge pull request #18420 from ChayimFriedman2/cfg-true-false
feat: Support `cfg(true)` and `cfg(false)`
This commit is contained in:
commit
cf8f950baa
10 changed files with 87 additions and 6 deletions
|
@ -192,6 +192,22 @@ union FooBar {
|
|||
//- /outline_inner.rs
|
||||
#![cfg(outline_inner)]
|
||||
//- /outline.rs
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cfg_true_false() {
|
||||
check(
|
||||
r#"
|
||||
#[cfg(false)] fn inactive() {}
|
||||
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: false is disabled
|
||||
|
||||
#[cfg(true)] fn active() {}
|
||||
|
||||
#[cfg(any(not(true)), false)] fn inactive2() {}
|
||||
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ weak: code is inactive due to #[cfg] directives: true is enabled
|
||||
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue