update test to not rely on super_relate_consts hack

This commit is contained in:
Boxy 2023-05-26 14:44:28 +01:00
parent 1e9b69bf3f
commit 21cf9ea7ed

View File

@ -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;
}