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

ICE with lifetimes and associated types #20582

Closed
mneumann opened this issue Jan 5, 2015 · 0 comments
Closed

ICE with lifetimes and associated types #20582

mneumann opened this issue Jan 5, 2015 · 0 comments
Assignees
Labels
A-associated-items Area: Associated items (types, constants & functions) A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@mneumann
Copy link
Contributor

mneumann commented Jan 5, 2015

The program in question:

// t.rs
#![feature(associated_types)]

struct Foo<'a> {
    buf: &'a[u8]
}

impl<'a> Iterator for Foo<'a> {
    type Item = &'a[u8];

    fn next(&mut self) -> Option<<Self as Iterator>::Item> {
    //THIS WORKS: fn next(&mut self) -> Option<&'a[u8]> {
        Some(self.buf)
    }
}

fn main() {
}

Fails with:

# rustc --version
rustc 0.13.0-nightly (c6c786671 2015-01-04 00:50:59 +0000)

# RUST_BACKTRACE=1 rustc t.rs
t.rs:3:1: 5:2 warning: struct is never used: `Foo`, #[warn(dead_code)] on by default
t.rs:3 struct Foo<'a> {
t.rs:4     buf: &'a[u8]
t.rs:5 }
t.rs:1:1: 1:1 error: internal compiler error: cannot relate bound region: '_#0r <= ReEarlyBound(38, TypeSpace, 0, 'a)
t.rs:1 #![feature(associated_types)]
       ^
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:     0x7fdf7acc52d0 - sys::backtrace::write::h8532e701ef86014f4it
   2:     0x7fdf7aceab00 - failure::on_fail::h7532e1f79d134d5dzvz
   3:     0x7fdf7ac501c0 - rt::unwind::begin_unwind_inner::h97b151606151d62deaz
   4:     0x7fdf75b24c60 - rt::unwind::begin_unwind::h15809447133099964284
   5:     0x7fdf75b24bf0 - diagnostic::SpanHandler::span_bug::he8142ababcc30c39DFF
   6:     0x7fdf78f883c0 - middle::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_subregion::h4894010abd5842ddRew
   7:     0x7fdf78f24620 - middle::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_eqregion::haf414bd9d86c8f74few
   8:     0x7fdf78f24350 - middle::infer::equate::Equate<'f, 'tcx>.Combine<'tcx>::regions::hfbdb19d5c7340e32vbr
   9:     0x7fdf78f291a0 - middle::infer::combine::Combine::substs_variances::h10247305425180389096
  10:     0x7fdf78f27ca0 - middle::infer::combine::Combine::substs::h14741200973438308956
  11:     0x7fdf78f1d910 - middle::infer::equate::Equate<'f, 'tcx>.Combine<'tcx>::tys::hc9258a93ddaf1f1d9hr
  12:     0x7fdf78f354b0 - middle::infer::combine::Combine::tps::unboxed_closure.74647
  13:     0x7fdf78f33850 - middle::infer::combine::Combine::substs_variances::h15023683884087328428
  14:     0x7fdf78f33790 - middle::infer::combine::Combine::substs::h6409605246681804273
  15:     0x7fdf78f334f0 - middle::infer::combine::Combine::trait_refs::h10655637296263412357
  16:     0x7fdf78fab7d0 - middle::infer::InferCtxt<'a, 'tcx>::sub_trait_refs::h47d2b8aae7b2596472A
  17:     0x7fdf79044d10 - middle::traits::select::SelectionContext<'cx, 'tcx>::match_impl::hb52ab063e7e4913dPzT
  18:     0x7fdf7904eaa0 - middle::traits::select::SelectionContext<'cx, 'tcx>::assemble_candidates_from_impls::h3156cc6e5773eeeafmS
  19:     0x7fdf790490e0 - middle::traits::select::SelectionContext<'cx, 'tcx>::candidate_from_obligation_no_cache::hee5fb56560ec1364MER
  20:     0x7fdf79039e40 - middle::traits::select::SelectionContext<'cx, 'tcx>::candidate_from_obligation::hb1931a349a9a6aa5exR
  21:     0x7fdf79016a20 - middle::traits::select::SelectionContext<'cx, 'tcx>::select::h645cb0d6a6e6eb40dcR
  22:     0x7fdf79023e70 - middle::traits::project::project_type::h947eece142ef049d52P
  23:     0x7fdf79020fd0 - middle::traits::project::opt_normalize_projection_type::hb3defb9cc9365d1e8UP
  24:     0x7fdf7900eba0 - middle::traits::project::normalize_projection_type::hdc293893275ee559JTP
  25:     0x7fdf79022470 - middle::traits::project::AssociatedTypeNormalizer<'a, 'b, 'tcx>.TypeFolder<'tcx>::fold_ty::h801cbd2cdff2eff1kSP
  26:     0x7fdf790234c0 - vec::Vec<T>.FromIterator<T>::from_iter::h16193845141216249604
  27:     0x7fdf79023380 - middle::subst::VecPerParamSpace<T>::map_enumerated::h14775177066643949913
  28:     0x7fdf79022fc0 - middle::ty_fold::super_fold_substs::h1314162558240838980
  29:     0x7fdf79022470 - middle::traits::project::AssociatedTypeNormalizer<'a, 'b, 'tcx>.TypeFolder<'tcx>::fold_ty::h801cbd2cdff2eff1kSP
  30:     0x7fdf79023bc0 - middle::ty_fold::super_fold_fn_sig::h17017241928507571730
  31:     0x7fdf79022470 - middle::traits::project::AssociatedTypeNormalizer<'a, 'b, 'tcx>.TypeFolder<'tcx>::fold_ty::h801cbd2cdff2eff1kSP
  32:     0x7fdf79bced70 - trans::base::decl_rust_fn::h076b87abca711100IYr
  33:     0x7fdf79be41e0 - trans::base::register_fn::he826b21665129f50jxu
  34:     0x7fdf79be61d0 - trans::base::register_method::ha6bb45ad72d0525eDbv
  35:     0x7fdf79afb580 - trans::base::get_item_val::he68ea40c5ecdc62fjUu
  36:     0x7fdf79af9300 - trans::base::trans_item::ha0e598b4af14d13fQpu
  37:     0x7fdf79be6a60 - trans::base::trans_crate::hf12b6e99a3af9ab9blv
  38:     0x7fdf7b225250 - driver::phase_4_translate_to_llvm::h40ce54ee4a878885vFa
  39:     0x7fdf7b204ae0 - driver::compile_input::h68b8602933aad8d7wba
  40:     0x7fdf7b2cfeb0 - thunk::F.Invoke<A, R>::invoke::h18029802347644288836
  41:     0x7fdf7b2cec60 - rt::unwind::try::try_fn::h6518866316425934196
  42:     0x7fdf7ad51400 - rust_try_inner
  43:     0x7fdf7ad513f0 - rust_try
  44:     0x7fdf7b2cefb0 - thunk::F.Invoke<A, R>::invoke::h15513809553472565307
  45:     0x7fdf7acd6e40 - sys::thread::thread_start::h5ea7ba97235331d5a9v
  46:     0x7fdf75348fa0 - <unknown>
  47:     0x7fdf7a907479 - clone
  48:                0x0 - <unknown>
@kmcallister kmcallister added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-associated-items Area: Associated items (types, constants & functions) labels Jan 5, 2015
@aturon aturon mentioned this issue Jan 6, 2015
47 tasks
@nikomatsakis nikomatsakis self-assigned this Jan 7, 2015
@nikomatsakis nikomatsakis added the A-closures Area: Closures (`|…| { … }`) label Jan 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants