-#![cfg(not(miri))]
-
use core::cell::*;
use core::default::Default;
use std::mem::drop;
#[test]
#[should_panic]
+#[cfg(not(miri))] // Miri does not support panics
fn discard_doesnt_unborrow() {
let x = RefCell::new(0);
let _b = x.borrow();
#[test]
#[should_panic]
+#[cfg(not(miri))] // Miri does not support panics
fn refcell_swap_borrows() {
let x = RefCell::new(0);
let _b = x.borrow();
#[test]
#[should_panic]
+#[cfg(not(miri))] // Miri does not support panics
fn refcell_replace_borrows() {
let x = RefCell::new(0);
let _b = x.borrow();
}
#[test]
-#[cfg(not(miri))]
fn test_iterator_step_by_nth() {
let mut it = (0..16).step_by(5);
assert_eq!(it.nth(0), Some(0));
}
#[test]
-#[cfg(not(miri))]
fn test_iterator_step_by_nth_overflow() {
#[cfg(target_pointer_width = "8")]
type Bigger = u16;
}
#[test]
-#[cfg(not(miri))]
fn test_iterator_step_by_size_hint() {
struct StubSizeHint(usize, Option<usize>);
impl Iterator for StubSizeHint {
}
#[test]
-#[cfg(not(miri))]
fn test_range_step() {
#![allow(deprecated)]
assert_eq!((1..21).rev().step_by(5).collect::<Vec<isize>>(), [20, 15, 10, 5]);
assert_eq!((1..21).rev().step_by(6).collect::<Vec<isize>>(), [20, 14, 8, 2]);
assert_eq!((200..255).step_by(50).collect::<Vec<u8>>(), [200, 250]);
+ #[cfg(not(miri))] // Miri cannot compare empty slices
assert_eq!((200..-5).step_by(1).collect::<Vec<isize>>(), []);
+ #[cfg(not(miri))] // Miri cannot compare empty slices
assert_eq!((200..200).step_by(1).collect::<Vec<isize>>(), []);
assert_eq!((0..20).step_by(1).size_hint(), (20, Some(20)));
}
#[test]
-#[cfg(not(miri))]
fn test_step_by_skip() {
assert_eq!((0..640).step_by(128).skip(1).collect::<Vec<_>>(), [128, 256, 384, 512]);
assert_eq!((0..=50).step_by(10).nth(3), Some(30));
}
#[test]
-#[cfg(not(miri))]
fn test_range_inclusive_step() {
assert_eq!((0..=50).step_by(10).collect::<Vec<_>>(), [0, 10, 20, 30, 40, 50]);
assert_eq!((0..=5).step_by(1).collect::<Vec<_>>(), [0, 1, 2, 3, 4, 5]);
#[test]
#[cfg(not(target_arch = "wasm32"))]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support entropy
fn sort_unstable() {
use core::cmp::Ordering::{Equal, Greater, Less};
use core::slice::heapsort;
}
#[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri cannot compute actual alignment of an allocation
fn test_align_to_simple() {
let bytes = [1u8, 2, 3, 4, 5, 6, 7];
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<u16>() };
}
#[test]
-#[cfg(not(miri))]
fn test_align_to_zst() {
let bytes = [1, 2, 3, 4, 5, 6, 7];
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<()>() };
}
#[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri cannot compute actual alignment of an allocation
fn test_align_to_non_trivial() {
#[repr(align(8))] struct U64(u64, u64);
#[repr(align(8))] struct U64U64U32(u64, u64, u32);
}
#[test]
-#[cfg(not(miri))]
fn test_align_to_empty_mid() {
use core::mem;
-#![cfg(not(miri))]
-
use core::time::Duration;
#[test]
#[test]
#[should_panic]
+#[cfg(not(miri))] // Miri does not support panics
fn sub_bad1() {
let _ = Duration::new(0, 0) - Duration::new(0, 1);
}
#[test]
#[should_panic]
+#[cfg(not(miri))] // Miri does not support panics
fn sub_bad2() {
let _ = Duration::new(0, 0) - Duration::new(1, 0);
}
}
#[test]
+#[cfg(not(miri))] // FIXME: A bug in Miri breaks padding in string formatting
fn debug_formatting_precision_high() {
assert_eq!(format!("{:.5?}", Duration::new(0, 23_678)), "23.67800µs");