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

ICE on exhaustive integer pattern #56659

Closed
ehuss opened this issue Dec 9, 2018 · 0 comments
Closed

ICE on exhaustive integer pattern #56659

ehuss opened this issue Dec 9, 2018 · 0 comments
Assignees
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ehuss
Copy link
Contributor

ehuss commented Dec 9, 2018

The following fails with an ICE:

let -2147483648..=2147483647 = 1;

with the following message:

error: internal compiler error: src/librustc_mir/build/matches/mod.rs:365: match pairs [MatchPair { place: _65, pattern: Pattern { ty: i32, span: src/main.rs:64:9: 64:33, kind: Range { lo: Const { ty: i32, val: Scalar(Bits { size: 4, bits: 2147483648 }) }, hi: Const { ty: i32, val: Scalar(Bits { size: 4, bits: 2147483647 }) }, ty: i32, end: Included } }, slice_len_checked: false }] remaining after simplifying irrefutable pattern
  --> src/main.rs:64:9
   |
64 |     let -2147483648..=2147483647 = 1;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^

thread 'main' panicked at 'Box<Any>', src/librustc_errors/lib.rs:538:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::span_bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::span_bug_fmt
  14: rustc_mir::build::matches::<impl rustc_mir::build::Builder<'a, 'gcx, 'tcx>>::place_into_pattern
  15: rustc_mir::build::block::<impl rustc_mir::build::Builder<'a, 'gcx, 'tcx>>::ast_block_stmts
  16: rustc_mir::build::expr::into::<impl rustc_mir::build::Builder<'a, 'gcx, 'tcx>>::into_expr
  17: rustc_mir::build::expr::into::<impl rustc_mir::build::Builder<'a, 'gcx, 'tcx>>::into_expr
  18: rustc_mir::build::expr::into::<impl rustc_mir::build::Builder<'a, 'gcx, 'tcx>>::into_expr
  19: rustc::ty::context::tls::with_related_context
  20: rustc::infer::InferCtxtBuilder::enter
  21: rustc_mir::build::mir_build
  22: rustc_mir::transform::mir_built
  23: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_built<'tcx>>::compute
  24: rustc::ty::context::tls::with_context
  25: rustc::dep_graph::graph::DepGraph::with_task_impl
  26: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  27: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  29: rustc_mir::transform::check_unsafety::unsafety_check_result
  30: rustc::ty::query::__query_compute::unsafety_check_result
  31: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::unsafety_check_result<'tcx>>::compute
  32: rustc::ty::context::tls::with_context
  33: rustc::dep_graph::graph::DepGraph::with_task_impl
  34: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  35: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  36: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  37: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::unsafety_check_result
  38: rustc_mir::transform::mir_const
  39: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_const<'tcx>>::compute
  40: rustc::ty::context::tls::with_context
  41: rustc::dep_graph::graph::DepGraph::with_task_impl
  42: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  43: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  44: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  45: rustc_mir::transform::mir_validated
  46: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_validated<'tcx>>::compute
  47: rustc::ty::context::tls::with_context
  48: rustc::dep_graph::graph::DepGraph::with_task_impl
  49: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  51: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  52: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::ensure_query
  53: rustc_borrowck::borrowck::borrowck
  54: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::borrowck<'tcx>>::compute
  55: rustc::ty::context::tls::with_context
  56: rustc::dep_graph::graph::DepGraph::with_task_impl
  57: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  58: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  59: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  60: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::par_body_owners
  61: rustc_borrowck::borrowck::check_crate
  62: rustc::util::common::time
  63: rustc::ty::context::tls::enter_context
  64: <std::thread::local::LocalKey<T>>::with
  65: rustc::ty::context::TyCtxt::create_and_enter
  66: rustc_driver::driver::compile_input
  67: rustc_driver::run_compiler_with_pool
  68: <scoped_tls::ScopedKey<T>>::set
  69: rustc_driver::run_compiler
  70: rustc_driver::monitor::{{closure}}
  71: __rust_maybe_catch_panic
  72: rustc_driver::run
  73: rustc_driver::main
  74: std::rt::lang_start::{{closure}}
  75: std::panicking::try::do_call
  76: __rust_maybe_catch_panic
  77: std::rt::lang_start_internal
  78: main
query stack during panic:
#0 [mir_built] processing `main`
#1 [unsafety_check_result] processing `main`
#2 [mir_const] processing `main`
#3 [mir_validated] processing `main`
#4 [borrowck] processing `main`
end of query stack
error: aborting due to previous error

rustc 1.32.0-nightly (4a45578 2018-12-07)

@estebank estebank added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html labels Dec 10, 2018
@varkor varkor self-assigned this Dec 10, 2018
kennytm added a commit to kennytm/rust that referenced this issue Dec 13, 2018
…bank

Fix irrefutable matches on integer ranges

Fixes rust-lang#56659.
kennytm added a commit to kennytm/rust that referenced this issue Dec 14, 2018
…bank

Fix irrefutable matches on integer ranges

Fixes rust-lang#56659.
kennytm added a commit to kennytm/rust that referenced this issue Dec 14, 2018
…bank

Fix irrefutable matches on integer ranges

Fixes rust-lang#56659.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants