Skip to content

Commit 21cf9ea

Browse files
committed
update test to not rely on super_relate_consts hack
1 parent 1e9b69b commit 21cf9ea

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed
+24-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
11
// compile-flags: -Ztrait-solver=next
22
// check-pass
33

4-
#[derive(Default)]
54
struct Foo {
65
x: i32,
76
}
87

8+
impl MyDefault for Foo {
9+
fn my_default() -> Self {
10+
Self {
11+
x: 0,
12+
}
13+
}
14+
}
15+
16+
trait MyDefault {
17+
fn my_default() -> Self;
18+
}
19+
20+
impl MyDefault for [Foo; 0] {
21+
fn my_default() -> Self {
22+
[]
23+
}
24+
}
25+
impl MyDefault for [Foo; 1] {
26+
fn my_default() -> Self {
27+
[Foo::my_default(); 1]
28+
}
29+
}
30+
931
fn main() {
10-
let mut xs = <[Foo; 1]>::default();
32+
let mut xs = <[Foo; 1]>::my_default();
1133
xs[0].x = 1;
1234
(&mut xs[0]).x = 2;
1335
}

0 commit comments

Comments
 (0)