mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-03 00:49:38 +03:00
Add some more tests involving Offset/arith_offset and ZST pointers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user