about summary refs log tree commit diff
path: root/tests/ui/cast/cast-alias-of-array-to-element.rs
blob: 124d0e0346f07d416b8ecd9ce017a0079fb5c013 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//@ check-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver

// Regression test for <https://github.com/rust-lang/trait-system-refactor-initiative/issues/203>.
// Test that we structually normalize in the hacky `&[T; N] -> *const T` in cast.

trait Mirror {
    type Assoc: ?Sized;
}
impl<T: ?Sized> Mirror for T {
    type Assoc = T;
}

struct W<'a>(&'a <[f32; 0] as Mirror>::Assoc);

fn foo(x: W<'_>) -> *const f32 {
    x.0 as *const f32
}

fn main() {}