about summary refs log tree commit diff
path: root/tests/ui/coercion/fake-sized-ptr-cast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/coercion/fake-sized-ptr-cast.rs')
-rw-r--r--tests/ui/coercion/fake-sized-ptr-cast.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/coercion/fake-sized-ptr-cast.rs b/tests/ui/coercion/fake-sized-ptr-cast.rs
new file mode 100644
index 00000000000..4b6bf0eb516
--- /dev/null
+++ b/tests/ui/coercion/fake-sized-ptr-cast.rs
@@ -0,0 +1,16 @@
+// Make sure borrowck doesn't ICE because it thinks a pointer cast is a metadata-preserving
+// wide-to-wide ptr cast when it's actually (falsely) a wide-to-thin ptr cast due to an
+// impossible dyn sized bound.
+
+//@ check-pass
+
+trait Trait<T> {}
+
+fn func<'a>(x: *const (dyn Trait<()> + 'a))
+where
+    dyn Trait<u8> + 'a: Sized,
+{
+    let _x: *const dyn Trait<u8> = x as _;
+}
+
+fn main() {}