From: Philip Herron <[email protected]>
Fixes Rust-GCC#4471
gcc/testsuite/ChangeLog:
* rust/compile/issue-4471-1.rs: New test.
* rust/compile/issue-4471-2.rs: New test.
Signed-off-by: Philip Herron <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/1756c79853e5c399ed6704fc8a439d0951622e53
The commit has NOT been mentioned in any issue.
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4606
gcc/testsuite/rust/compile/issue-4471-1.rs | 10 ++++++++
gcc/testsuite/rust/compile/issue-4471-2.rs | 28 ++++++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 gcc/testsuite/rust/compile/issue-4471-1.rs
create mode 100644 gcc/testsuite/rust/compile/issue-4471-2.rs
diff --git a/gcc/testsuite/rust/compile/issue-4471-1.rs
b/gcc/testsuite/rust/compile/issue-4471-1.rs
new file mode 100644
index 000000000..9b06b8c6b
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-4471-1.rs
@@ -0,0 +1,10 @@
+#![feature(no_core, intrinsics, staged_api, lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
+
+trait Foo<T> {}
+trait Bar: Foo {} // { dg-error {generic item takes at least 1 type arguments
but 0 were supplied \[E0107\]} }
+impl<T> Bar for T {}
+impl Foo<i32> for i32 {}
diff --git a/gcc/testsuite/rust/compile/issue-4471-2.rs
b/gcc/testsuite/rust/compile/issue-4471-2.rs
new file mode 100644
index 000000000..75db746f1
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-4471-2.rs
@@ -0,0 +1,28 @@
+#![feature(no_core, intrinsics, staged_api, lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
+
+trait Foo<T> {
+ fn get(&self) -> T;
+}
+
+trait Bar: Foo<i32> + Foo { // { dg-error {generic item takes at least 1 type
arguments but 0 were supplied \[E0107\]} }
+ fn double_get(&self) -> i32 {
+ self.get() + self.get()
+ }
+}
+
+impl<T> Bar for T where T: Foo<i32> {}
+
+impl Foo<i32> for i32 {
+ fn get(&self) -> i32 {
+ *self
+ }
+}
+
+fn main() {
+ let x: i32 = 1;
+ Bar::double_get(&x);
+}
base-commit: e2f7d746ace92002e8c3d22aee35bd6284256ab1
--
2.54.0