summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval/const_let.rs
blob: 63321b9120076aedd3ef431a56f31da3135f2027 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
fn main() {}

struct FakeNeedsDrop;

impl Drop for FakeNeedsDrop {
    fn drop(&mut self) {}
}

// ok
const X: FakeNeedsDrop = { let x = FakeNeedsDrop; x };

// error
const Y: FakeNeedsDrop = { let mut x = FakeNeedsDrop; x = FakeNeedsDrop; x };
//~^ ERROR constant contains unimplemented expression type

// error
const Z: () = { let mut x = None; x = Some(FakeNeedsDrop); };
//~^ ERROR constant contains unimplemented expression type