summary refs log tree commit diff
path: root/src/test/ui/consts/qualif_overwrite_2.rs
blob: 29557a3da47811d491291021e7fc49bc339d5872 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#![feature(const_let)]

use std::cell::Cell;

// const qualification is not smart enough to know about fields and always assumes that there might
// be other fields that caused the qualification
const FOO: &Option<Cell<usize>> = {
    let mut a = (Some(Cell::new(0)),);
    a.0 = None; // sets `qualif(a)` to `qualif(a) | qualif(None)`
    &{a.0} //~ ERROR cannot borrow a constant which may contain interior mutability
};

fn main() {}