Add some more tests involving Offset/arith_offset and ZST pointers

This commit is contained in:
Ralf Jung 2017-06-05 15:19:07 -07:00
parent a291153414
commit a6e6a6fd29
2 changed files with 21 additions and 0 deletions

View 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;
}

View 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);
}