Make asm_experimental_arch work in allow_internal_unstable macros

This commit is contained in:
daxpedda
2025-12-16 22:38:34 +01:00
parent 95a27adcf9
commit 96c165b111
3 changed files with 34 additions and 1 deletions
+9 -1
View File
@@ -52,7 +52,15 @@ pub(crate) fn lower_inline_asm(
| asm::InlineAsmArch::LoongArch64
| asm::InlineAsmArch::S390x
);
if !is_stable && !self.tcx.features().asm_experimental_arch() {
if !is_stable
&& !self.tcx.features().asm_experimental_arch()
&& sp
.ctxt()
.outer_expn_data()
.allow_internal_unstable
.filter(|features| features.contains(&sym::asm_experimental_arch))
.is_none()
{
feature_err(
&self.tcx.sess,
sym::asm_experimental_arch,
@@ -99,3 +99,10 @@ macro_rules! access_field_noallow {
macro_rules! pass_through_noallow {
($e: expr) => { $e }
}
#[stable(feature = "stable", since = "1.0.0")]
#[allow_internal_unstable(asm_experimental_arch)]
#[macro_export]
macro_rules! asm_redirect {
($($t:tt)*) => { core::arch::global_asm!($($t)*); }
}
@@ -0,0 +1,18 @@
//@ only-wasm32-wasip1
//@ compile-flags: --crate-type=lib
//@ build-pass
//@ aux-build:internal_unstable.rs
#[macro_use]
extern crate internal_unstable;
asm_redirect!(
"test:",
".globl test",
".functype test (i32) -> (i32)",
"local.get 0",
"i32.const 1",
"i32.add",
"end_function",
".export_name test, test",
);