Skip to content

Illegal Instruction Promoting const panic! #54305

Closed

Description

@cramertj

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

Activity

  1. OvermindDL1 commented on Sep 17, 2018

    @OvermindDL1

    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.

  2. matthiaskrgr commented on Sep 17, 2018

    @matthiaskrgr
    Member

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

  3. oli-obk commented on Oct 1, 2018

    @oli-obk
    Contributor

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

  4. self-assigned this
    on Oct 1, 2018
  5. oli-obk commented on Oct 26, 2018

    @oli-obk
    Contributor

    This has been circumvented by #53851

  6. added
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    on Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions