Rollup merge of #140713 - compiler-errors:check_ref_cast, r=lcnr

Structurally resolve in `check_ref_cast` in new solver

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/203

r? lcnr
This commit is contained in:
Jacob Pratt 2025-05-07 00:29:25 +00:00 committed by GitHub
commit 3d8ef7afca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 8 deletions

View file

@ -0,0 +1,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() {}