summaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/issue-893-2.rs
blob: 88a865d66dcfc47d9ed65d5a08a77cc99986c77f (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
// { dg-additional-options "-w" }
struct Foo<T>(T);
impl<T> Foo<T> {
    fn new<Y>(a: T, b: Y) -> Self {
        Self(a)
    }
}

struct Bar<T>(T);
impl Bar<i32> {
    fn baz(self) {}

    fn test() -> i32 {
        123
    }
}

struct Baz<A, B>(A, B);
impl Baz<i32, f32> {
    fn test<X>(a: X) -> X {
        a
    }
}

pub fn main() {
    let a = Foo::<i32>::new::<f32>(123, 456f32);
    let b = Foo::new::<f32>(123, 456f32);

    let c = Bar::<i32>(123);
    let d = Bar::baz(c);

    let e = Bar::test();

    let f = Baz::test::<bool>(true);
}