about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-05-07 00:29:25 +0000
committerGitHub <noreply@github.com>2025-05-07 00:29:25 +0000
commit3d8ef7afcab3dd91b6234065b954ce83daa37f40 (patch)
tree11fd68aa37b5f878ac22128b5a3d42e76f5654c5 /tests/ui
parent8984d650e123d5130ba5662fa59d138e926d44ed (diff)
parent636a138cdae2da2b261a54681a2910ce21ed8019 (diff)
downloadrust-3d8ef7afcab3dd91b6234065b954ce83daa37f40.tar.gz
rust-3d8ef7afcab3dd91b6234065b954ce83daa37f40.zip
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
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/cast/cast-alias-of-array-to-element.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/cast/cast-alias-of-array-to-element.rs b/tests/ui/cast/cast-alias-of-array-to-element.rs
new file mode 100644
index 00000000000..124d0e0346f
--- /dev/null
+++ b/tests/ui/cast/cast-alias-of-array-to-element.rs
@@ -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() {}