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 via clippy when compiling rand: librustc/ty/context.rs:530: node_id_to_type: no type for node #50484

Closed
lorepozo opened this issue May 6, 2018 · 3 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@lorepozo
Copy link
Contributor

lorepozo commented May 6, 2018

To reproduce:

[dependencies]
rand = "0.5.0-pre.1" # latest rand
fn main() {}
# nightly-2018-05-05 is nightly when I created this issue:
$ rustup install nightly-2018-05-05
# supplied rev is latest master when I created this issue:
$ cargo install +nightly-2018-05-05 clippy --git https://github.com/rust-lang-nursery/rust-clippy --rev e6735dd --force
$ RUST_BACKTRACE=1 cargo +nightly-2018-05-05 clippy

Output:

    Checking libc v0.2.40
    Checking rand_core v0.1.0
error: internal compiler error: librustc/ty/context.rs:530: node_id_to_type: no type for node `expr 8 (id=293)`

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:554:9
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
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:467
   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: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::session::opt_span_bug_fmt
  13: rustc::session::bug_fmt
  14: rustc::ty::context::TypeckTables::expr_ty
  15: clippy_lints::consts::ConstEvalLateContext::expr
  16: clippy_lints::consts::constant_simple
  17: clippy_lints::utils::hir_utils::SpanlessEq::eq_expr
  18: clippy_lints::utils::hir_utils::SpanlessEq::eq_ty
  19: clippy_lints::utils::hir_utils::SpanlessEq::eq_stmt
  20: <clippy_lints::copies::CopyAndPaste as rustc::lint::LateLintPass<'a, 'tcx>>::check_expr
  21: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  22: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_block
  23: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  24: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_body
  25: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_nested_body
  26: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_fn
  27: rustc::hir::intravisit::walk_item
  28: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item
  29: rustc::hir::intravisit::walk_mod
  30: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_mod
  31: rustc::hir::intravisit::walk_item
  32: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item
  33: rustc::hir::intravisit::walk_mod
  34: <rustc::lint::context::LateContext<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_mod
  35: rustc::lint::context::check_crate
  36: rustc::ty::context::tls::enter_context
  37: <std::thread::local::LocalKey<T>>::with
  38: rustc::ty::context::TyCtxt::create_and_enter
  39: rustc_driver::driver::compile_input
  40: rustc_driver::run_compiler_impl
  41: <scoped_tls::ScopedKey<T>>::set
  42: syntax::with_globals
  43: rustc_driver::run_compiler
  44: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  45: std::panicking::try::do_call
  46: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  47: rustc_driver::run
  48: clippy_driver::main
  49: std::rt::lang_start::{{closure}}
  50: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  51: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  52: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:374
             at libstd/rt.rs:58
  53: main
  54: __libc_start_main
  55: _start
query stack during panic:
end of query stack
error: aborting due to previous error


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.27.0-nightly (f9bfe840f 2018-05-05) running on x86_64-unknown-linux-gnu

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

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

error: Could not compile `rand_core`.
warning: build failed, waiting for other jobs to finish...
error: build failed

This only happens when I run clippy — building works just fine.

@pietroalbini
Copy link
Member

cc @oli-obk

@pietroalbini pietroalbini added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. labels May 7, 2018
@oli-obk
Copy link
Contributor

oli-obk commented May 7, 2018

Tracked on the clippy repository: rust-lang/rust-clippy#2594

@mati865
Copy link
Contributor

mati865 commented May 7, 2018

As workaround you can call it like that:

cargo clippy   # this one will cause ICE
cargo check    # it will succeed where clippy failed
cargo clippy   # clippy shows suggestions without crash

mati865 referenced this issue in phansch/rust-clippy May 11, 2018
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants