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

Internal compiler error: Implementation missing trait type parameter panics compiler #20536

Closed
araujol opened this issue Jan 4, 2015 · 3 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@araujol
Copy link

araujol commented Jan 4, 2015

When trying to compile the following code snippet from the project rust-efl:

impl<'r, T> Iterator for EinaList<'r, T> {
    fn next(&mut self) -> Option<&'r T> {
        let v = list_data_get(self._eo);
        *self = match list_next(self._eo) {
            None => EinaList { _eo: ptr::null_mut() },
            Some(l) => EinaList { _eo: l }
        };
        return v
    }
}

The compiler throws the following error (backtrace included):

src/eio.rs:27:3: 27:18 warning: `deriving` is deprecated; use `derive`
src/eio.rs:27 #[deriving(Show)]
                ^~~~~~~~~~~~~~~
src/eet.rs:69:3: 69:33 warning: `deriving` is deprecated; use `derive`
src/eet.rs:69 #[deriving(Show, FromPrimitive)]
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/eina.rs:196:1: 207:2 error: internal compiler error: impl `VtableImpl(impl_def_id=DefId { krate: 0, node: 2766 }:eina::EinaList<'r, T>.Iterator, substs=Substs[types=[[_];[];[]], regions=[['_#0r];[];[]]], nested=[[Obligation(predicate=Binder(TraitPredicate(TraitRef(T, core::kinds::Sized))),depth=1)];[];[]])` did not contain projection for `Obligation(predicate=<eina::EinaList<'r, T> as TraitRef(eina::EinaList<'r, T>, core::iter::Iterator)>::Item,depth=0)`
src/eina.rs:196 impl<'r, T> Iterator for EinaList<'r, T> {
src/eina.rs:197 
src/eina.rs:198     fn next(&mut self) -> Option<&'r T> {
src/eina.rs:199         let v = list_data_get(self._eo);
src/eina.rs:200         *self = match list_next(self._eo) {
src/eina.rs:201             None => EinaList { _eo: ptr::null_mut() },
                ...
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: 0x40233e30 - sys::backtrace::write::hd07b456e2fb2edc64it
   2: 0x40258680 - failure::on_fail::hc26c935da551c95azvz
   3: 0x401c0c10 - rt::unwind::begin_unwind_inner::he25945c8d3f9a8c2eaz
   4: 0x43c32c60 - rt::unwind::begin_unwind::h5827585231859819369
   5: 0x43c32bd0 - diagnostic::SpanHandler::span_bug::h9f9dede6a55a96f0DFF
   6: 0x4133ad30 - middle::traits::project::project_type::h2397f2bdf09c070052P
   7: 0x41337e20 - middle::traits::project::opt_normalize_projection_type::h9840021934a72d668UP
   8: 0x41326640 - middle::traits::project::normalize_projection_type::h784de1d4a68f87bfJTP
   9: 0x413391c0 - middle::traits::project::AssociatedTypeNormalizer<'a, 'b, 'tcx>.TypeFolder<'tcx>::fold_ty::h93dc24df4c299e53kSP
  10: 0x4078b870 - middle::ty_fold::Rc<T>.TypeFoldable<'tcx>::fold_with::h14798399643135356730
  11: 0x4078c460 - middle::ty_fold::VecPerParamSpace<T>.TypeFoldable<'tcx>::fold_with::h9678217035264924423
  12: 0x407a85c0 - check::FnCtxt<'a, 'tcx>::instantiate_bounds::h965cba437f15b636Oll
  13: 0x407c1050 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>::check_impl::closure.29994
  14: 0x407bd180 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>::with_fcx::h551410613b5bc2f0Gfi
  15: 0x407c3d40 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>.Visitor<'v>::visit_item::h42e9f9bd2e45c68esoi
  16: 0x407c58c0 - visit::walk_mod::h8273770565610179432
  17: 0x407c3d40 - check::wf::CheckTypeWellFormedVisitor<'ccx, 'tcx>.Visitor<'v>::visit_item::h42e9f9bd2e45c68esoi
  18: 0x409cad20 - check_crate::unboxed_closure.40159
  19: 0x409c5560 - check_crate::h1a6ec5dffa2bd3a7jsx
  20: 0x40060dc0 - driver::phase_3_run_analysis_passes::hdf5c0700c25562beTva
  21: 0x4004ee90 - driver::compile_input::hc6337ba6b18bc0dewba
  22: 0x40121170 - thunk::F.Invoke<A, R>::invoke::h8973449830402138319
  23: 0x4011ff80 - rt::unwind::try::try_fn::h4951350354602804749
  24: 0x402c8ba0 - rust_try_inner
  25: 0x402c8b70 - rust_try
  26: 0x401202c0 - thunk::F.Invoke<A, R>::invoke::h9098173034894979218
  27: 0x402455d0 - sys::thread::thread_start::h92aa6f5030fe4b1ca9v
  28: 0x443d1ea0 - start_thread
  29: 0x4063c472 - clone
  30:        0x0 - <unknown>

make: *** [libefl.rlib] Error 101

rustc version:

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: i686-unknown-linux-gnu
release: 0.13.0-nightly
@araujol araujol changed the title Internal compiler error: Implementation missing type parameter panics compiler Internal compiler error: Implementation missing trait type parameter panics compiler Jan 4, 2015
@japaric
Copy link
Member

japaric commented Jan 4, 2015

I think this is a duplicate of #20532. You need to add the output type to your Iterator impl:

impl<'r, T> Iterator for EinaList<'r, T> {
    type Output = &'r T;

    fn next(&mut self) -> Option<&'r T> {
        // ...
    }
}

@araujol
Copy link
Author

araujol commented Jan 4, 2015

Thanks!

After checking around some Iterator implementations, the correct type is Item, this actually makes the compiler pass:

type Item = &'r T;

@kmcallister kmcallister added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 4, 2015
@huonw
Copy link
Member

huonw commented Jan 5, 2015

Closing as a dupe of #20347, thanks for filing!

@huonw huonw closed this as completed Jan 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants