]> git.lizzy.rs Git - rust.git/commitdiff
review failures in binary_heap, str, vec_deque
authorRalf Jung <post@ralfj.de>
Wed, 13 Feb 2019 12:59:51 +0000 (13:59 +0100)
committerRalf Jung <post@ralfj.de>
Wed, 13 Feb 2019 17:21:13 +0000 (18:21 +0100)
src/liballoc/tests/arc.rs
src/liballoc/tests/binary_heap.rs
src/liballoc/tests/rc.rs
src/liballoc/tests/str.rs
src/liballoc/tests/vec_deque.rs

index 7c5a8926126e36dd3f63904aa6f9fabdc06a6170..2759b1b1cac2769696f43075f2ab6e756318cab1 100644 (file)
@@ -1,5 +1,3 @@
-#![cfg(not(miri))]
-
 use std::any::Any;
 use std::sync::{Arc, Weak};
 use std::cell::RefCell;
index c1a1c5d88781ffaa0ba7702c4307d66ab97be574..1d4a3edc1ac42c2d4e05f71df6bc43766ecd666f 100644 (file)
@@ -282,7 +282,7 @@ fn drain<'new>(d: Drain<'static, &'static str>) -> Drain<'new, &'new str> {
 //
 // Destructors must be called exactly once per element.
 #[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
 fn panic_safe() {
     static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
 
index 1be01d1a7ce1a1bbd279007e260df0651f85b7bf..18f82e804100823bec0e4e9c92dc55e7e444efd4 100644 (file)
@@ -1,5 +1,3 @@
-#![cfg(not(miri))]
-
 use std::any::Any;
 use std::rc::{Rc, Weak};
 use std::cell::RefCell;
index a1dc763f6d8ffc2d928b9f8185e912a37fb4a512..b33a56421888831bf0607d4832f77f92f84d5891 100644 (file)
@@ -31,7 +31,6 @@ fn test_rfind() {
 }
 
 #[test]
-#[cfg(not(miri))]
 fn test_collect() {
     let empty = "";
     let s: String = empty.chars().collect();
@@ -119,7 +118,6 @@ fn test_concat_for_different_types() {
 #[test]
 fn test_concat_for_different_lengths() {
     let empty: &[&str] = &[];
-    #[cfg(not(miri))]
     test_concat!("", empty);
     test_concat!("a", ["a"]);
     test_concat!("ab", ["a", "b"]);
@@ -148,7 +146,6 @@ fn test_join_for_different_types() {
 #[test]
 fn test_join_for_different_lengths() {
     let empty: &[&str] = &[];
-    #[cfg(not(miri))]
     test_join!("", empty, "-");
     test_join!("a", ["a"], "-");
     test_join!("a-b", ["a", "b"], "-");
@@ -162,7 +159,6 @@ fn test_join_for_different_lengths_with_long_separator() {
     assert_eq!("~~~~~".len(), 15);
 
     let empty: &[&str] = &[];
-    #[cfg(not(miri))]
     test_join!("", empty, "~~~~~");
     test_join!("a", ["a"], "~~~~~");
     test_join!("a~~~~~b", ["a", "b"], "~~~~~");
@@ -170,7 +166,7 @@ fn test_join_for_different_lengths_with_long_separator() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
 fn test_unsafe_slice() {
     assert_eq!("ab", unsafe {"abc".get_unchecked(0..2)});
     assert_eq!("bc", unsafe {"abc".get_unchecked(1..3)});
@@ -243,7 +239,6 @@ fn test_replacen() {
 #[test]
 fn test_replace() {
     let a = "a";
-    #[cfg(not(miri))]
     assert_eq!("".replace(a, "b"), "");
     assert_eq!("a".replace(a, "b"), "b");
     assert_eq!("ab".replace(a, "b"), "bb");
@@ -303,7 +298,6 @@ fn test_replace_pattern() {
 // The current implementation of SliceIndex fails to handle methods
 // orthogonally from range types; therefore, it is worth testing
 // all of the indexing operations on each input.
-#[cfg(not(miri))]
 mod slice_index {
     // Test a slicing operation **that should succeed,**
     // testing it on all of the indexing methods.
@@ -357,6 +351,7 @@ macro_rules! assert_range_eq {
     //  to be used in `should_panic`)
     #[test]
     #[should_panic(expected = "out of bounds")]
+    #[cfg(not(miri))] // Miri does not support panics
     fn assert_range_eq_can_fail_by_panic() {
         assert_range_eq!("abc", 0..5, "abc");
     }
@@ -366,6 +361,7 @@ fn assert_range_eq_can_fail_by_panic() {
     //  to be used in `should_panic`)
     #[test]
     #[should_panic(expected = "==")]
+    #[cfg(not(miri))] // Miri does not support panics
     fn assert_range_eq_can_fail_by_inequality() {
         assert_range_eq!("abc", 0..2, "abc");
     }
@@ -413,6 +409,7 @@ fn pass() {
 
                 #[test]
                 #[should_panic(expected = $expect_msg)]
+                #[cfg(not(miri))] // Miri does not support panics
                 fn index_fail() {
                     let v: String = $data.into();
                     let v: &str = &v;
@@ -421,6 +418,7 @@ fn index_fail() {
 
                 #[test]
                 #[should_panic(expected = $expect_msg)]
+                #[cfg(not(miri))] // Miri does not support panics
                 fn index_mut_fail() {
                     let mut v: String = $data.into();
                     let v: &mut str = &mut v;
@@ -490,6 +488,7 @@ fn simple_unicode() {
 
     #[test]
     #[cfg(not(target_arch = "asmjs"))] // hits an OOM
+    #[cfg(not(miri))] // Miri is too slow
     fn simple_big() {
         fn a_million_letter_x() -> String {
             let mut i = 0;
@@ -515,6 +514,7 @@ fn half_a_million_letter_x() -> String {
 
     #[test]
     #[should_panic]
+    #[cfg(not(miri))] // Miri does not support panics
     fn test_slice_fail() {
         &"中华Việt Nam"[0..2];
     }
@@ -666,12 +666,14 @@ mod boundary {
     // check the panic includes the prefix of the sliced string
     #[test]
     #[should_panic(expected="byte index 1024 is out of bounds of `Lorem ipsum dolor sit amet")]
+    #[cfg(not(miri))] // Miri does not support panics
     fn test_slice_fail_truncated_1() {
         &LOREM_PARAGRAPH[..1024];
     }
     // check the truncation in the panic message
     #[test]
     #[should_panic(expected="luctus, im`[...]")]
+    #[cfg(not(miri))] // Miri does not support panics
     fn test_slice_fail_truncated_2() {
         &LOREM_PARAGRAPH[..1024];
     }
@@ -686,7 +688,7 @@ fn test_str_slice_rangetoinclusive_ok() {
 
 #[test]
 #[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
 fn test_str_slice_rangetoinclusive_notok() {
     let s = "abcαβγ";
     &s[..=3];
@@ -702,7 +704,7 @@ fn test_str_slicemut_rangetoinclusive_ok() {
 
 #[test]
 #[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
 fn test_str_slicemut_rangetoinclusive_notok() {
     let mut s = "abcαβγ".to_owned();
     let s: &mut str = &mut s;
@@ -892,7 +894,7 @@ fn test_as_bytes() {
 
 #[test]
 #[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
 fn test_as_bytes_fail() {
     // Don't double free. (I'm not sure if this exercises the
     // original problem code path anymore.)
@@ -982,7 +984,7 @@ fn test_split_at_mut() {
 
 #[test]
 #[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
 fn test_split_at_boundscheck() {
     let s = "ศไทย中华Việt Nam";
     s.split_at(1);
@@ -1078,7 +1080,7 @@ fn test_rev_iterator() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
 fn test_chars_decoding() {
     let mut bytes = [0; 4];
     for c in (0..0x110000).filter_map(std::char::from_u32) {
@@ -1090,7 +1092,7 @@ fn test_chars_decoding() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
 fn test_chars_rev_decoding() {
     let mut bytes = [0; 4];
     for c in (0..0x110000).filter_map(std::char::from_u32) {
@@ -1320,7 +1322,6 @@ fn t(s: &str, sep: &str, u: &[&str]) {
 }
 
 #[test]
-#[cfg(not(miri))]
 fn test_str_default() {
     use std::default::Default;
 
@@ -1380,7 +1381,7 @@ fn test_bool_from_str() {
     assert_eq!("not even a boolean".parse::<bool>().ok(), None);
 }
 
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
 fn check_contains_all_substrings(s: &str) {
     assert!(s.contains(""));
     for i in 0..s.len() {
@@ -1391,7 +1392,7 @@ fn check_contains_all_substrings(s: &str) {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
 fn strslice_issue_16589() {
     assert!("bananas".contains("nana"));
 
@@ -1401,7 +1402,6 @@ fn strslice_issue_16589() {
 }
 
 #[test]
-#[cfg(not(miri))]
 fn strslice_issue_16878() {
     assert!(!"1234567ah012345678901ah".contains("hah"));
     assert!(!"00abc01234567890123456789abc".contains("bcabc"));
@@ -1409,7 +1409,7 @@ fn strslice_issue_16878() {
 
 
 #[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
 fn test_strslice_contains() {
     let x = "There are moments, Jeeves, when one asks oneself, 'Do trousers matter?'";
     check_contains_all_substrings(x);
@@ -1547,7 +1547,6 @@ fn trim_ws() {
 
 #[test]
 fn to_lowercase() {
-    #[cfg(not(miri))]
     assert_eq!("".to_lowercase(), "");
     assert_eq!("AÉDžaé ".to_lowercase(), "aédžaé ");
 
@@ -1581,7 +1580,6 @@ fn to_lowercase() {
 
 #[test]
 fn to_uppercase() {
-    #[cfg(not(miri))]
     assert_eq!("".to_uppercase(), "");
     assert_eq!("aéDžßfiᾀ".to_uppercase(), "AÉDŽSSFIἈΙ");
 }
@@ -1613,7 +1611,6 @@ fn test_cow_from() {
 }
 
 #[test]
-#[cfg(not(miri))]
 fn test_repeat() {
     assert_eq!("".repeat(3), "");
     assert_eq!("abc".repeat(0), "");
index b47e7c867e675441de41e2bccb9a567e8be8b149..d3439fed3cf3c22aedeb1453c746d7fdc7380e28 100644 (file)
@@ -108,7 +108,7 @@ fn test_index() {
 
 #[test]
 #[should_panic]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support panics
 fn test_index_out_of_bounds() {
     let mut deq = VecDeque::new();
     for i in 1..4 {
@@ -907,24 +907,21 @@ fn test_append() {
     // normal append
     a.append(&mut b);
     assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
-    #[cfg(not(miri))]
     assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
 
     // append nothing to something
     a.append(&mut b);
     assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
-    #[cfg(not(miri))]
     assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
 
     // append something to nothing
     b.append(&mut a);
     assert_eq!(b.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
-    #[cfg(not(miri))]
     assert_eq!(a.iter().cloned().collect::<Vec<_>>(), []);
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri is too slow
 fn test_append_permutations() {
     fn construct_vec_deque(
         push_back: usize,
@@ -1125,7 +1122,7 @@ fn test_reserve_exact_2() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support signalling OOM
 fn test_try_reserve() {
 
     // These are the interesting cases:
@@ -1227,7 +1224,7 @@ fn test_try_reserve() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg(not(miri))] // Miri does not support signalling OOM
 fn test_try_reserve_exact() {
 
     // This is exactly the same as test_try_reserve with the method changed.