Add some more tests involving Offset/arith_offset and ZST pointers
This commit is contained in:
parent
a291153414
commit
a6e6a6fd29
2 changed files with 21 additions and 0 deletions
9
tests/run-pass/drop_empty_slice.rs
Normal file
9
tests/run-pass/drop_empty_slice.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#![feature(box_syntax)]
|
||||
// This disables the test completely:
|
||||
// ignore-stage1
|
||||
|
||||
fn main() {
|
||||
// With the nested Vec, this is calling Offset(Unique::empty(), 0).
|
||||
let args : Vec<Vec<i32>> = Vec::new();
|
||||
let local = box args;
|
||||
}
|
||||
12
tests/run-pass/iter_slice.rs
Normal file
12
tests/run-pass/iter_slice.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
fn main() {
|
||||
for _ in Vec::<u32>::new().iter() { // this iterates over a Unique::empty()
|
||||
panic!("We should never be here.");
|
||||
}
|
||||
|
||||
// Iterate over a ZST (uses arith_offset internally)
|
||||
let mut count = 0;
|
||||
for _ in &[(), (), ()] {
|
||||
count += 1;
|
||||
}
|
||||
assert_eq!(count, 3);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue