Skip to content

Commit 913fcf5

Browse files
committed
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.
1 parent 4bebfae commit 913fcf5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/asm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ enum ConstraintOrRegister {
107107

108108

109109
impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
110-
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>)>) {
110+
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>)>) {
111111
if options.contains(InlineAsmOptions::MAY_UNWIND) {
112112
self.sess()
113113
.create_err(UnwindingInlineAsm { span: span[0] })
@@ -173,7 +173,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
173173
let is_target_supported = reg.reg_class().supported_types(asm_arch).iter()
174174
.any(|&(_, feature)| {
175175
if let Some(feature) = feature {
176-
self.tcx.sess.target_features.contains(&feature)
176+
self.tcx.asm_target_features(instance.def_id()).contains(&feature)
177177
} else {
178178
true // Register class is unconditionally supported
179179
}

0 commit comments

Comments
 (0)