Skip to content

Commit 0e05aa5

Browse files
Rollup merge of rust-lang#136890 - saethlin:swap_nonoverlapping, r=RalfJung
Change swap_nonoverlapping from lang to library UB The implementation of ptr::swap_nonoverlapping does not always escalate its safety contract to language UB, so it should be `check_library_ub`. Fixes rust-lang/miri#4188
2 parents b2adc75 + 3715d9e commit 0e05aa5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: core/src/ptr/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ pub const unsafe fn swap<T>(x: *mut T, y: *mut T) {
10701070
#[rustc_diagnostic_item = "ptr_swap_nonoverlapping"]
10711071
pub const unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
10721072
ub_checks::assert_unsafe_precondition!(
1073-
check_language_ub,
1073+
check_library_ub,
10741074
"ptr::swap_nonoverlapping requires that both pointer arguments are aligned and non-null \
10751075
and the specified memory ranges do not overlap",
10761076
(

0 commit comments

Comments
 (0)