aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-1725-2.rs
blob: 8bfd0bbd92464cfd768c6e11dd33b501ecaa7f8d (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
mod core {
    mod ops {
        #[lang = "add"]
        pub trait Add<Rhs = Self> {
            type Output;

            fn add(self, rhs: Rhs) -> Self::Output;
        }
    }
}

impl core::ops::Add for f32 {
    type Output = f32;

    fn add(self, rhs: Self) -> Self::Output {
        self + rhs
    }
}

pub fn foo<T: core::ops::Add<Output = i32>>(a: T) -> i32 {
    a + a
}

pub fn main() {
    foo(123f32);
    // { dg-error "expected .i32. got .f32." "" { target *-*-* } .-1 }
    // { dg-error "bounds not satisfied for f32 .Add. is not satisfied" "" { target *-*-* } .-2 }
}