mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 20:31:59 +00:00
Differentiate between asm!(), global_asm!() and naked_asm!(), and make only asm!() unsafe
This commit is contained in:
parent
edb804a100
commit
bd8087e86e
16 changed files with 198 additions and 16 deletions
|
|
@ -409,7 +409,8 @@ OffsetOfExpr =
|
|||
// global_asm := "global_asm!(" format_string *("," format_string) *("," operand) [","] ")"
|
||||
// format_string := STRING_LITERAL / RAW_STRING_LITERAL
|
||||
AsmExpr =
|
||||
Attr* 'builtin' '#' 'asm' '(' template:(Expr (',' Expr)*) (AsmPiece (',' AsmPiece)*)? ','? ')'
|
||||
Attr* 'builtin' '#' ( 'asm' | 'global_asm' | 'naked_asm' )
|
||||
'(' template:(Expr (',' Expr)*) (AsmPiece (',' AsmPiece)*)? ','? ')'
|
||||
|
||||
// operand_expr := expr / "_" / expr "=>" expr / expr "=>" "_"
|
||||
AsmOperandExpr = in_expr:Expr ('=>' out_expr:Expr)?
|
||||
|
|
|
|||
|
|
@ -118,6 +118,14 @@ impl AsmExpr {
|
|||
pub fn asm_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![asm]) }
|
||||
#[inline]
|
||||
pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) }
|
||||
#[inline]
|
||||
pub fn global_asm_token(&self) -> Option<SyntaxToken> {
|
||||
support::token(&self.syntax, T![global_asm])
|
||||
}
|
||||
#[inline]
|
||||
pub fn naked_asm_token(&self) -> Option<SyntaxToken> {
|
||||
support::token(&self.syntax, T![naked_asm])
|
||||
}
|
||||
}
|
||||
pub struct AsmLabel {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue