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: ty::TypeVariants::hash_stable() - Unexpected variant TyInfer(?0) #49159

Closed
joshlf opened this issue Mar 19, 2018 · 6 comments
Closed

ICE: ty::TypeVariants::hash_stable() - Unexpected variant TyInfer(?0) #49159

joshlf opened this issue Mar 19, 2018 · 6 comments
Labels
C-bug Category: This is a bug. 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

@joshlf
Copy link
Contributor

joshlf commented Mar 19, 2018

When running cargo check from this directory at this commit, I got the following ICE:

Output
error: internal compiler error: librustc/ich/impls_ty.rs:906: ty::TypeVariants::hash_stable() - Unexpected variant TyInfer(?0).

thread 'rustc' panicked at 'Box', librustc_errors/lib.rs:540:9
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
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: core::ops::function::Fn::call
5: std::panicking::rust_panic_with_hook
6: std::panicking::begin_panic
7: rustc_errors::Handler::bug
8: rustc::session::opt_span_bug_fmt::{{closure}}
9: rustc::ty::context::tls::with_opt::{{closure}}
10: <std::thread::local::LocalKey>::try_with
11: <std::thread::local::LocalKey>::with
12: rustc::ty::context::tls::with
13: rustc::ty::context::tls::with_opt
14: rustc::session::opt_span_bug_fmt
15: rustc::session::bug_fmt
16: rustc::ich::impls_ty::<impl rustc_data_structures::stable_hasher::HashStable<rustc::ich::hcx::StableHashingContext<'a>> for rustc::ty::sty::TypeVariants<'gcx>>::hash_stable
17: rustc::dep_graph::dep_node::DepNode::new
18: rustc::ty::maps::<impl rustc::ty::maps::queries::dropck_outlives<'tcx>>::try_get
19: rustc::ty::maps::TyCtxtAt::dropck_outlives
20: rustc::traits::query::dropck_outlives::<impl rustc::infer::at::At<'cx, 'gcx, 'tcx>>::dropck_outlives
21: rustc_typeck::check::dropck::check_safety_of_destructor_if_necessary
22: rustc_typeck::check::regionck::RegionCtxt::check_safety_of_rvalue_destructor_if_necessary
23: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
24: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
25: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
26: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
27: rustc_typeck::check::regionck::RegionCtxt::visit_fn_body
28: rustc_typeck::check::typeck_tables_of::{{closure}}
29: rustc_typeck::check::typeck_tables_of
30: rustc::dep_graph::graph::DepGraph::with_task_impl
31: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::force
32: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
33: rustc::ty::maps::TyCtxtAt::typeck_tables_of
34: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
35: rustc_typeck::check::typeck_item_bodies
36: rustc::dep_graph::graph::DepGraph::with_task_impl
37: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::force
38: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
39: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
40: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
41: rustc_typeck::check_crate
42: rustc::ty::context::TyCtxt::create_and_enter
43: rustc_driver::driver::compile_input
44: rustc_driver::run_compiler

Compiler details:

  • Version: rustc 1.26.0-nightly (392645394 2018-03-15) running on x86_64-apple-darwin
  • Flags: -C debuginfo=2 -C incremental --crate-type lib
@sapphire-arches
Copy link
Contributor

Possibly a duplicate of #49148

@sapphire-arches sapphire-arches added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. labels Mar 19, 2018
@ExpHP
Copy link
Contributor

ExpHP commented Mar 19, 2018

I can reproduce this. I cloned the repo, set rustup to nightly-2018-03-15, entered elfmalloc/, and ran cargo check (which ICE'd). Notably, it crashed on the first build; I mention this to contrast with #48923.

(I also tested the latest nightly-2018-03-18; it still crashes)

@ExpHP
Copy link
Contributor

ExpHP commented Mar 19, 2018

I mention this to contrast with #48923.

That said, guess what; CARGO_INCREMENTAL=0 cargo check does resolve the crash.

@Vlad-Shcherbina
Copy link

Minimized repro:

  1. cargo new ice_demo --lib
  2. Replace the content of the lib.rs with the following:
fn f() {
    zzz(2)
}
  1. cargo build --verbose
output
   Compiling ice_demo v0.1.0 (file:///C:/temp/ice_demo)
     Running `rustc --crate-name ice_demo src\lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=02ad0d1ab1100592 -C extra-filename=-02ad0d1ab1100592 --out-dir C:\temp\ice_demo\target\debug\deps -C incremental=C:\temp\ice_demo\target\debug\incremental -L dependency=C:\temp\ice_demo\target\debug\deps`
error[E0425]: cannot find function `zzz` in this scope
 --> src\lib.rs:2:5
  |
2 |     zzz(2)
  |     ^^^ not found in this scope

error: internal compiler error: librustc\ich\impls_ty.rs:906: ty::TypeVariants::hash_stable() - Unexpected variant TyInfer(?0).

thread 'rustc' panicked at 'Box<Any>', librustc_errors\lib.rs:543:9
stack backtrace:
   0: <std::sync::mpsc::select::Select as core::fmt::Debug>::fmt
   1: <std::stdsimd::arch::detect::linux::CpuInfoField<'a> as core::fmt::Debug>::fmt
   2: std::panicking::take_hook
   3: std::panicking::take_hook
   4: rustc::ty::structural_impls::<impl rustc::ty::context::Lift<'tcx> for syntax::ast::FloatTy>::lift_to_tcx
   5: std::panicking::rust_panic_with_hook
   6: <rustc_errors::lock::acquire_global_lock::Guard as core::ops::drop::Drop>::drop
   7: rustc_errors::Handler::bug
   8: rustc::session::config::nightly_options::check_nightly_options
   9: <&'a rustc::ty::Slice<rustc::ty::subst::Kind<'a>> as rustc::ty::context::Lift<'tcx>>::lift_to_tcx
  10: <&'a rustc::ty::Slice<rustc::ty::subst::Kind<'a>> as rustc::ty::context::Lift<'tcx>>::lift_to_tcx
  11: <rustc::util::common::ProfileQueriesMsg as core::fmt::Debug>::fmt
  12: <rustc::util::common::ProfileQueriesMsg as core::fmt::Debug>::fmt
  13: rustc::ty::context::tls::span_debug
  14: rustc::ty::context::tls::span_debug
  15: rustc::session::bug_fmt
  16: rustc::session::bug_fmt
  17: rustc::hir::map::describe_def
  18: rustc::ty::structural_impls::<impl rustc::ty::context::Lift<'tcx> for rustc::hir::InlineAsm>::lift_to_tcx
  19: rustc::dep_graph::dep_node::DepNode::new
  20: rustc::ty::maps::<impl rustc::ty::maps::queries::dropck_outlives<'tcx>>::try_get
  21: rustc::ty::maps::TyCtxtAt::dropck_outlives
  22: rustc::traits::query::dropck_outlives::<impl rustc::infer::at::At<'cx, 'gcx, 'tcx>>::dropck_outlives
  23: <rustc_typeck::variance::test::VarianceTest<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  24: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  25: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  26: <rustc_typeck::check::Diverges as core::fmt::Debug>::fmt
  27: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  28: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  29: <rustc_typeck::variance::terms::InferredIndex as core::fmt::Debug>::fmt
  30: <unknown>
  31: <rustc_typeck::variance::test::VarianceTest<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  32: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'v>>::visit_impl_item
  33: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  34: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
  35: rustc::dep_graph::graph::DepGraph::assert_ignored
  36: rustc::ty::structural_impls::<impl rustc::ty::context::Lift<'tcx> for rustc::hir::InlineAsm>::lift_to_tcx
  37: <rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx> as rustc::ty::layout::HasTyCtxt<'gcx>>::tcx
  38: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
  39: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  40: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  41: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
  42: <rustc_typeck::constrained_type_params::Parameter as core::fmt::Debug>::fmt
  43: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  44: rustc::dep_graph::graph::DepGraph::assert_ignored
  45: rustc::ty::structural_impls::<impl rustc::ty::context::Lift<'tcx> for rustc::hir::InlineAsm>::lift_to_tcx
  46: <rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx> as rustc::ty::layout::HasTyCtxt<'gcx>>::tcx
  47: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::ensure
  48: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  49: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  50: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  51: rustc_typeck::check_crate
  52: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
  53: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
  54: <rustc_driver::profile::trace::Query as core::fmt::Debug>::fmt
  55: rustc_driver::driver::compile_input
  56: rustc_driver::run_compiler
  57: rustc_driver::driver::build_output_filenames
  58: <unknown>
  59: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
  60: _rust_maybe_catch_panic
  61: rustc_driver::driver::build_output_filenames
  62: std::process::id
  63: std::sys::windows::thread::Thread::new
  64: BaseThreadInitThunk
  65: RtlUserThreadStart

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.26.0-nightly (5508b2714 2018-03-18) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

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

error: Could not compile `ice_demo`.

Caused by:
  process didn't exit successfully: `rustc --crate-name ice_demo src\lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=02ad0d1ab1100592 -C extra-filename=-02ad0d1ab1100592 --out-dir C:\temp\ice_demo\target\debug\deps -C incremental=C:\temp\ice_demo\target\debug\incremental -L dependency=C:\temp\ice_demo\target\debug\deps` (exit code: 101)
version info
> cargo --version --verbose
cargo 1.26.0-nightly (d6c3983fe 2018-03-16)
release: 1.26.0
commit-hash: d6c3983fe3bd8fa06b54712e53fb23645598188b
commit-date: 2018-03-16

> rustc --version --verbose
rustc 1.26.0-nightly (5508b2714 2018-03-18)
binary: rustc
commit-hash: 5508b27145cfb82896ae838e6aca0cd48750796f
commit-date: 2018-03-18
host: x86_64-pc-windows-msvc
release: 1.26.0-nightly
LLVM version: 6.0

@estebank
Copy link
Contributor

I'm unable to repro on stable, beta or nightly. Are you still seeing the ICE?

@estebank estebank added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 22, 2018
@ExpHP
Copy link
Contributor

ExpHP commented Jun 23, 2018

I am no longer able to repro it.

cargo +nightly build
# (build fails, no ICE)

# ...just to make sure I'm doing the repro right...
cargo +nightly-2018-03-16 build
# (ICE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. 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

5 participants