about summary refs log tree commit diff
path: root/tests/ui/repeat-expr/copy-inference-side-effects.rs
blob: eb47b5f462f9c74fb9912c30329eb8945a6c1efc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//@ check-pass

#[derive(Clone, Default)]
struct MaybeCopy<T>(T);

impl Copy for MaybeCopy<u8> {}

fn is_copy<T: Copy>(x: T) {
    println!("{}", std::any::type_name::<T>());
}

fn main() {
    is_copy(MaybeCopy::default());
    [MaybeCopy::default(); 13];
    // didn't work, because `Copy` was only checked in the mir
}