summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/move-in-static-initializer-issue-38520.rs
blob: c2a59a1054c7517beae8fd9b1a9c6059bbf70b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Regression test for #38520. Check that moves of `Foo` are not
// permitted as `Foo` is not copy (even in a static/const
// initializer).

struct Foo(usize);

const fn get(x: Foo) -> usize {
    x.0
}

const X: Foo = Foo(22);
static Y: usize = get(*&X); //~ ERROR [E0507]
const Z: usize = get(*&X); //~ ERROR [E0507]

fn main() {
}