Closed
Description
When an enum value is incorrectly initialized as a variant, the Rust compiler slips on ICE.
Minimal
#[derive(PartialEq, PartialOrd, Clone, Debug)]
pub enum Sexp {
/// A symbol or alist key
List(Vec<Sexp>)
}
#[derive(Debug, Clone, Copy, PartialEq)]
enum InvalidType {
ExpectingList
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum SexpError {
InvalidType(InvalidType)
}
impl Sexp {
pub fn delq(&self, other: Sexp) -> Result<Sexp, SexpError> {
match *self {
// I'm using unimplemented!() here to save space
// changing the implementation here still makes some ICE.
Sexp::List(ref elts) => unimplemented!(),
_ => Err(SexpError::InvalidType::ExpectingList)
}
}
}
Meta
rustc --version --verbose
:
rustc 1.16.0-nightly (47c8d9fdc 2017-01-08)
binary: rustc
commit-hash: 47c8d9fdcf2e6502cf4ca7d7f059fdc1a2810afa
commit-date: 2017-01-08
host: x86_64-unknown-linux-gnu
release: 1.16.0-nightly
LLVM version: 3.9
Backtrace
[zv@syszv] sexpattern/src [icetest*] >> RUSTC_BACKTRACE=1 cargo build --verbose
Fresh rustc-serialize v0.3.22
Compiling sexpr v0.1.0 (file:///home/zv/Development/sexpattern)
Running `rustc --crate-name sexpr lib.rs --crate-type lib --emit=dep-info,link -g -C metadata=d26636fcff6495c9 -C extra-filename=-d26636fcff6495c9 --out-dir /home/zv/Development/sexpattern/target/debug/deps -L dependency=/home/zv/Development/sexpattern/target/debug/deps --extern rustc_serialize=/home/zv/Development/sexpattern/target/debug/deps/librustc_serialize-03b62901d97343ea.rlib`
error: internal compiler error: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_typeck/astconv.rs:1516: unexpected definition: Variant(DefId { krate: CrateNum(0), node: DefIndex(75) => sexpr/65558c22e5fda111eadb1d551ef66576::SexpError[0]::InvalidType[0] })
--> lib.rs:21:22
|
21 | _ => Err(SexpError::InvalidType::ExpectingList)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'Box<Any>', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_errors/lib.rs:382
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Could not compile `sexpr`.
Caused by:
process didn't exit successfully: `rustc --crate-name sexpr lib.rs --crate-type lib --emit=dep-info,link -g -C metadata=d26636fcff6495c9 -C extra-filename=-d26636fcff6495c9 --out-dir /home/zv/Development/sexpattern/target/debug/deps -L dependency=/home/zv/Development/sexpattern/target/debug/deps --extern rustc_serialize=/home/zv/Development/sexpattern/target/debug/deps/librustc_serialize-03b62901d97343ea.rlib` (exit code: 101)
Metadata
Metadata
Assignees
Labels
No labels