]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/control-flow/interior-mutability.rs
1 // Ensure that *any* assignment to the return place of a value with interior mutability
2 // disqualifies it from promotion.
6 const X
: Option
<Cell
<i32>> = {
9 x
= Some(Cell
::new(4));
14 const Y
: Option
<Cell
<i32>> = {
15 let mut y
= Some(Cell
::new(4));
22 const Z
: Option
<Cell
<i32>> = {
27 z
= Some(Cell
::new(4));
40 let x
: &'
static _
= &X
; //~ ERROR temporary value dropped while borrowed
41 let y
: &'
static _
= &Y
; //~ ERROR temporary value dropped while borrowed
42 let z
: &'
static _
= &Z
; //~ ERROR temporary value dropped while borrowed