Skip to content

Commit 0d15845

Browse files
committed
fix UB in a test
1 parent 5170a3f commit 0d15845

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/libcore/tests/ptr.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ fn test_as_ref() {
145145
}
146146

147147
#[test]
148-
#[cfg(not(miri))] // This test is UB according to Stacked Borrows
149148
fn test_as_mut() {
150149
unsafe {
151150
let p: *mut isize = null_mut();
@@ -164,7 +163,7 @@ fn test_as_mut() {
164163
// Pointers to unsized types -- slices
165164
let s: &mut [u8] = &mut [1, 2, 3];
166165
let ms: *mut [u8] = s;
167-
assert_eq!(ms.as_mut(), Some(s));
166+
assert_eq!(ms.as_mut().unwrap() as *mut _, s as *mut _);
168167

169168
let mz: *mut [u8] = &mut [];
170169
assert_eq!(mz.as_mut(), Some(&mut [][..]));

0 commit comments

Comments
 (0)