#[test]
#[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_iterator_step_by_zero() {
let mut it = (0..).step_by(0);
it.next();
#[test]
#[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_rposition_panic() {
let v: [(Box<_>, Box<_>); 4] =
[(box 0, box 0), (box 0, box 0),
}
#[test] #[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_option_too_much_dance() {
struct A;
let mut y = Some(A);
#[test]
#[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_unwrap_panic1() {
let x: Option<isize> = None;
x.unwrap();
#[test]
#[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_unwrap_panic2() {
let x: Option<String> = None;
x.unwrap();
#[test]
#[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
pub fn test_unwrap_or_else_panic() {
fn handler(msg: &'static str) -> isize {
if msg == "I got this." {
}
#[test]
#[should_panic(expected="Got expected error: \"All good\"")]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
pub fn test_expect_err() {
let err: Result<isize, &'static str> = Err("All good");
err.expect("Got expected error");
}
#[test]
#[should_panic(expected="Got expected ok: \"All good\"")]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
pub fn test_expect_err_ok() {
let err: Result<&'static str, isize> = Ok("All good");
err.expect_err("Got expected ok");
// to be used in `should_panic`)
#[test]
#[should_panic(expected = "out of range")]
- #[cfg(not(miri))]
+ #[cfg(not(miri))] // Miri does not support panics
fn assert_range_eq_can_fail_by_panic() {
assert_range_eq!([0, 1, 2], 0..5, [0, 1, 2]);
}
// to be used in `should_panic`)
#[test]
#[should_panic(expected = "==")]
- #[cfg(not(miri))]
+ #[cfg(not(miri))] // Miri does not support panics
fn assert_range_eq_can_fail_by_inequality() {
assert_range_eq!([0, 1, 2], 0..2, [0, 1, 2]);
}
#[test]
#[should_panic(expected = $expect_msg)]
- #[cfg(not(miri))]
+ #[cfg(not(miri))] // Miri does not support panics
fn index_fail() {
let v = $data;
let v: &[_] = &v;
#[test]
#[should_panic(expected = $expect_msg)]
- #[cfg(not(miri))]
+ #[cfg(not(miri))] // Miri does not support panics
fn index_mut_fail() {
let mut v = $data;
let v: &mut [_] = &mut v;
#[test]
#[should_panic(expected = "src is out of bounds")]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_copy_within_panics_src_too_long() {
let mut bytes = *b"Hello, World!";
// The length is only 13, so 14 is out of bounds.
#[test]
#[should_panic(expected = "dest is out of bounds")]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_copy_within_panics_dest_too_long() {
let mut bytes = *b"Hello, World!";
// The length is only 13, so a slice of length 4 starting at index 10 is out of bounds.
}
#[test]
#[should_panic(expected = "src end is before src start")]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
fn test_copy_within_panics_src_inverted() {
let mut bytes = *b"Hello, World!";
// 2 is greater than 1, so this range is invalid.