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

Illegal Instruction Promoting const panic! #54305

Closed
cramertj opened this issue Sep 17, 2018 · 4 comments
Closed

Illegal Instruction Promoting const panic! #54305

cramertj opened this issue Sep 17, 2018 · 4 comments
Assignees
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time.

Comments

@cramertj
Copy link
Member

Playground link

#![feature(min_const_fn, const_panic)]

const fn foo() {
    panic!("")
}

fn main() {
    let _: &'static () = &foo();
}

causes an illegal hardware instruction. cc @oli-obk

@cramertj cramertj added the A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. label Sep 17, 2018
@OvermindDL1
Copy link

In debug mode, release mode, or both? I've seen this happen in release mode because it's undefined behaviour so an optimization pass kills it.

@matthiaskrgr
Copy link
Member

According to the playground it happens for both, release and debug.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 1, 2018

Yea we need to solve this before stabilization. When failing to generate the promoted static we can insert an actual panic.

@oli-obk oli-obk self-assigned this Oct 1, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Oct 26, 2018

This has been circumvented by #53851

@oli-obk oli-obk closed this as completed Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time.
Projects
None yet
Development

No branches or pull requests

4 participants