diff options
| author | Boxy <supbscripter@gmail.com> | 2023-05-26 14:44:28 +0100 |
|---|---|---|
| committer | Boxy <supbscripter@gmail.com> | 2023-05-31 02:14:15 +0100 |
| commit | 21cf9ea7ed5f87c905f1548d1855b02ee61b5aec (patch) | |
| tree | 6e23d9f0ce35a631a4fe3405c4bb0e194e5b9ec8 | |
| parent | 1e9b69bf3f07bca48d6c665e4375136f1c600f15 (diff) | |
| download | rust-21cf9ea7ed5f87c905f1548d1855b02ee61b5aec.tar.gz rust-21cf9ea7ed5f87c905f1548d1855b02ee61b5aec.zip | |
update test to not rely on super_relate_consts hack
| -rw-r--r-- | tests/ui/traits/new-solver/structural-resolve-field.rs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/ui/traits/new-solver/structural-resolve-field.rs b/tests/ui/traits/new-solver/structural-resolve-field.rs index 01899c9ad64..c492d927696 100644 --- a/tests/ui/traits/new-solver/structural-resolve-field.rs +++ b/tests/ui/traits/new-solver/structural-resolve-field.rs @@ -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; } |
