Unnamed repository; edit this file 'description' to name the repository.
Merge #10044
10044: minor: Ignore text and bench attributes again r=Veykril a=Veykril Reverts part of #9943 Co-authored-by: Lukas Wirth <[email protected]>
bors[bot] 2021-08-28
parent 97409e5 · parent 798c539 · commit 99e67f8
-rw-r--r--crates/hir_def/src/builtin_attr.rs5
-rw-r--r--crates/hir_def/src/nameres/collector.rs1
2 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir_def/src/builtin_attr.rs b/crates/hir_def/src/builtin_attr.rs
index 6cd185ceeb..15fb904e6f 100644
--- a/crates/hir_def/src/builtin_attr.rs
+++ b/crates/hir_def/src/builtin_attr.rs
@@ -34,6 +34,11 @@ macro_rules! rustc_attr {
};
}
+// FIXME: We shouldn't special case these at all, but as of now expanding attributes severely degrades
+// user experience due to lacking support.
+/// Built-in macro-like attributes.
+pub const EXTRA_ATTRIBUTES: &[BuiltinAttribute] = &["test", "bench"];
+
/// "Inert" built-in attributes that have a special meaning to rustc or rustdoc.
#[rustfmt::skip]
pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index bab0b4c729..efedbb0ee2 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -1732,6 +1732,7 @@ impl ModCollector<'_, '_> {
let name = name.to_string();
let is_inert = builtin_attr::INERT_ATTRIBUTES
.iter()
+ .chain(builtin_attr::EXTRA_ATTRIBUTES)
.copied()
.chain(self.def_collector.registered_attrs.iter().map(AsRef::as_ref))
.any(|attr| name == *attr);