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: ReEarlyBound in methods containing Self #24227

Closed
Munksgaard opened this issue Apr 9, 2015 · 8 comments
Closed

ICE: ReEarlyBound in methods containing Self #24227

Munksgaard opened this issue Apr 9, 2015 · 8 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@Munksgaard
Copy link
Contributor

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)
@Munksgaard
Copy link
Contributor Author

For the record, the above code works with alpha2. It's only in the last couple of days that it has happened.

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Apr 9, 2015
zsiciarz added a commit to zsiciarz/24daysofrust that referenced this issue Apr 12, 2015
@laumann
Copy link
Contributor

laumann commented Apr 15, 2015

Adding to the record, this does not appear to be a problem in beta: http://is.gd/ZLVqTF, but it is a problem in nightly: http://is.gd/0NiZTx

laumann pushed a commit to Manishearth/humpty_dumpty that referenced this issue Apr 15, 2015
@ghost
Copy link

ghost commented Apr 21, 2015

I also still have this problem in the nightly.

@jethrogb
Copy link
Contributor

Still a problem 1.0.0-stable, fixed in nightly?

@pmarcelll
Copy link
Contributor

It compiles with rustc 1.2.0-nightly (20d23d8e5 2015-06-18).

@Munksgaard
Copy link
Contributor Author

On the playground it does indeed seem to be fixed with nightly. Stable and beta still ICE, but I guess we can call it fixed. Should I PR a test for future-proofing?

@alexcrichton
Copy link
Member

Feel free @Munksgaard! I'm going to close this anyway, but you're more than welcome to add a test in a PR!

@Munksgaard
Copy link
Contributor Author

I've added a test in #26434

Manishearth pushed a commit to Manishearth/rust that referenced this issue Jun 20, 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

6 participants