Skip to content

Cannot compile regex: illegal hardware instruction #23032

Closed
@laumann

Description

@laumann

The new nightly caused this in regex: rust-lang/regex#50 - the fix is trivial, but it uncovers an illegal hardware instruction that seems to be a bug in rustc.

So far I have (disclaimer: the code is taken from regex)

type NamedClasses = &'static [(&'static str, &'static [(char, char)])];
static ASCII_CLASSES: NamedClasses = &[
     ("alnum", &ALNUM),
];
static ALNUM: &'static [(char, char)] = &[('0', '9'), ('A', 'Z'), ('a', 'z')];
fn main() { }

(playpen)

It seems to be related to f35f973, which changes a lot of statics to consts. In the above example, changing the static modifier of ALNUM to const also allows this to compile, so there is a workaround, but it still seems like a bug that should be addressed.

See:

$ rustc -Vv
rustc 1.0.0-dev (fed12499e 2015-03-03) (built 2015-03-04)
binary: rustc
commit-hash: fed12499e7d91f9cdfba5833e34d20e8fd19b898
commit-date: 2015-03-03
build-date: 2015-03-04
host: x86_64-unknown-linux-gnu
release: 1.0.0-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions