Skip to content

Commit

Permalink
update test to not rely on super_relate_consts hack
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxyUwU committed May 31, 2023
1 parent 1e9b69b commit 21cf9ea
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions tests/ui/traits/new-solver/structural-resolve-field.rs
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;
}

0 comments on commit 21cf9ea

Please sign in to comment.