about summary refs log tree commit diff
path: root/compiler/rustc_ast
diff options
context:
space:
mode:
authorGeorge Wort <george.wort@arm.com>2023-11-28 10:25:22 +0000
committerGeorge Wort <george.wort@arm.com>2023-11-28 10:37:19 +0000
commite0bfb615da4f48e08f0c86e1ce0e9af765d603fb (patch)
tree287b8649b558f5b491512de504ef622e233be17b /compiler/rustc_ast
parenta6b8ae582a89321e24ea942d9c3eb73229809487 (diff)
downloadrust-e0bfb615da4f48e08f0c86e1ce0e9af765d603fb.tar.gz
rust-e0bfb615da4f48e08f0c86e1ce0e9af765d603fb.zip
Name explicit registers in conflict register errors for inline assembly
Diffstat (limited to 'compiler/rustc_ast')
-rw-r--r--compiler/rustc_ast/src/ast.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index 83fe95f16f9..b9d959ab605 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -2237,6 +2237,18 @@ pub enum InlineAsmOperand {
     },
 }
 
+impl InlineAsmOperand {
+    pub fn reg(&self) -> Option<&InlineAsmRegOrRegClass> {
+        match self {
+            Self::In { reg, .. }
+            | Self::Out { reg, .. }
+            | Self::InOut { reg, .. }
+            | Self::SplitInOut { reg, .. } => Some(reg),
+            Self::Const { .. } | Self::Sym { .. } => None,
+        }
+    }
+}
+
 /// Inline assembly.
 ///
 /// E.g., `asm!("NOP");`.