aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-3402-1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/issue-3402-1.rs')
-rw-r--r--gcc/testsuite/rust/compile/issue-3402-1.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-3402-1.rs b/gcc/testsuite/rust/compile/issue-3402-1.rs
new file mode 100644
index 0000000..ed603ce
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-3402-1.rs
@@ -0,0 +1,29 @@
+pub struct Foo {
+ a: i32,
+ // { dg-warning "field is never read" "" { target *-*-* } .-1 }
+}
+pub struct Bar(i32);
+
+#[lang = "sized"]
+trait Sized {}
+
+pub mod core {
+ pub mod default {
+ pub trait Default: Sized {
+ fn default() -> Self;
+ }
+
+ impl Default for i32 {
+ fn default() -> Self {
+ 0
+ }
+ }
+ }
+}
+
+impl ::core::default::Default for Bar {
+ #[inline]
+ fn default() -> Bar {
+ Bar(core::default::Default::default())
+ }
+}