Debian Codegraph @

gcc/testsuite/rust/compile/issue-1725-2.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 mod core {
5 mod ops {
6 #[lang = "add"]
7 pub trait Add<Rhs = Self> {
8 type Output;
9
10 fn add(self, rhs: Rhs) -> Self::Output;
11 }
12 }
13 }
14
15 impl core::ops::Add for f32 {
16 type Output = f32;
17
18 fn add(self, rhs: Self) -> Self::Output {
19 self + rhs
20 }
21 }
22
23 pub fn foo<T: core::ops::Add<Output = i32>>(a: T) -> i32 {
24 a + a
25 }
26
27 pub fn main() {
28 foo(123f32);
29 // { dg-error "type mismatch, expected .i32. but got .f32." "" { target *-*-* } .-1 }
30 // { dg-error "bounds not satisfied for f32 .Add. is not satisfied" "" { target *-*-* } .-2 }
31 }