aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/derive-default1.rs
blob: 902c65eca58d2e5d074bb9a95f243ba5bae6e3ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#[derive(Default)]
struct Foo { _a: i32, _b: i64, _c: u8 }

#[lang = "sized"]
trait Sized {}

mod core {
    mod default {
        trait Default: Sized {
            fn default() -> Self;
        }

        impl Default for i32 {
            fn default() -> Self { 0 }
        }

        impl Default for i64 {
            fn default() -> Self { 27 }
        }

        impl Default for u8 {
            fn default() -> Self { 18 }
        }
    }
}

fn main() {
    let _ = Foo::default();
}