dyn* is a valid const

This commit is contained in:
Michael Goulet 2023-04-04 00:28:05 +00:00
parent 48829ea74b
commit 1b5ac39908
3 changed files with 22 additions and 1 deletions

View File

@ -553,7 +553,7 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
}
Rvalue::Cast(CastKind::DynStar, _, _) => {
unimplemented!()
// `dyn*` coercion is implemented for CTFE.
}
Rvalue::Cast(_, _, _) => {}

View File

@ -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() {}

View File

@ -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