Update libcollections tests to pass the new type rules. They used to return a pointer to the value they were modifying, but this should not have been legal, since that pointer would have to outlive the closure, and the closure continues to modify the value during the execution. This return value was just passed to black_box
so as to convince llvm that the value was live, so rather than returning a pointer, modify to just call black_box
directly inside the fn.
This commit is contained in:
parent
0b6ec70197
commit
2477bc4451
@ -1678,10 +1678,10 @@ impl<'a> Iterator<uint> for TwoBitPositions<'a> {
|
||||
mod tests {
|
||||
use std::prelude::*;
|
||||
use std::iter::range_step;
|
||||
use std::u32;
|
||||
use std::rand;
|
||||
use std::rand::Rng;
|
||||
use test::Bencher;
|
||||
use std::u32;
|
||||
use test::{Bencher, black_box};
|
||||
|
||||
use super::{Bitv, BitvSet, from_fn, from_bytes};
|
||||
use bitv;
|
||||
@ -2676,8 +2676,8 @@ mod tests {
|
||||
for _ in range(0u, 100) {
|
||||
bitv |= 1 << ((r.next_u32() as uint) % u32::BITS);
|
||||
}
|
||||
&bitv
|
||||
})
|
||||
black_box(&bitv)
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
@ -2688,8 +2688,8 @@ mod tests {
|
||||
for _ in range(0u, 100) {
|
||||
bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
|
||||
}
|
||||
&bitv
|
||||
})
|
||||
black_box(&bitv)
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
@ -2700,8 +2700,8 @@ mod tests {
|
||||
for _ in range(0u, 100) {
|
||||
bitv.set((r.next_u32() as uint) % BENCH_BITS, r.gen());
|
||||
}
|
||||
&bitv
|
||||
})
|
||||
black_box(&bitv);
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
@ -2712,8 +2712,8 @@ mod tests {
|
||||
for _ in range(0u, 100) {
|
||||
bitv.set((r.next_u32() as uint) % u32::BITS, true);
|
||||
}
|
||||
&bitv
|
||||
})
|
||||
black_box(&bitv);
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
@ -2724,8 +2724,8 @@ mod tests {
|
||||
for _ in range(0u, 100) {
|
||||
bitv.insert((r.next_u32() as uint) % u32::BITS);
|
||||
}
|
||||
&bitv
|
||||
})
|
||||
black_box(&bitv);
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
@ -2736,8 +2736,8 @@ mod tests {
|
||||
for _ in range(0u, 100) {
|
||||
bitv.insert((r.next_u32() as uint) % BENCH_BITS);
|
||||
}
|
||||
&bitv
|
||||
})
|
||||
black_box(&bitv);
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
|
@ -2084,7 +2084,7 @@ mod bench {
|
||||
use std::rand::{weak_rng, Rng};
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use test::Bencher;
|
||||
use test::{Bencher, black_box};
|
||||
|
||||
use vec::Vec;
|
||||
|
||||
@ -2140,8 +2140,8 @@ mod bench {
|
||||
let mut vec: Vec<uint> = vec![];
|
||||
b.iter(|| {
|
||||
vec.push(0);
|
||||
&vec
|
||||
})
|
||||
black_box(&vec);
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
|
Loading…
x
Reference in New Issue
Block a user