mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Make asm_experimental_arch work in allow_internal_unstable macros
This commit is contained in:
@@ -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",
|
||||
);
|
||||
Reference in New Issue
Block a user