about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-14 18:00:56 +0000
committerMichael Goulet <michael@errs.io>2022-12-14 18:00:56 +0000
commitd0db3279ab251db3612204cc1e3f386e8beae996 (patch)
tree7da8368d67a7f32a524e4c330b6bbce6384b1280 /src/test
parentba64ba8b0dfd57f7d6d7399d0df7ded37d2af18d (diff)
downloadrust-d0db3279ab251db3612204cc1e3f386e8beae996.tar.gz
rust-d0db3279ab251db3612204cc1e3f386e8beae996.zip
Don't bug if we're trying to cast dyn* to a nother type
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/dyn-star/dyn-to-rigid.rs11
-rw-r--r--src/test/ui/dyn-star/dyn-to-rigid.stderr9
2 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/dyn-star/dyn-to-rigid.rs b/src/test/ui/dyn-star/dyn-to-rigid.rs
new file mode 100644
index 00000000000..e80ee15902e
--- /dev/null
+++ b/src/test/ui/dyn-star/dyn-to-rigid.rs
@@ -0,0 +1,11 @@
+#![feature(dyn_star)]
+#![allow(incomplete_features)]
+
+trait Tr {}
+
+fn f(x: dyn* Tr) -> usize {
+    x as usize
+    //~^ ERROR casting `(dyn* Tr + 'static)` as `usize` is invalid
+}
+
+fn main() {}
diff --git a/src/test/ui/dyn-star/dyn-to-rigid.stderr b/src/test/ui/dyn-star/dyn-to-rigid.stderr
new file mode 100644
index 00000000000..588e6d97e5c
--- /dev/null
+++ b/src/test/ui/dyn-star/dyn-to-rigid.stderr
@@ -0,0 +1,9 @@
+error[E0606]: casting `(dyn* Tr + 'static)` as `usize` is invalid
+  --> $DIR/dyn-to-rigid.rs:7:5
+   |
+LL |     x as usize
+   |     ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0606`.