Skip to content

ICE: ReEarlyBound in methods containing Self #24227

Closed
@Munksgaard

Description

@Munksgaard

I've encountered an ICE when methods on structs using lifetime parameters try create a value of type Self.

struct Foo<'a> {
    x: &'a u8
}

impl<'a> Foo<'a> {
    fn foo() {
        let mut tmp: Self;
    }

}

fn main() {}
$ RUST_BACKTRACE=1 rustc bug.rs
bug.rs:7:13: 7:20 error: internal compiler error: Encountered early bound region when generalizing: ReEarlyBound(19, TypeSpace, 0, 'a)
bug.rs:7         let mut tmp: Self;
                     ^~~~~~~
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 'Box<Any>', /home/munksgaard/src/rust/src/libsyntax/diagnostic.rs:131

stack backtrace:
   1:     0x7fa8382d38a8 - sys::backtrace::write::h39b34852f705a3aaXNC
   2:     0x7fa8382fee17 - panicking::on_panic::h3787cd9e55f0f2a11dJ
   3:     0x7fa838235783 - rt::unwind::begin_unwind_inner::h92e1fddaf640050d9SI
   4:     0x7fa8355dd44d - rt::unwind::begin_unwind::h5278270791953830669
   5:     0x7fa8355dd3f3 - diagnostic::SpanHandler::span_bug::h294fb9221d91cea3ImB
   6:     0x7fa8360d0c91 - middle::infer::combine::Generalizer<'cx, 'tcx>.ty_fold..TypeFolder<'tcx>::fold_region::hb5d7079b0fe7c420Yjq
   7:     0x7fa8360d0720 - middle::ty_fold::TypeFolder::fold_substs::h15691027943603330473
   8:     0x7fa8360d007e - middle::infer::combine::Generalizer<'cx, 'tcx>.ty_fold..TypeFolder<'tcx>::fold_ty::h853a4723d7c697da2iq
   9:     0x7fa8360bf2db - middle::infer::combine::CombineFields<'a, 'tcx>::instantiate::h8b7c7884847ad0b7Bbq
  10:     0x7fa8360ce06e - middle::infer::equate::Equate<'a, 'tcx>.TypeRelation<'a, 'tcx>::tys::h9518f5feb454ab89xpq
  11:     0x7fa836150eb5 - middle::infer::InferCtxt<'a, 'tcx>::eq_types::he9bdd75e99c520c2Koz
  12:     0x7fa836150b60 - middle::infer::mk_eqty::h8bc6b3fcb4e134c7t1y
  13:     0x7fa836f1be7b - check::_match::check_pat::h89041d87685f35e5h1a
  14:     0x7fa83705bc71 - check::check_decl_local::h72beef581d0795baKks
  15:     0x7fa836ffd7a0 - check::check_block_with_expected::hc3cbbdc8a7deb0c3Qqs
  16:     0x7fa836fda619 - check::check_fn::h0078d582bbbff20d1co
  17:     0x7fa836ff7d9c - check::check_bare_fn::h4e964f724355f83eA2n
  18:     0x7fa836ffe279 - check::check_method_body::h0e7ee18eae36ae6dqAo
  19:     0x7fa836ff5384 - check::check_item::h41cf2be02273191cllo
  20:     0x7fa8370cb1a6 - check_crate::closure.36547
  21:     0x7fa8370c56f3 - check_crate::h9dd63076fd25d184ZxC
  22:     0x7fa83896726d - driver::phase_3_run_analysis_passes::he2d793b90e64896fgGa
  23:     0x7fa83894b075 - driver::compile_input::hda2d4b528c0e983eQba
  24:     0x7fa838a02d95 - run_compiler::h53d271fd8686c62aS4b
  25:     0x7fa838a006ad - boxed::F.FnBox<A>::call_box::h11350744607812496552
  26:     0x7fa8389ffbe9 - rt::unwind::try::try_fn::h8804245627722218039
  27:     0x7fa838386aa8 - rust_try_inner
  28:     0x7fa838386a95 - rust_try
  29:     0x7fa8389ffebb - boxed::F.FnBox<A>::call_box::h13286046172660462226
  30:     0x7fa8382e9e01 - sys::thread::create::thread_start::hd8ad3d5237d43133jOH
  31:     0x7fa8321d92c3 - <unknown>
  32:     0x7fa837eae2dc - __clone
  33:                0x0 - <unknown>

rustc 1.0.0-dev (0e5e66927 2015-04-09) (built 2015-04-09)

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