Skip to content

ICE on nightly: <T as Tr<Y>>::does_not_exist() #44858

Closed
@WildCryptoFox

Description

@WildCryptoFox

Calling a function that doesn't exist on the resolved type in this form triggers an ICE. Neither T, Tr, nor Y need to exist, although they may all be valid and have an implementation present and it still triggers the ICE. Tested on play.rust-lang.org reproducible only under nightly.

// any of these may be commented out, only present to minimize rustc output
enum T {}
enum Y {}
trait Tr<T> {}
impl Tr<T> for Y {}

fn main() {
    <T as Tr<Y>>::f();
}
error[E0576]: cannot find method or associated constant `f` in trait `Tr`
 --> a.rs:7:19
  |
7 |     <T as Tr<Y>>::f()
  |                   ^ not found in `Tr`

error: internal compiler error: /checkout/src/librustc_typeck/check/mod.rs:2015: no type for node 20: type Y (id=20) in fcx 0x7f960c7f1fb0

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.22.0-nightly (26015da01 2017-09-23) running on x86_64-unknown-linux-gnu

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

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:492:8
stack backtrace:
   0:     0x7f9616b3d6b3 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::h2a9e14af3f0065cc
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7f9616b37b90 - std::sys_common::backtrace::_print::hc27476e0d59bdb15
                               at /checkout/src/libstd/sys_common/backtrace.rs:71
   2:     0x7f9616b4abc3 - std::panicking::default_hook::{{closure}}::h6a7eea827a24ed38
                               at /checkout/src/libstd/sys_common/backtrace.rs:60
                               at /checkout/src/libstd/panicking.rs:381
   3:     0x7f9616b4a8ca - std::panicking::default_hook::habb627a55b4d387b
                               at /checkout/src/libstd/panicking.rs:391
   4:     0x7f9616b4b087 - std::panicking::rust_panic_with_hook::h1f7ebd79d56e5191
                               at /checkout/src/libstd/panicking.rs:577
   5:     0x7f96122a4518 - std::panicking::begin_panic::he897cfa94a6a138c
   6:     0x7f96122c22c5 - rustc_errors::Handler::bug::h76b1a966506cba59
   7:     0x7f96137f9deb - rustc::session::opt_span_bug_fmt::{{closure}}::h253063bc1f8ec5ff
   8:     0x7f96137f9cf6 - rustc::session::opt_span_bug_fmt::h0bd95655d2d6830b
   9:     0x7f96137f99f1 - rustc::session::bug_fmt::h26e5bfdf576ed299
  10:     0x7f9615b23856 - rustc_typeck::check::FnCtxt::node_ty::h47eebf0ebc54db7b
  11:     0x7f9615ac0fd2 - <rustc_typeck::check::writeback::WritebackCx<'cx, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_ty::h00c38de0ec17121c
  12:     0x7f9615a913ee - rustc::hir::intravisit::walk_path_parameters::h73ce63ce5f0452b3
  13:     0x7f9615ac051d - <rustc_typeck::check::writeback::WritebackCx<'cx, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr::hf72080937ad48dbb
  14:     0x7f9615ac05c5 - <rustc_typeck::check::writeback::WritebackCx<'cx, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr::hf72080937ad48dbb
  15:     0x7f9615ac039f - <rustc_typeck::check::writeback::WritebackCx<'cx, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr::hf72080937ad48dbb
  16:     0x7f9615b15f89 - rustc_typeck::check::typeck_tables_of::{{closure}}::h3eb998793bdfab34
  17:     0x7f9615b11cc7 - rustc_typeck::check::typeck_tables_of::hb8eda2248a894b54
  18:     0x7f96136c790b - rustc::dep_graph::graph::DepGraph::with_task::hb3ae4b195d54f846
  19:     0x7f961392fc9d - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get::h002e4a0ab949fe90
  20:     0x7f96139dafad - rustc::ty::maps::TyCtxtAt::typeck_tables_of::h33407decb1a13f24
  21:     0x7f96139d77b6 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of::h4d13f2d2b4a7435e
  22:     0x7f9615b10fb7 - rustc_typeck::check::typeck_item_bodies::h98d87f98b3069830
  23:     0x7f96136b7c6f - rustc::dep_graph::graph::DepGraph::with_task::h5404d72eb9f370ad
  24:     0x7f961392e0ca - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get::h297e38f50ad04edf
  25:     0x7f96139dae7a - rustc::ty::maps::TyCtxtAt::typeck_item_bodies::ha52b14c24cb71fa0
  26:     0x7f96139d7786 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies::h801f2075b23e2964
  27:     0x7f9615b6d57b - rustc_typeck::check_crate::hb569b6d278b5618f
  28:     0x7f9616e6e017 - rustc::ty::context::TyCtxt::create_and_enter::h68b23017e50a257a
  29:     0x7f9616eeeb3f - rustc_driver::driver::compile_input::h4b53a88a4ff12535
  30:     0x7f9616f0ae42 - rustc_driver::run_compiler::h5449b0a3562f19d5
  31:     0x7f9616e26b07 - std::sys_common::backtrace::__rust_begin_short_backtrace::h90bfa6f101dbdb3b
  32:     0x7f9616b8545c - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:99
  33:     0x7f9616e5eea0 - <F as alloc::boxed::FnBox<A>>::call_box::h6d89ff63a6c79119
  34:     0x7f9616b49a8b - std::sys::imp::thread::Thread::new::thread_start::h839538f9c725756b
                               at /checkout/src/liballoc/boxed.rs:738
                               at /checkout/src/libstd/sys_common/thread.rs:24
                               at /checkout/src/libstd/sys/unix/thread.rs:90
  35:     0x7f9611a36476 - <unknown>
  36:     0x7f9616815d3e - clone
  37:                0x0 - <unknown>

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions