diff options
author | Philip Herron <herron.philip@googlemail.com> | 2024-11-06 11:08:27 +0000 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-11-06 12:01:00 +0000 |
commit | 977a72ca06f6f90bacb70b0474f5d5122b75074e (patch) | |
tree | 8dec0b7389959990b2e93173bb4f367a9db4af12 /gcc | |
parent | 335f6c2b0918c27eecd93a114668841b74ee06c3 (diff) | |
download | gcc-977a72ca06f6f90bacb70b0474f5d5122b75074e.zip gcc-977a72ca06f6f90bacb70b0474f5d5122b75074e.tar.gz gcc-977a72ca06f6f90bacb70b0474f5d5122b75074e.tar.bz2 |
gccrs: add test case to show issue is fixed
The original test case 1773 has been moved to a new issue 3242 which
is still open and test-case is skipped. The original issue in 1773 is
fixed so this will close out that issue
Fixes Rust-Gcc#1773
gcc/testsuite/ChangeLog:
* rust/compile/issue-1773.rs: new test case
* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/issue-3242.rs: old test ranamed to match issue.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/rust/compile/issue-1773.rs | 23 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/issue-3242.rs | 24 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/nr2/exclude | 1 |
3 files changed, 40 insertions, 8 deletions
diff --git a/gcc/testsuite/rust/compile/issue-1773.rs b/gcc/testsuite/rust/compile/issue-1773.rs index 468497a..41c82f0 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<T> { +trait Foo { type A; fn test(a: Self::A) -> Self::A { @@ -10,9 +6,14 @@ trait Foo<T> { } } -struct Bar<T>(T); -impl<T> Foo<T> for Bar<i32> { - 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 0000000..468497a --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3242.rs @@ -0,0 +1,24 @@ +#[lang = "sized"] +// { dg-skip-if "" { *-*-* } } +pub trait Sized {} + +trait Foo<T> { + type A; + + fn test(a: Self::A) -> Self::A { + a + } +} + +struct Bar<T>(T); +impl<T> Foo<T> for Bar<i32> { + 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 6f81872..efee0fd 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 |