Skip to content

Commit 1b5ac39

Browse files
dyn* is a valid const
1 parent 48829ea commit 1b5ac39

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)