Gate #[test] expansion under cfg(test).

This will mean users opting to not activate `cfg(test)` will lose IDE experience on them, which is quite unfortunate, but this is unavoidable if we want to avoid false positives on e.g. diagnostics. The real fix is to provide IDE experience even for cfg'ed out code, but this is out of scope for this PR.
This commit is contained in:
Chayim Refael Friedman 2024-09-09 23:54:22 +03:00
parent 4ea09dd9f6
commit 4a06675e9c
17 changed files with 78 additions and 45 deletions

View file

@ -35,6 +35,7 @@ fn load_cargo_with_overrides(
rustc: Err(None),
cargo_config_extra_env: Default::default(),
error: None,
set_test: true,
},
cfg_overrides,
sysroot: Sysroot::empty(),
@ -136,7 +137,6 @@ fn to_crate_graph(project_workspace: ProjectWorkspace) -> (CrateGraph, ProcMacro
}
},
&Default::default(),
true,
)
}
@ -243,6 +243,7 @@ fn smoke_test_real_sysroot_cargo() {
rustc: Err(None),
cargo_config_extra_env: Default::default(),
error: None,
set_test: true,
},
sysroot,
rustc_cfg: Vec::new(),
@ -258,6 +259,5 @@ fn smoke_test_real_sysroot_cargo() {
}
},
&Default::default(),
true,
);
}