mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 18:43:01 +00:00
Merge pull request #20210 from ChayimFriedman2/naked-asm-safe
fix: Inline asm fixes
This commit is contained in:
commit
e9968fc555
28 changed files with 303 additions and 84 deletions
|
|
@ -7,7 +7,7 @@ use either::Either;
|
|||
use hir_def::{
|
||||
AdtId, DefWithBodyId, FieldId, FunctionId, VariantId,
|
||||
expr_store::{Body, path::Path},
|
||||
hir::{AsmOperand, Expr, ExprId, ExprOrPatId, Pat, PatId, Statement, UnaryOp},
|
||||
hir::{AsmOperand, Expr, ExprId, ExprOrPatId, InlineAsmKind, Pat, PatId, Statement, UnaryOp},
|
||||
resolver::{HasResolver, ResolveValueResult, Resolver, ValueNs},
|
||||
signatures::StaticFlags,
|
||||
type_ref::Rawness,
|
||||
|
|
@ -315,7 +315,12 @@ impl<'db> UnsafeVisitor<'db> {
|
|||
self.inside_assignment = old_inside_assignment;
|
||||
}
|
||||
Expr::InlineAsm(asm) => {
|
||||
self.on_unsafe_op(current.into(), UnsafetyReason::InlineAsm);
|
||||
if asm.kind == InlineAsmKind::Asm {
|
||||
// `naked_asm!()` requires `unsafe` on the attribute (`#[unsafe(naked)]`),
|
||||
// and `global_asm!()` doesn't require it at all.
|
||||
self.on_unsafe_op(current.into(), UnsafetyReason::InlineAsm);
|
||||
}
|
||||
|
||||
asm.operands.iter().for_each(|(_, op)| match op {
|
||||
AsmOperand::In { expr, .. }
|
||||
| AsmOperand::Out { expr: Some(expr), .. }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue