about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2023-08-04 16:09:54 +0100
committerAmanieu d'Antras <amanieu@gmail.com>2023-08-04 16:09:54 +0100
commit913fcf50ee2c4bb43b5ce7d71984be08eff3831e (patch)
tree89fff52d1d244ffb076bff05cb817df0fd68a41c /src
parent4bebfae44a40817df8b99a81b80bbb501c4d90c4 (diff)
downloadrust-913fcf50ee2c4bb43b5ce7d71984be08eff3831e.tar.gz
rust-913fcf50ee2c4bb43b5ce7d71984be08eff3831e.zip
Use `unstable_target_features` when checking inline assembly
This is necessary to properly validate register classes even when the
relevant target feature name is still unstable.
Diffstat (limited to 'src')
-rw-r--r--src/asm.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/asm.rs b/src/asm.rs
index 4c3b7f5036c..73908558cee 100644
--- a/src/asm.rs
+++ b/src/asm.rs
@@ -107,7 +107,7 @@ enum ConstraintOrRegister {
 
 
 impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
-    fn codegen_inline_asm(&mut self, template: &[InlineAsmTemplatePiece], rust_operands: &[InlineAsmOperandRef<'tcx, Self>], options: InlineAsmOptions, span: &[Span], _instance: Instance<'_>, _dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>) {
+    fn codegen_inline_asm(&mut self, template: &[InlineAsmTemplatePiece], rust_operands: &[InlineAsmOperandRef<'tcx, Self>], options: InlineAsmOptions, span: &[Span], instance: Instance<'_>, _dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>) {
         if options.contains(InlineAsmOptions::MAY_UNWIND) {
             self.sess()
                 .create_err(UnwindingInlineAsm { span: span[0] })
@@ -173,7 +173,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
                             let is_target_supported = reg.reg_class().supported_types(asm_arch).iter()
                                 .any(|&(_, feature)| {
                                     if let Some(feature) = feature {
-                                        self.tcx.sess.target_features.contains(&feature)
+                                        self.tcx.asm_target_features(instance.def_id()).contains(&feature)
                                     } else {
                                         true // Register class is unconditionally supported
                                     }