Skip to content

Commit e6d92ad

Browse files
authored
Merge pull request #4336 from rust-lang/rustup-2025-05-21
Automatic Rustup
2 parents f9e968e + fa28571 commit e6d92ad

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a8e4c68dcb4dc1e48a0db294c5323cab0227fcb9
1+
2b96ddca1272960623e41829439df8dae82d20af
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
#![feature(intrinsics)]
2-
3-
// Directly call intrinsic to avoid debug assertions in libstd
4-
#[rustc_intrinsic]
5-
unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
1+
#![feature(core_intrinsics)]
62

73
fn main() {
84
let mut data = [0u8; 16];
95
unsafe {
106
let a = data.as_mut_ptr();
117
let b = a.wrapping_offset(1) as *mut _;
12-
copy_nonoverlapping(a, b, 2); //~ ERROR: `copy_nonoverlapping` called on overlapping ranges
8+
// Directly call intrinsic to avoid debug assertions in the `std::ptr` version.
9+
std::intrinsics::copy_nonoverlapping(a, b, 2); //~ ERROR: `copy_nonoverlapping` called on overlapping ranges
1310
}
1411
}

tests/fail/intrinsics/copy_overlapping.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: `copy_nonoverlapping` called on overlapping ranges
22
--> tests/fail/intrinsics/copy_overlapping.rs:LL:CC
33
|
4-
LL | copy_nonoverlapping(a, b, 2);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `copy_nonoverlapping` called on overlapping ranges
4+
LL | std::intrinsics::copy_nonoverlapping(a, b, 2);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `copy_nonoverlapping` called on overlapping ranges
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
#![feature(intrinsics)]
2-
3-
// Directly call intrinsic to avoid debug assertions in libstd
4-
#[rustc_intrinsic]
5-
unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
1+
#![feature(core_intrinsics)]
62

73
fn main() {
84
let mut data = [0u16; 8];
95
let ptr = (&mut data[0] as *mut u16 as *mut u8).wrapping_add(1) as *mut u16;
106
// Even copying 0 elements to something unaligned should error
117
unsafe {
12-
copy_nonoverlapping(&data[5], ptr, 0); //~ ERROR: accessing memory with alignment 1, but alignment 2 is required
8+
// Directly call intrinsic to avoid debug assertions in the `std::ptr` version.
9+
std::intrinsics::copy_nonoverlapping(&data[5], ptr, 0); //~ ERROR: accessing memory with alignment 1, but alignment 2 is required
1310
}
1411
}

tests/fail/intrinsics/copy_unaligned.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: accessing memory with alignment ALIGN, but alignment ALIGN is required
22
--> tests/fail/intrinsics/copy_unaligned.rs:LL:CC
33
|
4-
LL | copy_nonoverlapping(&data[5], ptr, 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment ALIGN, but alignment ALIGN is required
4+
LL | std::intrinsics::copy_nonoverlapping(&data[5], ptr, 0);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment ALIGN, but alignment ALIGN is required
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

0 commit comments

Comments
 (0)