Skip to content

rustc crashed with empty Iterator trait implementation #20553

@davidsullins

Description

@davidsullins

This 3-liner crashes rustc:

struct CrashIt;
impl Iterator for CrashIt { }
fn main() { }

My original code did a lot more than that, but I tried to create the minimal repro case.

$ rustc --version --verbose
rustc 0.13.0-nightly (c6c786671 2015-01-04 00:50:59 +0000)
binary: rustc
commit-hash: c6c786671d692d7b13c2e5c68a53001327b4b125
commit-date: 2015-01-04 00:50:59 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly

$ RUST_BACKTRACE=1 rustc src/main.rs 
src/main.rs:2:1: 2:30 error: internal compiler error: impl `VtableImpl(impl_def_id=DefId { krate: 0, node: 7 }:CrashIt.Iterator, substs=Substs[types=[[];[];[]], regions=[[];[];[]]], nested=[[];[];[]])` did not contain projection for `Obligation(predicate=<CrashIt as TraitRef(CrashIt, core::iter::Iterator)>::Item,depth=0)`
src/main.rs:2 impl Iterator for CrashIt { }
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1:     0x7fbff73562d0 - sys::backtrace::write::h8532e701ef86014f4it
   2:     0x7fbff737bb00 - failure::on_fail::h7532e1f79d134d5dzvz
   3:     0x7fbff72e11c0 - rt::unwind::begin_unwind_inner::h97b151606151d62deaz
   4:     0x7fbff218ec60 - rt::unwind::begin_unwind::h15809447133099964284
   5:     0x7fbff218ebf0 - diagnostic::SpanHandler::span_bug::he8142ababcc30c39DFF
   6:     0x7fbff568de70 - middle::traits::project::project_type::h947eece142ef049d52P
   7:     0x7fbff568afd0 - middle::traits::project::opt_normalize_projection_type::hb3defb9cc9365d1e8UP
   8:     0x7fbff5678ba0 - middle::traits::project::normalize_projection_type::hdc293893275ee559JTP
   9:     0x7fbff568c470 - middle::traits::project::AssociatedTypeNormalizer<'a, 'b, 'tcx>.TypeFolder<'tcx>::fold_ty::h801cbd2cdff2eff1kSP
  10:     0x7fbff69492e0 - middle::ty_fold::Rc<T>.TypeFoldable<'tcx>::fold_with::h6325524173844043840
  11:     0x7fbff6949e90 - middle::ty_fold::VecPerParamSpace<T>.TypeFoldable<'tcx>::fold_with::h13884369302522804796
  12:     0x7fbff6965280 - check::FnCtxt<'a, 'tcx>::instantiate_bounds::hed550a9659b70335Oll
  13:     0x7fbff697dfc0 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>::check_impl::closure.29997
  14:     0x7fbff697a430 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>::with_fcx::hb1283961ed8977b7Gfi
  15:     0x7fbff6980d70 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>.Visitor<'v>::visit_item::h001ababd87597e37soi
  16:     0x7fbff6b6dfe0 - check_crate::unboxed_closure.40162
  17:     0x7fbff6b68c30 - check_crate::h19fb6dea5733566ajsx
  18:     0x7fbff78a7640 - driver::phase_3_run_analysis_passes::h46b1604d9f9f5633Tva
  19:     0x7fbff7895ae0 - driver::compile_input::h68b8602933aad8d7wba
  20:     0x7fbff7960eb0 - thunk::F.Invoke<A, R>::invoke::h18029802347644288836
  21:     0x7fbff795fc60 - rt::unwind::try::try_fn::h6518866316425934196
  22:     0x7fbff73e2400 - rust_try_inner
  23:     0x7fbff73e23f0 - rust_try
  24:     0x7fbff795ffb0 - thunk::F.Invoke<A, R>::invoke::h15513809553472565307
  25:     0x7fbff7367e40 - sys::thread::thread_start::h5ea7ba97235331d5a9v
  26:     0x7fbff19b2c20 - start_thread
  27:     0x7fbff6f83899 - clone
  28:                0x0 - <unknown>

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