about summary refs log tree commit diff
path: root/tests/ui/structs/default-field-values-non_exhaustive.rs
blob: 0ad2b0766a772422575a422e5028fad4dd03305c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![feature(default_field_values)]

#[derive(Default)]
#[non_exhaustive] //~ ERROR `#[non_exhaustive]` can't be used to annotate items with default field values
struct Foo {
    x: i32 = 42 + 3,
}

#[derive(Default)]
enum Bar {
    #[non_exhaustive]
    #[default]
    Baz { //~ ERROR default variant must be exhaustive
        x: i32 = 42 + 3,
    }
}

fn main () {}