diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2023-04-06 07:18:29 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-06 07:18:29 +0900 |
| commit | 4b8725b854050aa1c90109c6a9515be893aaa946 (patch) | |
| tree | 35047ed0e4223765d7295c293337a2557930d71d | |
| parent | ea920901e9f6ae2dcef9830c1662d5ebabce9e59 (diff) | |
| parent | 1b5ac399082253288772dc1dabaa9d5458c927a9 (diff) | |
| download | rust-4b8725b854050aa1c90109c6a9515be893aaa946.tar.gz rust-4b8725b854050aa1c90109c6a9515be893aaa946.zip | |
Rollup merge of #109921 - compiler-errors:dyn-star-const-static, r=eholk
Don't ICE when encountering `dyn*` in statics or consts Since we have properly implemented `dyn*` support in CTFE (#107728), let's not ICE here anymore. Fixes #105777 r? `@eholk`
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/check_consts/check.rs | 2 | ||||
| -rw-r--r-- | tests/ui/dyn-star/const-and-static.rs | 10 | ||||
| -rw-r--r-- | tests/ui/dyn-star/const-and-static.stderr | 11 |
3 files changed, 22 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index d6110a050f2..20c0852fe33 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -553,7 +553,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { } Rvalue::Cast(CastKind::DynStar, _, _) => { - unimplemented!() + // `dyn*` coercion is implemented for CTFE. } Rvalue::Cast(_, _, _) => {} diff --git a/tests/ui/dyn-star/const-and-static.rs b/tests/ui/dyn-star/const-and-static.rs new file mode 100644 index 00000000000..551b072abfa --- /dev/null +++ b/tests/ui/dyn-star/const-and-static.rs @@ -0,0 +1,10 @@ +// check-pass + +#![feature(dyn_star)] +//~^ WARN the feature `dyn_star` is incomplete + +const C: dyn* Send + Sync = &(); + +static S: dyn* Send + Sync = &(); + +fn main() {} diff --git a/tests/ui/dyn-star/const-and-static.stderr b/tests/ui/dyn-star/const-and-static.stderr new file mode 100644 index 00000000000..df8f42fb0f5 --- /dev/null +++ b/tests/ui/dyn-star/const-and-static.stderr @@ -0,0 +1,11 @@ +warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/const-and-static.rs:3:12 + | +LL | #![feature(dyn_star)] + | ^^^^^^^^ + | + = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + |
