Skip to content

Commit

Permalink
Rollup merge of #109921 - compiler-errors:dyn-star-const-static, r=eholk
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
JohnTitor authored Apr 5, 2023
2 parents ea92090 + 1b5ac39 commit 4b8725b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
}

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

Rvalue::Cast(_, _, _) => {}
Expand Down
10 changes: 10 additions & 0 deletions tests/ui/dyn-star/const-and-static.rs
Original file line number Diff line number Diff line change
@@ -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() {}
11 changes: 11 additions & 0 deletions tests/ui/dyn-star/const-and-static.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4b8725b

Please sign in to comment.