Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't ICE when encountering dyn* in statics or consts #109921

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is check-pass enough to run constant evaluation?


#![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