Skip to content

Commit 74d2c45

Browse files
committed
Remove unsafe from naked_asm! blocks
This was changed in a recent nightly so the unsafety is only in the attribute, `#[unsafe(naked)]`.
1 parent 6675cd1 commit 74d2c45

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

compiler-builtins/src/aarch64_linux.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ macro_rules! compare_and_swap {
136136
expected: int_ty!($bytes), desired: int_ty!($bytes), ptr: *mut int_ty!($bytes)
137137
) -> int_ty!($bytes) {
138138
// We can't use `AtomicI8::compare_and_swap`; we *are* compare_and_swap.
139-
unsafe { core::arch::naked_asm! {
139+
core::arch::naked_asm! {
140140
// UXT s(tmp0), s(0)
141141
concat!(uxt!($bytes), " ", reg!($bytes, 16), ", ", reg!($bytes, 0)),
142142
"0:",
@@ -150,7 +150,7 @@ macro_rules! compare_and_swap {
150150
"cbnz w17, 0b",
151151
"1:",
152152
"ret",
153-
} }
153+
}
154154
}
155155
}
156156
};
@@ -165,7 +165,7 @@ macro_rules! compare_and_swap_i128 {
165165
pub unsafe extern "C" fn $name (
166166
expected: i128, desired: i128, ptr: *mut i128
167167
) -> i128 {
168-
unsafe { core::arch::naked_asm! {
168+
core::arch::naked_asm! {
169169
"mov x16, x0",
170170
"mov x17, x1",
171171
"0:",
@@ -179,7 +179,7 @@ macro_rules! compare_and_swap_i128 {
179179
"cbnz w15, 0b",
180180
"1:",
181181
"ret",
182-
} }
182+
}
183183
}
184184
}
185185
};
@@ -194,7 +194,7 @@ macro_rules! swap {
194194
pub unsafe extern "C" fn $name (
195195
left: int_ty!($bytes), right_ptr: *mut int_ty!($bytes)
196196
) -> int_ty!($bytes) {
197-
unsafe { core::arch::naked_asm! {
197+
core::arch::naked_asm! {
198198
// mov s(tmp0), s(0)
199199
concat!("mov ", reg!($bytes, 16), ", ", reg!($bytes, 0)),
200200
"0:",
@@ -204,7 +204,7 @@ macro_rules! swap {
204204
concat!(stxr!($ordering, $bytes), " w17, ", reg!($bytes, 16), ", [x1]"),
205205
"cbnz w17, 0b",
206206
"ret",
207-
} }
207+
}
208208
}
209209
}
210210
};
@@ -219,7 +219,7 @@ macro_rules! fetch_op {
219219
pub unsafe extern "C" fn $name (
220220
val: int_ty!($bytes), ptr: *mut int_ty!($bytes)
221221
) -> int_ty!($bytes) {
222-
unsafe { core::arch::naked_asm! {
222+
core::arch::naked_asm! {
223223
// mov s(tmp0), s(0)
224224
concat!("mov ", reg!($bytes, 16), ", ", reg!($bytes, 0)),
225225
"0:",
@@ -231,7 +231,7 @@ macro_rules! fetch_op {
231231
concat!(stxr!($ordering, $bytes), " w15, ", reg!($bytes, 17), ", [x1]"),
232232
"cbnz w15, 0b",
233233
"ret",
234-
} }
234+
}
235235
}
236236
}
237237
}

compiler-builtins/src/macros.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,12 @@ macro_rules! intrinsics {
436436
// FIXME: when bootstrap supports `#[unsafe(naked)]` this duplication can be removed
437437
#[cfg(bootstrap)]
438438
#[naked]
439+
#[allow(unused_unsafe)]
439440
$(#[$($attr)*])*
440441
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
441442
#[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]
442443
pub unsafe extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
443-
$($body)*
444+
unsafe { $($body)* }
444445
}
445446

446447
#[cfg(not(bootstrap))]

0 commit comments

Comments
 (0)