Add asm label support to AST and HIR
This commit is contained in:
@@ -2645,6 +2645,9 @@ pub enum InlineAsmOperand<'hir> {
|
||||
path: QPath<'hir>,
|
||||
def_id: DefId,
|
||||
},
|
||||
Label {
|
||||
block: &'hir Block<'hir>,
|
||||
},
|
||||
}
|
||||
|
||||
impl<'hir> InlineAsmOperand<'hir> {
|
||||
@@ -2654,7 +2657,10 @@ impl<'hir> InlineAsmOperand<'hir> {
|
||||
| Self::Out { reg, .. }
|
||||
| Self::InOut { reg, .. }
|
||||
| Self::SplitInOut { reg, .. } => Some(reg),
|
||||
Self::Const { .. } | Self::SymFn { .. } | Self::SymStatic { .. } => None,
|
||||
Self::Const { .. }
|
||||
| Self::SymFn { .. }
|
||||
| Self::SymStatic { .. }
|
||||
| Self::Label { .. } => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2675,6 +2681,12 @@ pub struct InlineAsm<'hir> {
|
||||
pub line_spans: &'hir [Span],
|
||||
}
|
||||
|
||||
impl InlineAsm<'_> {
|
||||
pub fn contains_label(&self) -> bool {
|
||||
self.operands.iter().any(|x| matches!(x.0, InlineAsmOperand::Label { .. }))
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a parameter in a function header.
|
||||
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||
pub struct Param<'hir> {
|
||||
|
||||
Reference in New Issue
Block a user