about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/traits/new-solver/structural-resolve-field.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/ui/traits/new-solver/structural-resolve-field.rs b/tests/ui/traits/new-solver/structural-resolve-field.rs
index 01899c9ad64..c492d927696 100644
--- a/tests/ui/traits/new-solver/structural-resolve-field.rs
+++ b/tests/ui/traits/new-solver/structural-resolve-field.rs
@@ -1,13 +1,35 @@
 // compile-flags: -Ztrait-solver=next
 // check-pass
 
-#[derive(Default)]
 struct Foo {
     x: i32,
 }
 
+impl MyDefault for Foo {
+    fn my_default() -> Self {
+        Self {
+            x: 0,
+        }
+    }
+}
+
+trait MyDefault {
+    fn my_default() -> Self;
+}
+
+impl MyDefault for [Foo; 0]  {
+    fn my_default() -> Self {
+        []
+    }
+}
+impl MyDefault for [Foo; 1] {
+    fn my_default() -> Self {
+        [Foo::my_default(); 1]
+    }
+}
+
 fn main() {
-    let mut xs = <[Foo; 1]>::default();
+    let mut xs = <[Foo; 1]>::my_default();
     xs[0].x = 1;
     (&mut xs[0]).x = 2;
 }