-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update test to not rely on super_relate_consts hack
- Loading branch information
Showing
1 changed file
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |