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:
commit
3d8ef7afca
2 changed files with 29 additions and 8 deletions
22
tests/ui/cast/cast-alias-of-array-to-element.rs
Normal file
22
tests/ui/cast/cast-alias-of-array-to-element.rs
Normal 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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue