Closed
Description
Hello every (reading this) 😃
I seem to have encountered a compiler bug. As explained in the bug report docs, I am reporting this here.
Here's my rustc version (on 64bits Linux Ubuntu 14.04):
rustc 0.13.0-nightly (193390d0e 2014-12-11 22:56:54 +0000)
I am compiling this through Cargo:
cargo 0.0.1-pre-nightly (0f6667c 2014-12-08 21:19:01 +0000)
Here's a backtrace of the error:
error: internal compiler error: const expr(81: Check::Chars('<', '\x00', '\x00', '\x00')) of type Check has size 20 instead of 24
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:188
stack backtrace:
1: 0x7fcec950a500 - rt::backtrace::imp::write::heed5901f9756dd23BOx
2: 0x7fcec950d740 - failure::on_fail::ha44d264deefff4481fy
3: 0x7fcec915ef30 - unwind::begin_unwind_inner::h8d953f2c1d079705CJc
4: 0x7fcec6bad040 - unwind::begin_unwind::h6666496483973781562
5: 0x7fcec6bad8f0 - diagnostic::Handler::bug::h3a50c284fdf4e0a0baF
6: 0x7fcec7763c90 - session::Session::bug::h961d19b73812d5bclMz
7: 0x7fcec81efd40 - trans::consts::const_expr::hfa0dfd22263a486eY9n
8: 0x7fcec81f8d20 - trans::consts::const_expr_unadjusted::closure.43393
9: 0x7fcec81f7b60 - trans::expr::with_field_tys::h14927854885479319893
10: 0x7fcec81f2800 - trans::consts::const_expr_unadjusted::h8c6ef2cbf874918a5lo
11: 0x7fcec81efd40 - trans::consts::const_expr::hfa0dfd22263a486eY9n
12: 0x7fcec81f2800 - trans::consts::const_expr_unadjusted::h8c6ef2cbf874918a5lo
13: 0x7fcec81efd40 - trans::consts::const_expr::hfa0dfd22263a486eY9n
14: 0x7fcec81f2800 - trans::consts::const_expr_unadjusted::h8c6ef2cbf874918a5lo
15: 0x7fcec81efd40 - trans::consts::const_expr::hfa0dfd22263a486eY9n
16: 0x7fcec814f120 - trans::base::get_item_val::h5e961c6ea5c9b50aGhv
17: 0x7fcec814c020 - trans::base::trans_item::h567773db3b83315aeMu
18: 0x7fcec82135a0 - trans::base::trans_mod::hc21a44b9f586bc03JRu
19: 0x7fcec8217430 - trans::base::trans_crate::h03fccece3ec7cb85oIv
20: 0x7fcec9946540 - driver::phase_4_translate_to_llvm::hb8e7de445fc1ade7VCa
21: 0x7fcec992b260 - driver::compile_input::hf96889ff0bafd855pba
22: 0x7fcec99c8070 - run_compiler::h9db34658886d7891EYb
23: 0x7fcec99c7f60 - run::closure.21438
24: 0x7fcec99d9970 - task::TaskBuilder::try_future::closure.22892
25: 0x7fcec94e2980 - task::TaskBuilder::spawn_internal::closure.30605
26: 0x7fcec915cbd0 - task::Task::spawn::closure.5728
27: 0x7fcec91ba250 - rust_try_inner
28: 0x7fcec91ba240 - rust_try
29: 0x7fcec915ccb0 - unwind::try::hf2f7fcf7ecc46c43Tyc
30: 0x7fcec915ca70 - task::Task::run::h911f3b3bbb0c433efKb
31: 0x7fcec915c660 - task::Task::spawn::closure.5704
32: 0x7fcec915e0b0 - thread::thread_start::h051da3e5b33a422fw1b
33: 0x7fcec40480c0 - start_thread
34: 0x7fcec8e22ec9 - __clone
35: 0x0 - <unknown>
Could not compile `parser`.
Just in case it could help, here's the code I am trying to compile (the start of a HTML lexer with a state transition table):
// Lookahead of 3 symbols, which allows to see "!--" for a comment.
enum State {
General,
TagName,
TagAttributeName,
TagAttributeValue,
Text,
Doctype,
Comment
}
enum Check {
Function(fn(c1: char, c2: char, c3: char, c4: char) -> bool),
Chars(char, char, char, char)
}
struct Transition {
from: State,
to: State,
lookahead: u8,
through: Check,
save_char: bool,
save_previous_token: bool
}
static transition_table: &'static [Transition] = &[
Transition {
from: State::General,
to: State::TagName,
lookahead: 1,
through: Check::Chars('<', '\0', '\0', '\0'),
save_char: false,
save_previous_token: false,
}
];
fn main() {
let mut stdin = std::io::stdio::stdin();
for line_result in stdin.lock().lines() {
match line_result {
Ok(line) => {
let slice = line.as_slice().slice_to(line.len() - 1);
println!("{}", slice);
},
Err(err) => {
println!("{}", err);
return;
}
}
}
}
Hopefully, this can help. Please feel free to ask for more information if you need :-)