Skip to content

Commit 06dfdbe

Browse files
committed
more asm! -> naked_asm! in tests
1 parent 05c9802 commit 06dfdbe

File tree

7 files changed

+22
-23
lines changed

7 files changed

+22
-23
lines changed

Diff for: tests/assembly/aarch64-naked-fn-no-bti-prolog.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#![crate_type = "lib"]
77
#![feature(naked_functions)]
8-
use std::arch::asm;
8+
use std::arch::naked_asm;
99

1010
// The problem at hand: Rust has adopted a fairly strict meaning for "naked functions",
1111
// meaning "no prologue whatsoever, no, really, not one instruction."
@@ -17,5 +17,5 @@ use std::arch::asm;
1717
pub unsafe extern "C" fn _hlt() -> ! {
1818
// CHECK-NOT: hint #34
1919
// CHECK: hlt #0x1
20-
asm!("hlt #1", options(noreturn))
20+
naked_asm!("hlt #1")
2121
}

Diff for: tests/assembly/x86_64-naked-fn-no-cet-prolog.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#![crate_type = "lib"]
77
#![feature(naked_functions)]
8-
use std::arch::asm;
8+
use std::arch::naked_asm;
99

1010
// The problem at hand: Rust has adopted a fairly strict meaning for "naked functions",
1111
// meaning "no prologue whatsoever, no, really, not one instruction."
@@ -17,7 +17,7 @@ use std::arch::asm;
1717
pub unsafe extern "sysv64" fn will_halt() -> ! {
1818
// CHECK-NOT: endbr{{32|64}}
1919
// CHECK: hlt
20-
asm!("hlt", options(noreturn))
20+
naked_asm!("hlt")
2121
}
2222

2323
// what about aarch64?

Diff for: tests/codegen/cffi/c-variadic-naked.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
pub unsafe extern "C" fn c_variadic(_: usize, _: ...) {
1313
// CHECK-NOT: va_start
1414
// CHECK-NOT: alloca
15-
core::arch::asm! {
15+
core::arch::naked_asm! {
1616
"ret",
17-
options(noreturn),
1817
}
1918
}

Diff for: tests/crashes/124375.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
//@ only-x86_64
44
#![crate_type = "lib"]
55
#![feature(naked_functions)]
6-
use std::arch::asm;
6+
use std::arch::naked_asm;
77

88
#[naked]
99
pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize {
10-
asm!("lea rax, [rdi + rsi]", "ret", options(noreturn));
10+
naked_asm!("lea rax, [rdi + rsi]", "ret");
1111
}

Diff for: tests/run-make/naked-symbol-visibility/a_rust_dylib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(naked_functions, asm_const, linkage)]
22
#![crate_type = "dylib"]
33

4-
use std::arch::asm;
4+
use std::arch::naked_asm;
55

66
pub trait TraitWithConst {
77
const COUNT: u32;
@@ -28,7 +28,7 @@ extern "C" fn private_vanilla() -> u32 {
2828

2929
#[naked]
3030
extern "C" fn private_naked() -> u32 {
31-
unsafe { asm!("mov rax, 42", "ret", options(noreturn)) }
31+
unsafe { naked_asm!("mov rax, 42", "ret") }
3232
}
3333

3434
#[no_mangle]
@@ -39,7 +39,7 @@ pub extern "C" fn public_vanilla() -> u32 {
3939
#[naked]
4040
#[no_mangle]
4141
pub extern "C" fn public_naked() -> u32 {
42-
unsafe { asm!("mov rax, 42", "ret", options(noreturn)) }
42+
unsafe { naked_asm!("mov rax, 42", "ret") }
4343
}
4444

4545
pub extern "C" fn public_vanilla_generic<T: TraitWithConst>() -> u32 {
@@ -48,7 +48,7 @@ pub extern "C" fn public_vanilla_generic<T: TraitWithConst>() -> u32 {
4848

4949
#[naked]
5050
pub extern "C" fn public_naked_generic<T: TraitWithConst>() -> u32 {
51-
unsafe { asm!("mov rax, {}", "ret", const T::COUNT, options(noreturn)) }
51+
unsafe { naked_asm!("mov rax, {}", "ret", const T::COUNT) }
5252
}
5353

5454
#[linkage = "external"]
@@ -59,7 +59,7 @@ extern "C" fn vanilla_external_linkage() -> u32 {
5959
#[naked]
6060
#[linkage = "external"]
6161
extern "C" fn naked_external_linkage() -> u32 {
62-
unsafe { asm!("mov rax, 42", "ret", options(noreturn)) }
62+
unsafe { naked_asm!("mov rax, 42", "ret") }
6363
}
6464

6565
#[cfg(not(windows))]
@@ -72,7 +72,7 @@ extern "C" fn vanilla_weak_linkage() -> u32 {
7272
#[cfg(not(windows))]
7373
#[linkage = "weak"]
7474
extern "C" fn naked_weak_linkage() -> u32 {
75-
unsafe { asm!("mov rax, 42", "ret", options(noreturn)) }
75+
unsafe { naked_asm!("mov rax, 42", "ret", options(noreturn)) }
7676
}
7777

7878
// functions that are declared in an `extern "C"` block are currently not exported

Diff for: tests/ui/feature-gates/feature-gate-naked_functions.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0658]: use of unstable library feature 'naked_functions'
22
--> $DIR/feature-gate-naked_functions.rs:9:5
33
|
4-
LL | naked_asm!("", options(noreturn))
4+
LL | naked_asm!("")
55
| ^^^^^^^^^
66
|
77
= note: see issue #90957 <https://github.com/rust-lang/rust/issues/90957> for more information
@@ -11,7 +11,7 @@ LL | naked_asm!("", options(noreturn))
1111
error[E0658]: use of unstable library feature 'naked_functions'
1212
--> $DIR/feature-gate-naked_functions.rs:17:5
1313
|
14-
LL | naked_asm!("", options(noreturn))
14+
LL | naked_asm!("")
1515
| ^^^^^^^^^
1616
|
1717
= note: see issue #90957 <https://github.com/rust-lang/rust/issues/90957> for more information
@@ -51,16 +51,16 @@ LL | use std::arch::naked_asm;
5151
error[E0133]: use of inline assembly is unsafe and requires unsafe function or block
5252
--> $DIR/feature-gate-naked_functions.rs:9:5
5353
|
54-
LL | naked_asm!("", options(noreturn))
55-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of inline assembly
54+
LL | naked_asm!("")
55+
| ^^^^^^^^^^^^^^ use of inline assembly
5656
|
5757
= note: inline assembly is entirely unchecked and can cause undefined behavior
5858

5959
error[E0133]: use of inline assembly is unsafe and requires unsafe function or block
6060
--> $DIR/feature-gate-naked_functions.rs:17:5
6161
|
62-
LL | naked_asm!("", options(noreturn))
63-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of inline assembly
62+
LL | naked_asm!("")
63+
| ^^^^^^^^^^^^^^ use of inline assembly
6464
|
6565
= note: inline assembly is entirely unchecked and can cause undefined behavior
6666

Diff for: tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//@ needs-asm-support
22
#![feature(naked_functions)]
33

4-
use std::arch::asm;
4+
use std::arch::naked_asm;
55

66
#[track_caller] //~ ERROR [E0736]
77
//~^ ERROR `#[track_caller]` requires Rust ABI
88
#[naked]
99
extern "C" fn f() {
1010
unsafe {
11-
asm!("", options(noreturn));
11+
naked_asm!("");
1212
}
1313
}
1414

@@ -20,7 +20,7 @@ impl S {
2020
#[naked]
2121
extern "C" fn g() {
2222
unsafe {
23-
asm!("", options(noreturn));
23+
naked_asm!("");
2424
}
2525
}
2626
}

0 commit comments

Comments
 (0)