From 6501e45131d689053e32e7775a7ed04e488a419e Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 7 Apr 2022 15:22:11 +0200 Subject: [PATCH] Remove `FnFlags::IS_IN_EXTERN_BLOCK` --- crates/hir_def/src/data.rs | 8 -------- crates/hir_def/src/item_tree.rs | 3 --- crates/hir_ty/src/diagnostics/decl_check.rs | 5 +++-- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs index ffb733c2b97..8e0bb0c34d3 100644 --- a/crates/hir_def/src/data.rs +++ b/crates/hir_def/src/data.rs @@ -57,10 +57,6 @@ pub(crate) fn fn_data_query(db: &dyn DefDatabase, func: FunctionId) -> Arc bool { self.flags.bits & FnFlags::IS_UNSAFE != 0 } - pub fn is_in_extern_block(&self) -> bool { - self.flags.bits & FnFlags::IS_IN_EXTERN_BLOCK != 0 - } - pub fn is_varargs(&self) -> bool { self.flags.bits & FnFlags::IS_VARARGS != 0 } diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index 4bde87b8d48..bf60c6bc6af 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs @@ -612,9 +612,6 @@ impl FnFlags { pub(crate) const IS_CONST: u8 = 1 << 3; pub(crate) const IS_ASYNC: u8 = 1 << 4; pub(crate) const IS_UNSAFE: u8 = 1 << 5; - /// Whether the function is located in an `extern` block (*not* whether it is an - /// `extern "abi" fn`). - pub(crate) const IS_IN_EXTERN_BLOCK: u8 = 1 << 6; pub(crate) const IS_VARARGS: u8 = 1 << 7; } diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs index 9e1f9340342..f7031a8546a 100644 --- a/crates/hir_ty/src/diagnostics/decl_check.rs +++ b/crates/hir_ty/src/diagnostics/decl_check.rs @@ -19,7 +19,8 @@ adt::VariantData, expr::{Pat, PatId}, src::HasSource, - AdtId, AttrDefId, ConstId, EnumId, FunctionId, Lookup, ModuleDefId, StaticId, StructId, + AdtId, AttrDefId, ConstId, EnumId, FunctionId, ItemContainerId, Lookup, ModuleDefId, StaticId, + StructId, }; use hir_expand::{ name::{AsName, Name}, @@ -198,7 +199,7 @@ fn allowed(&self, id: AttrDefId, allow_name: &str, recursing: bool) -> bool { fn validate_func(&mut self, func: FunctionId) { let data = self.db.function_data(func); - if data.is_in_extern_block() { + if matches!(func.lookup(self.db.upcast()).container, ItemContainerId::ExternBlockId(_)) { cov_mark::hit!(extern_func_incorrect_case_ignored); return; }