Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/expr_store/lower.rs')
-rw-r--r--crates/hir-def/src/expr_store/lower.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/crates/hir-def/src/expr_store/lower.rs b/crates/hir-def/src/expr_store/lower.rs
index 238538dc58..26a50b5325 100644
--- a/crates/hir-def/src/expr_store/lower.rs
+++ b/crates/hir-def/src/expr_store/lower.rs
@@ -12,7 +12,6 @@ use cfg::CfgOptions;
use either::Either;
use hir_expand::{
HirFileId, InFile, MacroDefId,
- mod_path::tool_path,
name::{AsName, Name},
span_map::SpanMapRef,
};
@@ -34,6 +33,7 @@ use tt::TextRange;
use crate::{
AdtId, BlockId, BlockLoc, DefWithBodyId, FunctionId, GenericDefId, ImplId, MacroId,
ModuleDefId, ModuleId, TraitId, TypeAliasId, UnresolvedMacro,
+ attrs::AttrFlags,
builtin_type::BuiltinUint,
db::DefDatabase,
expr_store::{
@@ -87,14 +87,16 @@ pub(super) fn lower_body(
let mut params = vec![];
let mut collector = ExprCollector::new(db, module, current_file_id);
- let skip_body = match owner {
- DefWithBodyId::FunctionId(it) => db.attrs(it.into()),
- DefWithBodyId::StaticId(it) => db.attrs(it.into()),
- DefWithBodyId::ConstId(it) => db.attrs(it.into()),
- DefWithBodyId::VariantId(it) => db.attrs(it.into()),
- }
- .rust_analyzer_tool()
- .any(|attr| *attr.path() == tool_path![skip]);
+ let skip_body = AttrFlags::query(
+ db,
+ match owner {
+ DefWithBodyId::FunctionId(it) => it.into(),
+ DefWithBodyId::StaticId(it) => it.into(),
+ DefWithBodyId::ConstId(it) => it.into(),
+ DefWithBodyId::VariantId(it) => it.into(),
+ },
+ )
+ .contains(AttrFlags::RUST_ANALYZER_SKIP);
// If #[rust_analyzer::skip] annotated, only construct enough information for the signature
// and skip the body.
if skip_body {
@@ -2498,7 +2500,7 @@ impl<'db> ExprCollector<'db> {
/// Returns `None` (and emits diagnostics) when `owner` if `#[cfg]`d out, and `Some(())` when
/// not.
fn check_cfg(&mut self, owner: &dyn ast::HasAttrs) -> bool {
- let enabled = self.expander.is_cfg_enabled(self.db, owner, self.cfg_options);
+ let enabled = self.expander.is_cfg_enabled(owner, self.cfg_options);
match enabled {
Ok(()) => true,
Err(cfg) => {