summaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/traits12.rs
blob: a55b965baf0bffae71889072696c8cda0457817b (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
trait Foo {
    type A;

    fn test(a: Self::A) -> Self::A {
        a
    }
}

struct Bar(i32);
// { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }

impl Foo for Bar {
    type A = i32;
}

struct Baz(f32);
// { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }

impl Foo for Baz {
    type A = f32;
}

fn main() {
    let a: <Baz as Foo>::A;
    a = 123f32;

    let b;
    b = <Baz as Foo>::test(a);
}