]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/qualif_overwrite_2.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / consts / qualif_overwrite_2.rs
1 use std::cell::Cell;
2
3 // const qualification is not smart enough to know about fields and always assumes that there might
4 // be other fields that caused the qualification
5 const FOO: &Option<Cell<usize>> = {
6     let mut a = (Some(Cell::new(0)),);
7     a.0 = None; // sets `qualif(a)` to `qualif(a) | qualif(None)`
8     &{a.0} //~ ERROR cannot refer to interior mutable
9 };
10
11 fn main() {}