Skip to content

Commit 5c2ac03

Browse files
committed
Ignore text and bench attributes again
1 parent 55d4813 commit 5c2ac03

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

crates/hir_def/src/builtin_attr.rs

+9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ macro_rules! rustc_attr {
3434
};
3535
}
3636

37+
// FIXME: We shouldn't special case these at all, but as of now expanding attributes severely degrades
38+
// user experience due to lacking support. Hence only expand(not ignore) these in tests for now.
39+
/// Built-in macro-like attributes.
40+
#[cfg(test)]
41+
pub const EXTRA_ATTRIBUTES: &[BuiltinAttribute] = &["test", "bench"];
42+
/// Built-in macro-like attributes.
43+
#[cfg(not(test))]
44+
pub const EXTRA_ATTRIBUTES: &[BuiltinAttribute] = &[];
45+
3746
/// "Inert" built-in attributes that have a special meaning to rustc or rustdoc.
3847
#[rustfmt::skip]
3948
pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[

crates/hir_def/src/nameres/collector.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,7 @@ impl ModCollector<'_, '_> {
17321732
let name = name.to_string();
17331733
let is_inert = builtin_attr::INERT_ATTRIBUTES
17341734
.iter()
1735+
.chain(builtin_attr::EXTRA_ATTRIBUTES)
17351736
.copied()
17361737
.chain(self.def_collector.registered_attrs.iter().map(AsRef::as_ref))
17371738
.any(|attr| name == *attr);

0 commit comments

Comments
 (0)