]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/rvalue-static-promotion.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / consts / rvalue-static-promotion.rs
1 // run-pass
2
3 use std::cell::Cell;
4
5 const NONE_CELL_STRING: Option<Cell<String>> = None;
6
7 struct Foo<T>(#[allow(unused_tuple_struct_fields)] T);
8 impl<T> Foo<T> {
9 const FOO: Option<Box<T>> = None;
10 }
11
12 fn main() {
13 let _: &'static u32 = &42;
14 let _: &'static Option<u32> = &None;
15
16 // We should be able to peek at consts and see they're None.
17 let _: &'static Option<Cell<String>> = &NONE_CELL_STRING;
18 let _: &'static Option<Box<()>> = &Foo::FOO;
19 }