about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-03-06 12:22:13 -0500
committerGitHub <noreply@github.com>2025-03-06 12:22:13 -0500
commit3152f16adad8d18af040dde2e6f56196a690d7e1 (patch)
tree0a815a6628dd58107e75b01ab9687ee9b7093095 /tests
parentaab7b145d0e1c0d297fe2b678e327daffb62e909 (diff)
parentadff091b3e144c294981e62ba3f5cb2e16995a10 (diff)
downloadrust-3152f16adad8d18af040dde2e6f56196a690d7e1.tar.gz
rust-3152f16adad8d18af040dde2e6f56196a690d7e1.zip
Rollup merge of #137637 - compiler-errors:dyn-cast-from-dyn-star, r=oli-obk
Check dyn flavor before registering upcast goal on wide pointer cast in MIR typeck

See the comment on the test :)

Fixes #137579
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/traits/trait-upcasting/dyn-to-dyn-star.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/traits/trait-upcasting/dyn-to-dyn-star.rs b/tests/ui/traits/trait-upcasting/dyn-to-dyn-star.rs
new file mode 100644
index 00000000000..5936c93efad
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/dyn-to-dyn-star.rs
@@ -0,0 +1,19 @@
+// While somewhat nonsensical, this is a cast from a wide pointer to a thin pointer.
+// Thus, we don't need to check an unsize goal here; there isn't any vtable casting
+// happening at all.
+
+// Regression test for <https://github.com/rust-lang/rust/issues/137579>.
+
+//@ check-pass
+
+#![allow(incomplete_features)]
+#![feature(dyn_star)]
+
+trait Foo {}
+trait Bar {}
+
+fn cast(x: *const dyn Foo) {
+    x as *const dyn* Bar;
+}
+
+fn main() {}