diff --git a/gcc/testsuite/rust/compile/issue-1773.rs b/gcc/testsuite/rust/compile/issue-1773.rs index 468497a4792e..41c82f01b6dd 100644 --- a/gcc/testsuite/rust/compile/issue-1773.rs +++ b/gcc/testsuite/rust/compile/issue-1773.rs @@ -1,8 +1,4 @@ -#[lang = "sized"] -// { dg-skip-if "" { *-*-* } } -pub trait Sized {} - -trait Foo { +trait Foo { type A; fn test(a: Self::A) -> Self::A { @@ -10,9 +6,14 @@ trait Foo { } } -struct Bar(T); -impl Foo for Bar { - type A = T; +struct Bar(i32); +impl Foo for Bar { + type A = i32; +} + +struct Baz(f32); +impl Foo for Baz { + type A = f32; } fn main() { @@ -21,4 +22,10 @@ fn main() { let b; b = Bar::test(a.0); + + let c; + c = Baz(123f32); + + let d; + d = Baz::test(c.0); } diff --git a/gcc/testsuite/rust/compile/issue-3242.rs b/gcc/testsuite/rust/compile/issue-3242.rs new file mode 100644 index 000000000000..468497a4792e --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3242.rs @@ -0,0 +1,24 @@ +#[lang = "sized"] +// { dg-skip-if "" { *-*-* } } +pub trait Sized {} + +trait Foo { + type A; + + fn test(a: Self::A) -> Self::A { + a + } +} + +struct Bar(T); +impl Foo for Bar { + type A = T; +} + +fn main() { + let a; + a = Bar(123); + + let b; + b = Bar::test(a.0); +} diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index 6f8187264aae..efee0fd1e2dd 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -216,4 +216,5 @@ issue-3009.rs issue-2323.rs issue-2953-1.rs issue-2953-2.rs +issue-1773.rs # please don't delete the trailing newline