]> git.proxmox.com Git - rustc.git/blob - tests/ui/empty-allocation-non-null.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / empty-allocation-non-null.rs
1 // run-pass
2
3 pub fn main() {
4 assert!(Some(Box::new(())).is_some());
5
6 let xs: Box<[()]> = Box::<[(); 0]>::new([]);
7 assert!(Some(xs).is_some());
8
9 struct Foo;
10 assert!(Some(Box::new(Foo)).is_some());
11
12 let ys: Box<[Foo]> = Box::<[Foo; 0]>::new([]);
13 assert!(Some(ys).is_some());
14 }