about summary refs log tree commit diff
path: root/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.rs
blob: d50466ac4bbd80e7f1d6f18a56e3f115ea634cac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::marker::PhantomData;

struct Foo<T>(PhantomData<T>);

impl Clone for Foo<u8> {
    fn clone(&self) -> Self {
        Foo(PhantomData)
    }
}
impl Copy for Foo<u8> {}

fn extract<T, const N: usize>(_: [Foo<T>; N]) -> T {
    loop {}
}

fn main() {
    let x = [Foo(PhantomData); 2];
    //~^ ERROR: type annotations needed
    extract(x).max(2);
}