mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 06:03:58 +00:00
Skip #[test_case] expansion
This commit is contained in:
parent
7692c82e0b
commit
3d6acb3d60
2 changed files with 5 additions and 2 deletions
|
@ -1323,7 +1323,7 @@ impl DefCollector<'_> {
|
||||||
_ => return Resolved::No,
|
_ => return Resolved::No,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Skip #[test]/#[bench] expansion, which would merely result in more memory usage
|
// Skip #[test]/#[bench]/#[test_case] expansion, which would merely result in more memory usage
|
||||||
// due to duplicating functions into macro expansions, but only if `cfg(test)` is active,
|
// due to duplicating functions into macro expansions, but only if `cfg(test)` is active,
|
||||||
// otherwise they are expanded to nothing and this can impact e.g. diagnostics (due to things
|
// otherwise they are expanded to nothing and this can impact e.g. diagnostics (due to things
|
||||||
// being cfg'ed out).
|
// being cfg'ed out).
|
||||||
|
@ -1332,7 +1332,7 @@ impl DefCollector<'_> {
|
||||||
if matches!(
|
if matches!(
|
||||||
def.kind,
|
def.kind,
|
||||||
MacroDefKind::BuiltInAttr(_, expander)
|
MacroDefKind::BuiltInAttr(_, expander)
|
||||||
if expander.is_test() || expander.is_bench()
|
if expander.is_test() || expander.is_bench() || expander.is_test_case()
|
||||||
) {
|
) {
|
||||||
let test_is_active =
|
let test_is_active =
|
||||||
self.cfg_options.check_atom(&CfgAtom::Flag(sym::test.clone()));
|
self.cfg_options.check_atom(&CfgAtom::Flag(sym::test.clone()));
|
||||||
|
|
|
@ -51,6 +51,9 @@ impl BuiltinAttrExpander {
|
||||||
pub fn is_bench(self) -> bool {
|
pub fn is_bench(self) -> bool {
|
||||||
matches!(self, BuiltinAttrExpander::Bench)
|
matches!(self, BuiltinAttrExpander::Bench)
|
||||||
}
|
}
|
||||||
|
pub fn is_test_case(self) -> bool {
|
||||||
|
matches!(self, BuiltinAttrExpander::TestCase)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
register_builtin! {
|
register_builtin! {
|
||||||
|
|
Loading…
Reference in a new issue