aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-3009.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/issue-3009.rs')
-rw-r--r--gcc/testsuite/rust/compile/issue-3009.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-3009.rs b/gcc/testsuite/rust/compile/issue-3009.rs
new file mode 100644
index 0000000..2eb4ef3
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-3009.rs
@@ -0,0 +1,24 @@
+#[lang = "sized"]
+trait Sized {}
+
+struct Foo {
+ // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }
+ t: u64,
+}
+
+impl Foo {
+ fn of<T>() -> Foo {
+ // { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
+ Foo { t: 14 }
+ }
+}
+
+trait Bar {
+ fn bar() -> Foo;
+}
+
+impl<T> Bar for T {
+ fn bar() -> Foo {
+ Foo::of::<T>()
+ }
+}