Closed
Description
I'm learning rust with the official doc, and accidentally encountered this issue.
I tried this code:
fn main () {
let x = 4;
match x {
ref r if *r < 0 => println!("got negative num {} < 0", r), //[1]
e @ 1 ... 100 => println!("got number within range [1,100] {}", e), //[2]
_ => println!("no"),
}
}
I expected to see this happen:
I expect the compiling being successful, based on the observation that it
compiles if there is only [1] or [2], which is to say in the above code sample
[1] and [2] don't co-exist.
Instead, this happened:
$ rustc bug.rs
error: internal compiler error: src/librustc_trans/base.rs:367: non-scalar type passed to compare_scalar_types
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>', src/libsyntax/errors/mod.rs:584
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Meta
rustc --version --verbose
:
$ rustc --verbose --version
rustc 1.10.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.10.0
and my operating system is Debian/Sid
, the rustc compiler is from Debian official archive.
Backtrace:
$ RUST_BACKTRACE=1 rustc bug.rs
error: internal compiler error: src/librustc_trans/base.rs:367: non-scalar type passed to compare_scalar_types
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
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', src/libsyntax/errors/mod.rs:584
stack backtrace:
1: 0x7ff8bea23cdf - <unknown>
2: 0x7ff8bea3178b - <unknown>
3: 0x7ff8bea3132c - <unknown>
4: 0x7ff8be9f785d - std::panicking::rust_panic_with_hook::h5dd7da6bb3d06020
5: 0x7ff8b9f6a037 - <unknown>
6: 0x7ff8b9f6999e - syntax::errors::Handler::bug::hb67a449bfdd4b525
7: 0x7ff8bafe7704 - <unknown>
8: 0x7ff8bafe750d - <unknown>
9: 0x7ff8bb000ce6 - rustc::session::bug_fmt::h3d079546792f3a77
10: 0x7ff8bc488196 - <unknown>
11: 0x7ff8bc58f290 - <unknown>
12: 0x7ff8bc58af6c - <unknown>
13: 0x7ff8bc592b99 - <unknown>
14: 0x7ff8bc55ac0d - <unknown>
15: 0x7ff8bc4ad96e - <unknown>
16: 0x7ff8bc4a5251 - <unknown>
17: 0x7ff8bc4a3aa8 - <unknown>
18: 0x7ff8bc4a5a16 - <unknown>
19: 0x7ff8bc4b026e - <unknown>
20: 0x7ff8bc4cc36d - _<base..TransItemsWithinModVisitor<'a, 'tcx> as rustc..hir..intravisit..Visitor<'v>>::visit_item::hf2a5fda0a4c4bb41
21: 0x7ff8bc4b9837 - rustc_trans::base::trans_crate::hdb9f0761c2bb8e02
22: 0x7ff8bef86493 - rustc_driver::driver::phase_4_translate_to_llvm::he77984ef06ab7894
23: 0x7ff8bef84308 - <unknown>
24: 0x7ff8bef80b1d - <unknown>
25: 0x7ff8bef7a23b - <unknown>
26: 0x7ff8bef41dcc - rustc_driver::driver::compile_input::hda370d330171d8d7
27: 0x7ff8bef2cfc4 - rustc_driver::run_compiler::ha942b7e1d33fe553
28: 0x7ff8bef2a09e - <unknown>
29: 0x7ff8bea3ff0b - <unknown>
30: 0x7ff8bea3feae - __rust_maybe_catch_panic
31: 0x7ff8bef2ab84 - <unknown>
32: 0x7ff8bea2fa04 - <unknown>
33: 0x7ff8b93c1463 - start_thread
34: 0x7ff8be68630c - clone
35: 0x0 - <unknown>