Skip to content

Commit 5286060

Browse files
authored
Rollup merge of #62346 - RalfJung:miri-tests, r=Centril
enable a few more tests in Miri and update the comment for others
2 parents 72801ea + 4dd5edc commit 5286060

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

src/liballoc/tests/vec.rs

-1
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,6 @@ fn from_into_inner() {
761761
it.next().unwrap();
762762
let vec = it.collect::<Vec<_>>();
763763
assert_eq!(vec, [2, 3]);
764-
#[cfg(not(miri))] // Miri does not support comparing dangling pointers
765764
assert!(ptr != vec.as_ptr());
766765
}
767766

src/libcore/tests/fmt/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ mod float;
33
mod num;
44

55
#[test]
6-
#[cfg(not(miri))] // Miri cannot print pointers
76
fn test_format_flags() {
87
// No residual flags left by pointer formatting
98
let p = "".as_ptr();
@@ -13,7 +12,6 @@ fn test_format_flags() {
1312
}
1413

1514
#[test]
16-
#[cfg(not(miri))] // Miri cannot print pointers
1715
fn test_pointer_formats_data_pointer() {
1816
let b: &[u8] = b"";
1917
let s: &str = "";

src/libcore/tests/ptr.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ fn test_unsized_nonnull() {
253253

254254
#[test]
255255
#[allow(warnings)]
256-
#[cfg(not(miri))] // Miri cannot hash pointers
257256
// Have a symbol for the test below. It doesn’t need to be an actual variadic function, match the
258257
// ABI, or even point to an actual executable code, because the function itself is never invoked.
259258
#[no_mangle]
@@ -293,7 +292,7 @@ fn write_unaligned_drop() {
293292
}
294293

295294
#[test]
296-
#[cfg(not(miri))] // Miri cannot compute actual alignment of an allocation
295+
#[cfg(not(miri))] // Miri does not compute a maximal `mid` for `align_offset`
297296
fn align_offset_zst() {
298297
// For pointers of stride = 0, the pointer is already aligned or it cannot be aligned at
299298
// all, because no amount of elements will align the pointer.
@@ -308,7 +307,7 @@ fn align_offset_zst() {
308307
}
309308

310309
#[test]
311-
#[cfg(not(miri))] // Miri cannot compute actual alignment of an allocation
310+
#[cfg(not(miri))] // Miri does not compute a maximal `mid` for `align_offset`
312311
fn align_offset_stride1() {
313312
// For pointers of stride = 1, the pointer can always be aligned. The offset is equal to
314313
// number of bytes.

src/libcore/tests/slice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ pub mod memchr {
14151415
}
14161416

14171417
#[test]
1418-
#[cfg(not(miri))] // Miri cannot compute actual alignment of an allocation
1418+
#[cfg(not(miri))] // Miri does not compute a maximal `mid` for `align_offset`
14191419
fn test_align_to_simple() {
14201420
let bytes = [1u8, 2, 3, 4, 5, 6, 7];
14211421
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<u16>() };
@@ -1439,7 +1439,7 @@ fn test_align_to_zst() {
14391439
}
14401440

14411441
#[test]
1442-
#[cfg(not(miri))] // Miri cannot compute actual alignment of an allocation
1442+
#[cfg(not(miri))] // Miri does not compute a maximal `mid` for `align_offset`
14431443
fn test_align_to_non_trivial() {
14441444
#[repr(align(8))] struct U64(u64, u64);
14451445
#[repr(align(8))] struct U64U64U32(u64, u64, u32);

0 commit comments

Comments
 (0)