Skip to content

ICE with zero-arm alt, no matter the type. Also unsafe pointers. #3096

Description

@bblum

All of the following programs (edit: not the second) produce 'Assertion pats.is_not_empty() failed', src/rustc/middle/check_alt.rs:80

This one should give a nonexhaustive error:

fn main() {
    alt () { } 
}

This one should compile and crash at runtime:

enum bottom { }

fn main() {
    let x = ptr::addr_of(()) as *bottom;
    alt unsafe { *x } { }
}

and I don't have the slightest idea what this one should do:

enum bottom { } 

fn main() {
    let x = ptr::addr_of(()) as *bottom;
    alt x { } 
}

Probably related #3037. The code in that bug compiles but it seems like the only zero-arm alt that can compile.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions