aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/derive-debug1.rs
blob: 2596a3792f1f6789bf7875d6da6ea7b0c78c6885 (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
30
31
32
33
34
35
36
37
38
39
40
41
#[lang = "sized"]
trait Sized {}

mod core {
    pub mod result {
        pub enum Result<T, E> {
            #[lang = "Ok"]
            Ok(T),
            #[lang = "Err"]
            Err(E),
        }
    }

    mod fmt {
        struct Formatter; // { dg-warning "is never constructed" }
        struct Error; // { dg-warning "is never constructed" }

        type Result = core::result::Result<(), Error>;

        trait Debug {
            fn fmt(&self, fmt: &mut Formatter) -> Result;
        }
    }
}

#[derive(Debug)] // { dg-warning "unused name" }
// { dg-warning "stub implementation" "" { target *-*-* } .-1 }
struct Foo { a: i32, b: i64 } // { dg-warning "is never constructed" }

#[derive(Debug)] // { dg-warning "unused name" }
// { dg-warning "stub implementation" "" { target *-*-* } .-1 }
struct Bar(i32, i32); // { dg-warning "is never constructed" }

#[derive(Debug)] // { dg-warning "unused name" }
// { dg-warning "stub implementation" "" { target *-*-* } .-1 }
enum Baz {
    A,
    B(i32),
    C { a: i32 }
}