From ff95efc52575c7ef8deb3c6628328d7a07442ec9 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Fri, 4 Nov 2016 09:15:59 +0100 Subject: [PATCH] Revert "Fix tests broken by std::vec::SetLenOnDrop." This reverts commit 366c793306609f4a80e7977be766cbc7e9c2b3be. --- tests/run-pass/heap.rs | 27 +++++++++++---------------- tests/run-pass/vecs.rs | 18 ++++-------------- 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/tests/run-pass/heap.rs b/tests/run-pass/heap.rs index 4bf6a085e35f..b533f9164698 100644 --- a/tests/run-pass/heap.rs +++ b/tests/run-pass/heap.rs @@ -11,25 +11,20 @@ fn make_box_syntax() -> Box<(i16, i16)> { fn allocate_reallocate() { let mut s = String::new(); - // 4 byte heap alloc (__rust_allocate) - s.push('f'); - assert_eq!(s.len(), 1); - assert_eq!(s.capacity(), 4); + // 6 byte heap alloc (__rust_allocate) + s.push_str("foobar"); + assert_eq!(s.len(), 6); + assert_eq!(s.capacity(), 6); - // heap size doubled to 8 (__rust_reallocate) - // FIXME: String::push_str is broken because it hits the std::vec::SetLenOnDrop code and we - // don't call destructors in miri yet. - s.push('o'); - s.push('o'); - s.push('o'); - s.push('o'); - assert_eq!(s.len(), 5); - assert_eq!(s.capacity(), 8); + // heap size doubled to 12 (__rust_reallocate) + s.push_str("baz"); + assert_eq!(s.len(), 9); + assert_eq!(s.capacity(), 12); - // heap size reduced to 5 (__rust_reallocate) + // heap size reduced to 9 (__rust_reallocate) s.shrink_to_fit(); - assert_eq!(s.len(), 5); - assert_eq!(s.capacity(), 5); + assert_eq!(s.len(), 9); + assert_eq!(s.capacity(), 9); } fn main() { diff --git a/tests/run-pass/vecs.rs b/tests/run-pass/vecs.rs index 0ad7a371762b..b3a88014e6f9 100644 --- a/tests/run-pass/vecs.rs +++ b/tests/run-pass/vecs.rs @@ -1,13 +1,3 @@ -// FIXME: The normal `vec!` macro is currently broken in Miri because it hits the -// std::vec::SetLenOnDrop code and Miri doesn't call destructors yet. -macro_rules! miri_vec { - ($($e:expr),*) => ({ - let mut v = Vec::new(); - $(v.push($e);)* - v - }); -} - fn make_vec() -> Vec { let mut v = Vec::with_capacity(4); v.push(1); @@ -16,22 +6,22 @@ fn make_vec() -> Vec { } fn make_vec_macro() -> Vec { - miri_vec![1, 2] + vec![1, 2] } fn make_vec_macro_repeat() -> Vec { - miri_vec![42, 42, 42, 42, 42] + vec![42; 5] } fn vec_into_iter() -> u8 { - miri_vec![1, 2, 3, 4] + vec![1, 2, 3, 4] .into_iter() .map(|x| x * x) .fold(0, |x, y| x + y) } fn vec_reallocate() -> Vec { - let mut v = miri_vec![1, 2]; + let mut v = vec![1, 2]; v.push(3); v.push(4); v.push(5);