]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/rvalue-static-promotion.rs
Rollup merge of #107004 - compiler-errors:new-solver-new-candidates-2, r=lcnr
[rust.git] / tests / 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 }