about summary refs log tree commit diff
path: root/tests/ui-fulldeps/try-from-u32/errors.rs
blob: a25069c0a53cbc6e41f21204f2af3607023078d6 (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
#![feature(rustc_private)]
//@ edition: 2021

// Checks the error messages produced by `#[derive(TryFromU32)]`.

extern crate rustc_macros;

use rustc_macros::TryFromU32;

#[derive(TryFromU32)]
struct MyStruct {} //~ ERROR type is not an enum

#[derive(TryFromU32)]
enum NonTrivial {
    A,
    B(),
    C {},
    D(bool),                //~ ERROR enum variant cannot have fields
    E(bool, bool),          //~ ERROR enum variant cannot have fields
    F { x: bool },          //~ ERROR enum variant cannot have fields
    G { x: bool, y: bool }, //~ ERROR enum variant cannot have fields
}

fn main() {}