Skip to content

rayon type inference regression #49062

@cuviper

Description

@cuviper

The rayon tests are encountering a new type inference failure, and with the latest nightly, an ICE.

$ git describe HEAD
v1.0.0-14-g68aabe9e460f

$ rustc +nightly-2018-03-15 -Vv
rustc 1.26.0-nightly (521d91c6b 2018-03-14)
binary: rustc
commit-hash: 521d91c6be76367d966df419677dd187f799b116
commit-date: 2018-03-14
host: x86_64-unknown-linux-gnu
release: 1.26.0-nightly
LLVM version: 6.0

$ cargo +nightly-2018-03-15 test --lib --no-run
   Compiling [deps...]
   Compiling rayon v1.0.0 (file:///home/jistone/rust/rayon)
error[E0283]: type annotations required: cannot resolve `_: std::iter::Sum<&usize>`
   --> src/iter/test.rs:283:54
    |
283 |     assert_eq!(num.load(Ordering::Relaxed), a.iter().sum());
    |                                                      ^^^

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

thread 'rustc' panicked at 'Box<Any>', 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
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: core::ops::function::Fn::call
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:403
   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<T>>::try_with
  11: <std::thread::local::LocalKey<T>>::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::hir::Pat::walk_
  23: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_local
  24: rustc::hir::intravisit::walk_expr
  25: <rustc_typeck::check::regionck::RegionCtxt<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  26: rustc_typeck::check::regionck::RegionCtxt::visit_fn_body
  27: rustc_typeck::check::typeck_tables_of::{{closure}}
  28: rustc_typeck::check::typeck_tables_of
  29: rustc::dep_graph::graph::DepGraph::with_task_impl
  30: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::force
  31: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  32: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  33: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
  34: rustc_typeck::check::typeck_item_bodies
  35: rustc::dep_graph::graph::DepGraph::with_task_impl
  36: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::force
  37: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  38: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  39: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  40: rustc_typeck::check_crate
  41: rustc::ty::context::TyCtxt::create_and_enter
  42: rustc_driver::driver::compile_input
  43: rustc_driver::run_compiler

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 (521d91c6b 2018-03-14) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental

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

error: Could not compile `rayon`.

With nightly-2018-03-07, it reports the same "type annotations required" error, but no ICE.

The error itself is new to us, as just a few days ago we had no problem in CI. I narrowed this down to an update to compilertest_rs, from 0.3.7 to 0.3.8, even though that crate is not directly involved in the test that has the error. With 0.3.7, even the currently nightly is fine. With 0.3.8, nightly-2018-03-15 has the error and ICE, and nightly-2018-03-07 back to 2018-01-28 just have the error. (Earlier than that, 0.3.8 doesn't compile at all due to differences in the test crate.)

Metadata

Metadata

Assignees

Labels

A-inferenceArea: Type inferenceC-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleP-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions