Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compiler panic] internal compiler error: src/librustc_trans/_match.rs:943: only string and byte strings supported in compare_values #35423

Closed
cdluminate opened this issue Aug 6, 2016 · 2 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@cdluminate
Copy link

cdluminate commented Aug 6, 2016

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>
@cdluminate
Copy link
Author

cdluminate commented Aug 6, 2016

This also makes the compiler panic:

fn main () {
  let x = 4;
  match x {
    ref r if *r < 0 => println!("got negative num {} < 0", r),
    //e @ 1 ... 100 => println!("got number within range [1,100] {}", e),
    101 | 102 => println!("no no no"),
    _ => println!("no"),
  }
}

it fails

$ rustc bug.rs
error: internal compiler error: src/librustc_trans/_match.rs:943: only string and byte strings supported in compare_values
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.

backtrace

$ RUST_BACKTRACE=1 rustc bug.rs
error: internal compiler error: src/librustc_trans/_match.rs:943: only string and byte strings supported in compare_values
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:     0x7f19a933bcdf - <unknown>
   2:     0x7f19a934978b - <unknown>
   3:     0x7f19a934932c - <unknown>
   4:     0x7f19a930f85d - std::panicking::rust_panic_with_hook::h5dd7da6bb3d06020
   5:     0x7f19a4882037 - <unknown>
   6:     0x7f19a488199e - syntax::errors::Handler::bug::hb67a449bfdd4b525
   7:     0x7f19a58ff704 - <unknown>
   8:     0x7f19a58ff50d - <unknown>
   9:     0x7f19a5918ce6 - rustc::session::bug_fmt::h3d079546792f3a77
  10:     0x7f19a6ea855c - <unknown>
  11:     0x7f19a6ea25c0 - <unknown>
  12:     0x7f19a6eaab99 - <unknown>
  13:     0x7f19a6e72c0d - <unknown>
  14:     0x7f19a6dc596e - <unknown>
  15:     0x7f19a6dbd251 - <unknown>
  16:     0x7f19a6dbbaa8 - <unknown>
  17:     0x7f19a6dbda16 - <unknown>
  18:     0x7f19a6dc826e - <unknown>
  19:     0x7f19a6de436d - _<base..TransItemsWithinModVisitor<'a, 'tcx> as rustc..hir..intravisit..Visitor<'v>>::visit_item::hf2a5fda0a4c4bb41
  20:     0x7f19a6dd1837 - rustc_trans::base::trans_crate::hdb9f0761c2bb8e02
  21:     0x7f19a989e493 - rustc_driver::driver::phase_4_translate_to_llvm::he77984ef06ab7894
  22:     0x7f19a989c308 - <unknown>
  23:     0x7f19a9898b1d - <unknown>
  24:     0x7f19a989223b - <unknown>
  25:     0x7f19a9859dcc - rustc_driver::driver::compile_input::hda370d330171d8d7
  26:     0x7f19a9844fc4 - rustc_driver::run_compiler::ha942b7e1d33fe553
  27:     0x7f19a984209e - <unknown>
  28:     0x7f19a9357f0b - <unknown>
  29:     0x7f19a9357eae - __rust_maybe_catch_panic
  30:     0x7f19a9842b84 - <unknown>
  31:     0x7f19a9347a04 - <unknown>
  32:     0x7f19a3cd9463 - start_thread
  33:     0x7f19a8f9e30c - clone
  34:                0x0 - <unknown>

@TimNN
Copy link
Contributor

TimNN commented Aug 6, 2016

The second issue looks like a duplicate of #33498 and both issues seem to be fixed on nightly.

@Aatch Aatch added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Aug 8, 2016
@eddyb eddyb added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 24, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Aug 29, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Aug 30, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Aug 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants