Skip to content

ICE: Associated type referencing itself #20772

Closed
@tobbebex

Description

@tobbebex
trait T : Iterator<Item=Self::Item>
{}

Compiling the above (admittedly ill-typed) file will cause

error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugr
eport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: did.krate != ast::LOCAL_CRATE', C:
\bot\slave\nightly-dist-rustc-win-64\build\src\librustc\middle\ty.rs:5362

stack backtrace:
   1:         0x69bee9cd - sys::backtrace::write::hd40c6de25ef01e0bfjt
   2:         0x69c01a32 - rt::unwind::register::hcb202fda23aef97aw7y
   3:         0x69b834a7 - rt::unwind::begin_unwind_inner::h43ca250f1ae88b3e64y
   4:           0x6a8bcc - middle::astencode::encode_inlined_item::h4b6b2c857184
2bb1Jja
   5:           0xa6541f - middle::ty::lookup_trait_def::ha89a0d2c5a879780Zv8
   6:           0xa88c19 - middle::ty::predicates_for_trait_ref::he59b587e624291
8d4w8
   7:           0xa5b65b - middle::traits::util::Elaborator<'cx, 'tcx>.Iterator:
:next::hcbe2c9744651548fo9T
   8:           0xa62347 - middle::traits::util::Supertraits<'cx, 'tcx>.Iterator
::next::h2e87d83ce16f061dZbU
   9:         0x6d5f70bc - rscope::ShiftedRscope<'r>.RegionScope::anon_regions::
h258921b49adee87bcYq
  10:         0x6d5992f8 - astconv::ast_ty_to_ty::h09671105f6afe18cwes
  11:         0x6d5ed3d8 - rscope::ShiftedRscope<'r>.RegionScope::anon_regions::
h258921b49adee87bcYq
  12:         0x6d5eb4c3 - rscope::ShiftedRscope<'r>.RegionScope::anon_regions::
h258921b49adee87bcYq
  13:         0x6d5ef7d1 - rscope::ShiftedRscope<'r>.RegionScope::anon_regions::
h258921b49adee87bcYq
  14:         0x6d5ee5a9 - rscope::ShiftedRscope<'r>.RegionScope::anon_regions::
h258921b49adee87bcYq
  15:         0x6d5ee071 - rscope::ShiftedRscope<'r>.RegionScope::anon_regions::
h258921b49adee87bcYq
  16:         0x6d62f749 - collect::CollectCtxt<'a, 'tcx>.AstConv<'tcx>::project
ed_ty::h5a3a931757c8bb85Gbt
  17:         0x6d60b2a1 - collect::CollectCtxt<'a, 'tcx>.AstConv<'tcx>::get_ite
m_type_scheme::hffebd1c9c5b2d6c3P8s
  18:         0x6d606312 - collect::CollectTraitDefVisitor<'a, 'tcx>.visit..Visi
tor<'v>::visit_item::h781513b01a393b7dP5s
  19:         0x6d66274f - check_crate::h862e87e9f04b6e0cNrx
  20:         0x6d6600b0 - check_crate::h862e87e9f04b6e0cNrx
  21:         0x70b18b2f - driver::phase_3_run_analysis_passes::hf7b2b2080ba4334
56va
  22:         0x70b027ba - driver::compile_input::h45b30318e07c4cf6vba
  23:         0x70bcaa1e - run::heefafb1ff7869308B4b
  24:         0x70bc786a - run::heefafb1ff7869308B4b
  25:         0x69c288fc - rust_try
  26:         0x69c288d9 - rust_try
  27:         0x70bc7fa9 - run::heefafb1ff7869308B4b
  28:         0x69bf3457 - sys::tcp::TcpListener::bind::hfcf283b88d14d24bfTv
  29:     0x7ffc65ad16ad - BaseThreadInitThunk

My version is

rustc 1.0.0-nightly (ea6f65c5f 2015-01-06 19:47:08 +0000)
binary: rustc
commit-hash: ea6f65c5f1a3f84e010d2cef02a0160804e9567a
commit-date: 2015-01-06 19:47:08 +0000
host: x86_64-pc-windows-gnu
release: 1.0.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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