-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
miri ICE promote const: impossible case reached #53201
Comments
Not that this fixes the issue, but |
minified: #![feature(const_fn, rustc_attrs, attr_literals)]
#[rustc_args_required_const(0)]
pub const fn new(value: u8) -> u8 {
value
}
#[rustc_args_required_const(0)]
pub unsafe fn const_(_: u8) {
unimplemented!()
}
fn main() {
let _a = const_(new(0));
} @eddyb is this a victim of the backwards algorithm for promotion? Just a hunch, but it might have promoted away the call to |
thanks @cramertj , I'll update the PR that triggered this - for context rust-lang/stdarch#549 |
As a workaround until we fix this ICE, you can introduce an intermediate explicit constant for the argument to |
This is part of a user-exposed API, but that workaround should allow me to at least get the const tests running. |
It won't remove the definition if there's more than one use (unless this is fallout from your changes?) |
There's only one use. I don't see how my changes could have caused this, but it seems possible. I'll do a bisection |
Oh, I see, rust/src/librustc_mir/transform/promote_consts.rs Lines 376 to 379 in a3ad012
|
Fix instructions:
|
@oli-obk You can use a |
Don't try to promote already promoted out temporaries fixes rust-lang#53201 r? @eddyb
Don't try to promote already promoted out temporaries fixes rust-lang#53201 r? @eddyb
Playground:
produces
cc @oli-obk
The text was updated successfully, but these errors were encountered: