summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-blocks/fn-call-in-non-const.rs
blob: 18b4dc714ded0b036f1c73211eceeee0c7f1abc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Some type that is not copyable.
struct Bar;

const fn no_copy() -> Option<Bar> {
    None
}

const fn copy() -> u32 {
    3
}

fn main() {
    let _: [u32; 2] = [copy(); 2];
    let _: [Option<Bar>; 2] = [no_copy(); 2];
    //~^ ERROR the trait bound `Bar: Copy` is not satisfied
}