mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
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
|
// compile-flags: -Ztrait-solver=next
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct Foo {
|
struct Foo {
|
||||||
x: i32,
|
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() {
|
fn main() {
|
||||||
let mut xs = <[Foo; 1]>::default();
|
let mut xs = <[Foo; 1]>::my_default();
|
||||||
xs[0].x = 1;
|
xs[0].x = 1;
|
||||||
(&mut xs[0]).x = 2;
|
(&mut xs[0]).x = 2;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user