diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-17 00:45:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-17 00:45:51 +0100 |
| commit | 86bbc2014615a276a4c6b267c303b8773c0c54fb (patch) | |
| tree | 890c5c889010097e6eecec834dbbd9a2f4027bc3 /src/test | |
| parent | 505848a935f416a3850095dbc7b5899bd66f8b36 (diff) | |
| parent | d0db3279ab251db3612204cc1e3f386e8beae996 (diff) | |
| download | rust-86bbc2014615a276a4c6b267c303b8773c0c54fb.tar.gz rust-86bbc2014615a276a4c6b267c303b8773c0c54fb.zip | |
Rollup merge of #105710 - compiler-errors:dyn-star-rigid-cast, r=eholk
Don't bug if we're trying to cast `dyn*` to another type Fixes #105097
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/dyn-star/dyn-to-rigid.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/dyn-star/dyn-to-rigid.stderr | 9 |
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`. |
