disallow naked_asm! outside of #[naked] functions

This commit is contained in:
Folkert de Vries 2024-09-10 14:42:17 +02:00
parent 26b2b8d162
commit 6ca5ec7b4e
11 changed files with 132 additions and 16 deletions

View file

@ -2418,11 +2418,22 @@ impl InlineAsmOperand {
}
}
#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic)]
pub enum AsmMacro {
/// The `asm!` macro
Asm,
/// The `global_asm!` macro
GlobalAsm,
/// The `naked_asm!` macro
NakedAsm,
}
/// Inline assembly.
///
/// E.g., `asm!("NOP");`.
#[derive(Clone, Encodable, Decodable, Debug)]
pub struct InlineAsm {
pub asm_macro: AsmMacro,
pub template: Vec<InlineAsmTemplatePiece>,
pub template_strs: Box<[(Symbol, Option<Symbol>, Span)]>,
pub operands: Vec<(InlineAsmOperand, Span)>,