Skip to content

ICE on invalid code #46880

Closed
Closed
@ricochet1k

Description

@ricochet1k

Rust compiler is failing on bad code. I had just refactored from using UnboundedSender from futures::sync::mpsc, to using it as mpsc::UnboundedSender but I missed a spot. The commit that fixes the issue is here, the code at the previous commit is the one that actually crashes. I was running it with env RUSTFLAGS="-Z external-macro-backtrace" RUST_BACKTRACE=full cargo run test.js

error: internal compiler error: unexpected panic

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.24.0-nightly (edbd7d232 2017-12-20) running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'explicit panic', /checkout/src/librustc_typeck/check/cast.rs:110:17
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 /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at /checkout/src/libstd/sys_common/backtrace.rs:68
             at /checkout/src/libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:391
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
   6: rustc_typeck::check::cast::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::pointer_kind
   7: rustc_typeck::check::cast::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::pointer_kind
   8: rustc_typeck::check::cast::CastCheck::check
   9: rustc_typeck::check::FnCtxt::check_casts
  10: <std::thread::local::LocalKey<T>>::with
  11: rustc::ty::context::GlobalCtxt::enter_local
  12: rustc_typeck::check::typeck_tables_of
  13: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::compute_result
  14: rustc::dep_graph::graph::DepGraph::with_task_impl
  15: rustc_errors::Handler::track_diagnostics
  16: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  17: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::force
  18: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  19: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  20: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
  21: rustc_typeck::check::typeck_tables_of
  22: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::compute_result
  23: rustc::dep_graph::graph::DepGraph::with_task_impl
  24: rustc_errors::Handler::track_diagnostics
  25: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  26: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::force
  27: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  28: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  29: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure
  30: rustc::session::Session::track_errors
  31: rustc_typeck::check::typeck_item_bodies
  32: rustc::dep_graph::graph::DepGraph::with_task_impl
  33: rustc_errors::Handler::track_diagnostics
  34: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  35: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::force
  36: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  37: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  38: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  39: rustc_typeck::check_crate
  40: <std::thread::local::LocalKey<T>>::with
  41: <std::thread::local::LocalKey<T>>::with
  42: rustc::ty::context::TyCtxt::create_and_enter
  43: rustc_driver::driver::compile_input
  44: rustc_driver::run_compiler

error: Could not compile `rjs`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions