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

internal compiler error: src/librustc_mir_build/hair/constant.rs:60: impossible case reached #69310

Closed
dwrensha opened this issue Feb 20, 2020 · 8 comments · Fixed by #69330
Closed
Assignees
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dwrensha
Copy link
Contributor

dwrensha commented Feb 20, 2020

I'm seeing an internal compiler error on the following input (found by fuzz-rustc):

const X: [(); 0.1] = [()];
fn main() {}
$ rustc main.rs
error: internal compiler error: src/librustc_mir_build/hair/constant.rs:60: impossible case reached

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:881:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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: rustc 1.43.0-nightly (7760cd0fb 2020-02-19) running on x86_64-unknown-linux-gnu

error: aborting due to previous error

The error happens on nightly and beta, but not on stable.

Nightly backtrace

error: internal compiler error: src/librustc_mir_build/hair/constant.rs:60: impossible case reached

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:881:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1428
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::bug
  14: rustc_errors::Handler::bug
  15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc::ty::context::tls::with_opt::{{closure}}
  17: rustc::ty::context::tls::with_opt
  18: rustc::util::bug::opt_span_bug_fmt
  19: rustc::util::bug::bug_fmt
  20: rustc_mir_build::hair::constant::lit_to_const
  21: rustc::ty::query::__query_compute::lit_to_const
  22: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::lit_to_const>::compute
  23: rustc::dep_graph::graph::DepGraph::with_task_impl
  24: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  25: <dyn rustc_typeck::astconv::AstConv>::ast_const_to_const
  26: <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty
  27: rustc_typeck::collect::type_of::type_of
  28: rustc::ty::query::__query_compute::type_of
  29: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
  30: rustc::dep_graph::graph::DepGraph::with_task_impl
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  32: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_item
  33: rustc::hir::map::Map::visit_item_likes_in_module
  34: rustc_typeck::collect::collect_mod_item_types
  35: rustc::ty::query::__query_compute::collect_mod_item_types
  36: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute
  37: rustc::dep_graph::graph::DepGraph::with_task_impl
  38: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  39: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  40: rustc_session::session::Session::track_errors
  41: rustc_typeck::check_crate
  42: rustc_interface::passes::analysis
  43: rustc::ty::query::__query_compute::analysis
  44: rustc::dep_graph::graph::DepGraph::with_task_impl
  45: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  46: rustc::ty::context::tls::enter_global
  47: rustc_interface::interface::run_compiler_in_existing_thread_pool
  48: scoped_tls::ScopedKey<T>::set
  49: syntax::attr::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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: rustc 1.43.0-nightly (7760cd0fb 2020-02-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [lit_to_const] converting literal to const
#1 [type_of] processing `X`
#2 [collect_mod_item_types] collecting item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-const-eval Area: Constant evaluation (MIR interpretation) labels Feb 20, 2020
@pnkfelix
Copy link
Member

triage: P-high, assigning to self.

@pnkfelix pnkfelix self-assigned this Feb 20, 2020
@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Feb 20, 2020
@Centril Centril added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Feb 20, 2020
@pnkfelix
Copy link
Member

(This ended up being a great motivation for me to tie off some cargo-bisect-rustc work I've been doing...)

@pnkfelix
Copy link
Member

pnkfelix commented Feb 20, 2020

ICE was introduced between nightly 2020-01-15 and 2010-01-16.

Here are the merges from that time period:

3291ae33907f2a866ea6cea89113200555038d06 Auto merge of #68254 - Dylan-DPC:rollup-9vhc59u, r=Dylan-DPC
faf45c5dadc04e2ee2f2b772402321e621899641 Auto merge of #67603 - oli-obk:no_mut_static_ref_from_const, r=RalfJung
6d0bb91bcba33a70fae4b0c663fb4403ed78f071 Auto merge of #68248 - JohnTitor:rollup-x0kml5f, r=JohnTitor
c74353c7d2e61b111a9241490b9fbbd1ebe491fe Auto merge of #68221 - ehuss:update-cargo-rls, r=alexcrichton
632387f38dfbac0f2b8b8900c840fff7f1fb888e Auto merge of #66329 - ktrianta:mir-opt-unreachable-propagation, r=oli-obk
4b172cc73f5f1fb1e3d60527fb29605fa267985c Auto merge of #68118 - skinny121:eager_lit_eval, r=varkor

(cargo-bisect-rustc is independently working to identify which one is the culprit.)

@pnkfelix
Copy link
Member

Okay cargo-bisect-rustc finished:

Regression found in the compiler

searched nightlies: from nightly-2020-01-15 to nightly-2020-01-22
regressed nightly: nightly-2020-01-16
searched commits: from 8a87b94 to 3291ae3
regressed commit: 4b172cc

@pnkfelix
Copy link
Member

Looks like the problem was injected by PR #68118

@pnkfelix
Copy link
Member

reassigning to @Centril

@pnkfelix pnkfelix assigned Centril and unassigned pnkfelix Feb 20, 2020
@Centril
Copy link
Contributor

Centril commented Feb 20, 2020

The following also causes an ICE:

const X: [(); b"a"] = [()];
fn main() {}

(Same reason, but different message.)

@Centril
Copy link
Contributor

Centril commented Feb 20, 2020

Fixed by #69330.

@bors bors closed this as completed in 212aa3e Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants