Skip to content

Commit 4b8725b

Browse files
authored
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`
2 parents ea92090 + 1b5ac39 commit 4b8725b

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

compiler/rustc_const_eval/src/transform/check_consts/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
553553
}
554554

555555
Rvalue::Cast(CastKind::DynStar, _, _) => {
556-
unimplemented!()
556+
// `dyn*` coercion is implemented for CTFE.
557557
}
558558

559559
Rvalue::Cast(_, _, _) => {}

tests/ui/dyn-star/const-and-static.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
3+
#![feature(dyn_star)]
4+
//~^ WARN the feature `dyn_star` is incomplete
5+
6+
const C: dyn* Send + Sync = &();
7+
8+
static S: dyn* Send + Sync = &();
9+
10+
fn main() {}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/const-and-static.rs:3:12
3+
|
4+
LL | #![feature(dyn_star)]
5+
| ^^^^^^^^
6+
|
7+
= note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
warning: 1 warning emitted
11+

0 commit comments

Comments
 (0)