summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/write_to_static_via_mut_ref.rs
blob: 665c305e9617f0007768e3a60c0dea45ea044776 (plain)
1
2
3
4
5
6
7
8
#![feature(const_mut_refs)]
#![allow(const_err)]

static OH_NO: &mut i32 = &mut 42; //~ ERROR mutable references are not allowed
fn main() {
    assert_eq!(*OH_NO, 42);
    *OH_NO = 43; //~ ERROR cannot assign to `*OH_NO`, as `OH_NO` is an immutable static
}