Skip to content

Commit ee92ddf

Browse files
authored
Rollup merge of #72489 - nbdd0121:issue-72487, r=Amanieu
Fix ice-72487 Fixes #72487 r? @Amanieu
2 parents 3948e60 + e04baed commit ee92ddf

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/librustc_target/asm/mod.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,19 @@ impl InlineAsmReg {
223223
name: Symbol,
224224
) -> Result<Self, &'static str> {
225225
// FIXME: use direct symbol comparison for register names
226-
name.with(|name| {
227-
Ok(match arch {
228-
InlineAsmArch::X86 | InlineAsmArch::X86_64 => {
229-
Self::X86(X86InlineAsmReg::parse(arch, has_feature, name)?)
230-
}
231-
InlineAsmArch::Arm => Self::Arm(ArmInlineAsmReg::parse(arch, has_feature, name)?),
232-
InlineAsmArch::AArch64 => {
233-
Self::AArch64(AArch64InlineAsmReg::parse(arch, has_feature, name)?)
234-
}
235-
InlineAsmArch::RiscV32 | InlineAsmArch::RiscV64 => {
236-
Self::RiscV(RiscVInlineAsmReg::parse(arch, has_feature, name)?)
237-
}
238-
})
226+
// Use `Symbol::as_str` instead of `Symbol::with` here because `has_feature` may access `Symbol`.
227+
let name = name.as_str();
228+
Ok(match arch {
229+
InlineAsmArch::X86 | InlineAsmArch::X86_64 => {
230+
Self::X86(X86InlineAsmReg::parse(arch, has_feature, &name)?)
231+
}
232+
InlineAsmArch::Arm => Self::Arm(ArmInlineAsmReg::parse(arch, has_feature, &name)?),
233+
InlineAsmArch::AArch64 => {
234+
Self::AArch64(AArch64InlineAsmReg::parse(arch, has_feature, &name)?)
235+
}
236+
InlineAsmArch::RiscV32 | InlineAsmArch::RiscV64 => {
237+
Self::RiscV(RiscVInlineAsmReg::parse(arch, has_feature, &name)?)
238+
}
239239
})
240240
}
241241

0 commit comments

Comments
 (0)