diff options
Diffstat (limited to 'gcc/testsuite/rust/compile/traits3.rs')
-rw-r--r-- | gcc/testsuite/rust/compile/traits3.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/traits3.rs b/gcc/testsuite/rust/compile/traits3.rs new file mode 100644 index 0000000..fd3fa45 --- /dev/null +++ b/gcc/testsuite/rust/compile/traits3.rs @@ -0,0 +1,22 @@ +trait Foo { + type A; + + fn baz(a: Self::A) -> Self::A; +} + +struct Bar<T>(T); + +impl<T> Foo for Bar<T> { + type A = i32; + + fn baz(a: f32) -> f32 { + // { dg-error "method .baz. has an incompatible type for trait .Foo." "" { target *-*-* } .-1 } + a + // { dg-error "expected .i32. got .f32." "" { target *-*-* } .-1 } + } +} + +fn main() { + let a; + a = Bar::<i32>::baz(123f32); +} |