Revert "Fix tests broken by std::vec::SetLenOnDrop."

This reverts commit 366c793306.
This commit is contained in:
Oliver Schneider 2016-11-04 09:15:59 +01:00
parent bd25230882
commit ff95efc525
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46
2 changed files with 15 additions and 30 deletions

View file

@ -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() {

View file

@ -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<u8> {
let mut v = Vec::with_capacity(4);
v.push(1);
@ -16,22 +6,22 @@ fn make_vec() -> Vec<u8> {
}
fn make_vec_macro() -> Vec<u8> {
miri_vec![1, 2]
vec![1, 2]
}
fn make_vec_macro_repeat() -> Vec<u8> {
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<u8> {
let mut v = miri_vec![1, 2];
let mut v = vec![1, 2];
v.push(3);
v.push(4);
v.push(5);