Skip to content

Commit 26ade1c

Browse files
committed
mark failures expected due to panics
1 parent e544947 commit 26ade1c

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/libcore/tests/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fn test_iterator_step_by_nth_overflow() {
255255

256256
#[test]
257257
#[should_panic]
258-
#[cfg(not(miri))]
258+
#[cfg(not(miri))] // Miri does not support panics
259259
fn test_iterator_step_by_zero() {
260260
let mut it = (0..).step_by(0);
261261
it.next();
@@ -1417,7 +1417,7 @@ fn test_rposition() {
14171417

14181418
#[test]
14191419
#[should_panic]
1420-
#[cfg(not(miri))]
1420+
#[cfg(not(miri))] // Miri does not support panics
14211421
fn test_rposition_panic() {
14221422
let v: [(Box<_>, Box<_>); 4] =
14231423
[(box 0, box 0), (box 0, box 0),

src/libcore/tests/option.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn test_option_dance() {
6969
}
7070

7171
#[test] #[should_panic]
72-
#[cfg(not(miri))]
72+
#[cfg(not(miri))] // Miri does not support panics
7373
fn test_option_too_much_dance() {
7474
struct A;
7575
let mut y = Some(A);
@@ -130,15 +130,15 @@ fn test_unwrap() {
130130

131131
#[test]
132132
#[should_panic]
133-
#[cfg(not(miri))]
133+
#[cfg(not(miri))] // Miri does not support panics
134134
fn test_unwrap_panic1() {
135135
let x: Option<isize> = None;
136136
x.unwrap();
137137
}
138138

139139
#[test]
140140
#[should_panic]
141-
#[cfg(not(miri))]
141+
#[cfg(not(miri))] // Miri does not support panics
142142
fn test_unwrap_panic2() {
143143
let x: Option<String> = None;
144144
x.unwrap();

src/libcore/tests/result.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn test_unwrap_or_else() {
117117

118118
#[test]
119119
#[should_panic]
120-
#[cfg(not(miri))]
120+
#[cfg(not(miri))] // Miri does not support panics
121121
pub fn test_unwrap_or_else_panic() {
122122
fn handler(msg: &'static str) -> isize {
123123
if msg == "I got this." {
@@ -139,7 +139,7 @@ pub fn test_expect_ok() {
139139
}
140140
#[test]
141141
#[should_panic(expected="Got expected error: \"All good\"")]
142-
#[cfg(not(miri))]
142+
#[cfg(not(miri))] // Miri does not support panics
143143
pub fn test_expect_err() {
144144
let err: Result<isize, &'static str> = Err("All good");
145145
err.expect("Got expected error");
@@ -153,7 +153,7 @@ pub fn test_expect_err_err() {
153153
}
154154
#[test]
155155
#[should_panic(expected="Got expected ok: \"All good\"")]
156-
#[cfg(not(miri))]
156+
#[cfg(not(miri))] // Miri does not support panics
157157
pub fn test_expect_err_ok() {
158158
let err: Result<&'static str, isize> = Ok("All good");
159159
err.expect_err("Got expected ok");

src/libcore/tests/slice.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ mod slice_index {
782782
// to be used in `should_panic`)
783783
#[test]
784784
#[should_panic(expected = "out of range")]
785-
#[cfg(not(miri))]
785+
#[cfg(not(miri))] // Miri does not support panics
786786
fn assert_range_eq_can_fail_by_panic() {
787787
assert_range_eq!([0, 1, 2], 0..5, [0, 1, 2]);
788788
}
@@ -792,7 +792,7 @@ mod slice_index {
792792
// to be used in `should_panic`)
793793
#[test]
794794
#[should_panic(expected = "==")]
795-
#[cfg(not(miri))]
795+
#[cfg(not(miri))] // Miri does not support panics
796796
fn assert_range_eq_can_fail_by_inequality() {
797797
assert_range_eq!([0, 1, 2], 0..2, [0, 1, 2]);
798798
}
@@ -842,7 +842,7 @@ mod slice_index {
842842

843843
#[test]
844844
#[should_panic(expected = $expect_msg)]
845-
#[cfg(not(miri))]
845+
#[cfg(not(miri))] // Miri does not support panics
846846
fn index_fail() {
847847
let v = $data;
848848
let v: &[_] = &v;
@@ -851,7 +851,7 @@ mod slice_index {
851851

852852
#[test]
853853
#[should_panic(expected = $expect_msg)]
854-
#[cfg(not(miri))]
854+
#[cfg(not(miri))] // Miri does not support panics
855855
fn index_mut_fail() {
856856
let mut v = $data;
857857
let v: &mut [_] = &mut v;
@@ -1306,7 +1306,7 @@ fn test_copy_within() {
13061306

13071307
#[test]
13081308
#[should_panic(expected = "src is out of bounds")]
1309-
#[cfg(not(miri))]
1309+
#[cfg(not(miri))] // Miri does not support panics
13101310
fn test_copy_within_panics_src_too_long() {
13111311
let mut bytes = *b"Hello, World!";
13121312
// The length is only 13, so 14 is out of bounds.
@@ -1315,15 +1315,15 @@ fn test_copy_within_panics_src_too_long() {
13151315

13161316
#[test]
13171317
#[should_panic(expected = "dest is out of bounds")]
1318-
#[cfg(not(miri))]
1318+
#[cfg(not(miri))] // Miri does not support panics
13191319
fn test_copy_within_panics_dest_too_long() {
13201320
let mut bytes = *b"Hello, World!";
13211321
// The length is only 13, so a slice of length 4 starting at index 10 is out of bounds.
13221322
bytes.copy_within(0..4, 10);
13231323
}
13241324
#[test]
13251325
#[should_panic(expected = "src end is before src start")]
1326-
#[cfg(not(miri))]
1326+
#[cfg(not(miri))] // Miri does not support panics
13271327
fn test_copy_within_panics_src_inverted() {
13281328
let mut bytes = *b"Hello, World!";
13291329
// 2 is greater than 1, so this range is invalid.

0 commit comments

Comments
 (0)