diff --git a/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs b/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs index 8ee6f6792e9..46e627eaa00 100644 --- a/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs +++ b/tests/assembly/aarch64-naked-fn-no-bti-prolog.rs @@ -5,7 +5,7 @@ #![crate_type = "lib"] #![feature(naked_functions)] -use std::arch::asm; +use std::arch::naked_asm; // The problem at hand: Rust has adopted a fairly strict meaning for "naked functions", // meaning "no prologue whatsoever, no, really, not one instruction." @@ -17,5 +17,5 @@ pub unsafe extern "C" fn _hlt() -> ! { // CHECK-NOT: hint #34 // CHECK: hlt #0x1 - asm!("hlt #1", options(noreturn)) + naked_asm!("hlt #1") } diff --git a/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs b/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs index a5683874182..54e1d93c68b 100644 --- a/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs +++ b/tests/assembly/x86_64-naked-fn-no-cet-prolog.rs @@ -5,7 +5,7 @@ #![crate_type = "lib"] #![feature(naked_functions)] -use std::arch::asm; +use std::arch::naked_asm; // The problem at hand: Rust has adopted a fairly strict meaning for "naked functions", // meaning "no prologue whatsoever, no, really, not one instruction." @@ -17,7 +17,7 @@ pub unsafe extern "sysv64" fn will_halt() -> ! { // CHECK-NOT: endbr{{32|64}} // CHECK: hlt - asm!("hlt", options(noreturn)) + naked_asm!("hlt") } // what about aarch64? diff --git a/tests/codegen/cffi/c-variadic-naked.rs b/tests/codegen/cffi/c-variadic-naked.rs index 807873ea368..24b69c5f59e 100644 --- a/tests/codegen/cffi/c-variadic-naked.rs +++ b/tests/codegen/cffi/c-variadic-naked.rs @@ -12,8 +12,7 @@ pub unsafe extern "C" fn c_variadic(_: usize, _: ...) { // CHECK-NOT: va_start // CHECK-NOT: alloca - core::arch::asm! { + core::arch::naked_asm! { "ret", - options(noreturn), } } diff --git a/tests/crashes/124375.rs b/tests/crashes/124375.rs index 7165655178d..1d877caeb8b 100644 --- a/tests/crashes/124375.rs +++ b/tests/crashes/124375.rs @@ -3,9 +3,9 @@ //@ only-x86_64 #![crate_type = "lib"] #![feature(naked_functions)] -use std::arch::asm; +use std::arch::naked_asm; #[naked] pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize { - asm!("lea rax, [rdi + rsi]", "ret", options(noreturn)); + naked_asm!("lea rax, [rdi + rsi]", "ret"); } diff --git a/tests/run-make/naked-symbol-visibility/a_rust_dylib.rs b/tests/run-make/naked-symbol-visibility/a_rust_dylib.rs index f00123f006b..517c8da656a 100644 --- a/tests/run-make/naked-symbol-visibility/a_rust_dylib.rs +++ b/tests/run-make/naked-symbol-visibility/a_rust_dylib.rs @@ -1,7 +1,7 @@ #![feature(naked_functions, asm_const, linkage)] #![crate_type = "dylib"] -use std::arch::asm; +use std::arch::naked_asm; pub trait TraitWithConst { const COUNT: u32; @@ -28,7 +28,7 @@ extern "C" fn private_vanilla() -> u32 { #[naked] extern "C" fn private_naked() -> u32 { - unsafe { asm!("mov rax, 42", "ret", options(noreturn)) } + unsafe { naked_asm!("mov rax, 42", "ret") } } #[no_mangle] @@ -39,7 +39,7 @@ pub extern "C" fn public_vanilla() -> u32 { #[naked] #[no_mangle] pub extern "C" fn public_naked() -> u32 { - unsafe { asm!("mov rax, 42", "ret", options(noreturn)) } + unsafe { naked_asm!("mov rax, 42", "ret") } } pub extern "C" fn public_vanilla_generic() -> u32 { @@ -48,7 +48,7 @@ pub extern "C" fn public_vanilla_generic() -> u32 { #[naked] pub extern "C" fn public_naked_generic() -> u32 { - unsafe { asm!("mov rax, {}", "ret", const T::COUNT, options(noreturn)) } + unsafe { naked_asm!("mov rax, {}", "ret", const T::COUNT) } } #[linkage = "external"] @@ -59,7 +59,7 @@ extern "C" fn vanilla_external_linkage() -> u32 { #[naked] #[linkage = "external"] extern "C" fn naked_external_linkage() -> u32 { - unsafe { asm!("mov rax, 42", "ret", options(noreturn)) } + unsafe { naked_asm!("mov rax, 42", "ret") } } #[cfg(not(windows))] @@ -72,7 +72,7 @@ extern "C" fn vanilla_weak_linkage() -> u32 { #[cfg(not(windows))] #[linkage = "weak"] extern "C" fn naked_weak_linkage() -> u32 { - unsafe { asm!("mov rax, 42", "ret", options(noreturn)) } + unsafe { naked_asm!("mov rax, 42", "ret", options(noreturn)) } } // functions that are declared in an `extern "C"` block are currently not exported diff --git a/tests/ui/feature-gates/feature-gate-naked_functions.stderr b/tests/ui/feature-gates/feature-gate-naked_functions.stderr index 5fecc218a16..709234eb023 100644 --- a/tests/ui/feature-gates/feature-gate-naked_functions.stderr +++ b/tests/ui/feature-gates/feature-gate-naked_functions.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'naked_functions' --> $DIR/feature-gate-naked_functions.rs:9:5 | -LL | naked_asm!("", options(noreturn)) +LL | naked_asm!("") | ^^^^^^^^^ | = note: see issue #90957 for more information @@ -11,7 +11,7 @@ LL | naked_asm!("", options(noreturn)) error[E0658]: use of unstable library feature 'naked_functions' --> $DIR/feature-gate-naked_functions.rs:17:5 | -LL | naked_asm!("", options(noreturn)) +LL | naked_asm!("") | ^^^^^^^^^ | = note: see issue #90957 for more information @@ -51,16 +51,16 @@ LL | use std::arch::naked_asm; error[E0133]: use of inline assembly is unsafe and requires unsafe function or block --> $DIR/feature-gate-naked_functions.rs:9:5 | -LL | naked_asm!("", options(noreturn)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of inline assembly +LL | naked_asm!("") + | ^^^^^^^^^^^^^^ use of inline assembly | = note: inline assembly is entirely unchecked and can cause undefined behavior error[E0133]: use of inline assembly is unsafe and requires unsafe function or block --> $DIR/feature-gate-naked_functions.rs:17:5 | -LL | naked_asm!("", options(noreturn)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of inline assembly +LL | naked_asm!("") + | ^^^^^^^^^^^^^^ use of inline assembly | = note: inline assembly is entirely unchecked and can cause undefined behavior diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.rs b/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.rs index 0c73b9abf35..0e85515fd10 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.rs +++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.rs @@ -1,14 +1,14 @@ //@ needs-asm-support #![feature(naked_functions)] -use std::arch::asm; +use std::arch::naked_asm; #[track_caller] //~ ERROR [E0736] //~^ ERROR `#[track_caller]` requires Rust ABI #[naked] extern "C" fn f() { unsafe { - asm!("", options(noreturn)); + naked_asm!(""); } } @@ -20,7 +20,7 @@ impl S { #[naked] extern "C" fn g() { unsafe { - asm!("", options(noreturn)); + naked_asm!(""); } } }