update test to not rely on super_relate_consts hack
This commit is contained in:
parent
1e9b69bf3f
commit
21cf9ea7ed
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user