]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/const_let_promote.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / consts / const_let_promote.rs
1 // run-pass
2
3 use std::cell::Cell;
4
5 const X: Option<Cell<i32>> = None;
6
7 const Y: Option<Cell<i32>> = {
8 let x = None;
9 x
10 };
11
12 // Ensure that binding the final value of a `const` to a variable does not affect promotion.
13 #[allow(unused)]
14 fn main() {
15 let x: &'static _ = &X;
16 let y: &'static _ = &Y;
17 }