Skip to content

ICE when missing lifetime anotation on following code #23111

Closed
@nicolas-cherel

Description

@nicolas-cherel

ICE (panic) when compiling following code, adding lifetime to ValuesIter (as in commented line) fixes the crash

trait Data {
  fn values_iter(&self) -> Values;
}


struct Values<'a> {
  iter: Box<Iterator<Item=&'a Data>>
}

type ValuesIter<'a> = Box<Iterator<Item=&'a Data>>;

impl <'a> Values<'a> {
  // fn use_iter(consume_iter: ValuesIter<'a>) -> Values {  // non cashing version
  fn use_iter(consume_iter: ValuesIter) -> Values {
    Values {
      iter: consume_iter
    }
  }
}



fn main() {

}

meta

rustc --version --verbose
rustc 1.0.0-nightly (b47aebe3f 2015-02-26) (built 2015-02-26)
binary: rustc
commit-hash: b47aebe3fc2da06c760fd8ea19f84cbc41d34831
commit-date: 2015-02-26
build-date: 2015-02-26
host: x86_64-apple-darwin
release: 1.0.0-nightly

Backtrace

error: internal compiler error: unexpected panic
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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: !self.has_escaping_regions()', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/librustc/middle/ty.rs:1964

stack backtrace:
   1:          0x849d0f3 - sys::backtrace::write::h0c33dfca8f99823a7hA
   2:          0x84ca075 - panicking::on_panic::h63c237d7347b7375J0I
   3:          0x83f3888 - rt::unwind::begin_unwind_inner::h6bff9e2dc073eba1FJI
   4:          0x5184995 - rt::unwind::begin_unwind::h5603377685902845039
   5:          0x553bff0 - middle::traits::util::predicate_for_trait_ref::hc8b0e37ad45b6f00foT
   6:          0x54f4e9e - middle::traits::util::predicate_for_builtin_bound::h062017d79fea07a3ppT
   7:          0x537bd92 - middle::traits::fulfill::FulfillmentContext<'tcx>::register_builtin_bound::hfa096c6e6360d4a1sJN
   8:          0x4cf17a0 - check::FnCtxt<'a, 'tcx>::register_builtin_bound::h65b7bd738a5caf6cOJo
   9:          0x4d927c5 - check::check_fn::hcd6c5b82200e8b638kn
  10:          0x4dadbe1 - check::check_bare_fn::h15cf7ff47fb8abd6Oan
  11:          0x4db1984 - check::check_method_body::h2c61d934ba5574ddnIn
  12:          0x4da7305 - check::check_item::hdf505d0347935dc1stn
  13:          0x4e76fc3 - check_crate::closure.36015
  14:          0x4e72351 - check_crate::hcb2bf169ea38b50bEXB
  15:          0x47f58fb - driver::phase_3_run_analysis_passes::ha7dff75b48821bd6wFa
  16:          0x47daf31 - driver::compile_input::hae2a48b9668b0aa2Hba
  17:          0x48af037 - run_compiler::h299009668b50e3c8E5b
  18:          0x48ac4b1 - thunk::F.Invoke<A, R>::invoke::h1418038354819973823
  19:          0x48ab110 - rt::unwind::try::try_fn::h5455690823431792689
  20:          0x8542e29 - rust_try_inner
  21:          0x8542e16 - rust_try
  22:          0x48ab875 - thunk::F.Invoke<A, R>::invoke::h5089518861878639055
  23:          0x84b3453 - sys::thread::thread_start::h15d3d9d95ad88a69NDE
  24:         0x917db268 - _pthread_body
  25:         0x917db1e5 - _pthread_body

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