mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Introduce FunctionQualifier for hir::FunctionData
This commit is contained in:
parent
b9c172a977
commit
2bb8956a10
6 changed files with 45 additions and 17 deletions
|
@ -91,7 +91,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
|
|||
|
||||
fn validate_func(&mut self, func: FunctionId) {
|
||||
let data = self.db.function_data(func);
|
||||
if data.is_extern {
|
||||
if data.is_in_extern_block {
|
||||
cov_mark::hit!(extern_func_incorrect_case_ignored);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ impl<'a, 'b> UnsafeValidator<'a, 'b> {
|
|||
let def = self.owner.into();
|
||||
let unsafe_expressions = unsafe_expressions(db, self.infer.as_ref(), def);
|
||||
let is_unsafe = match self.owner {
|
||||
DefWithBodyId::FunctionId(it) => db.function_data(it).is_unsafe,
|
||||
DefWithBodyId::FunctionId(it) => db.function_data(it).qualifier.is_unsafe,
|
||||
DefWithBodyId::StaticId(_) | DefWithBodyId::ConstId(_) => false,
|
||||
};
|
||||
if is_unsafe
|
||||
|
@ -86,7 +86,7 @@ fn walk_unsafe(
|
|||
match expr {
|
||||
&Expr::Call { callee, .. } => {
|
||||
if let Some(func) = infer[callee].as_fn_def(db) {
|
||||
if db.function_data(func).is_unsafe {
|
||||
if db.function_data(func).qualifier.is_unsafe {
|
||||
unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block });
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ fn walk_unsafe(
|
|||
Expr::MethodCall { .. } => {
|
||||
if infer
|
||||
.method_resolution(current)
|
||||
.map(|func| db.function_data(func).is_unsafe)
|
||||
.map(|func| db.function_data(func).qualifier.is_unsafe)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue