Skip to content

ICE: cannot relate bound region: ReStatic <= ReEarlyBound(173, TypeSpace, 0, 'a) #25071

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

Closed
Boboseb opened this issue May 3, 2015 · 2 comments · Fixed by #25652
Closed

ICE: cannot relate bound region: ReStatic <= ReEarlyBound(173, TypeSpace, 0, 'a) #25071

Boboseb opened this issue May 3, 2015 · 2 comments · Fixed by #25652
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@Boboseb
Copy link

Boboseb commented May 3, 2015

I've encountered an internal compiler error when building this code:

use std::iter::*;

pub struct Ilbm<'a> {
    body_data: &'a[u8],
    data_width: u16,
    depth: u8,
    mask: u8,
    ham: bool,
}

impl<'a> Ilbm<'a> {

    fn get_bit(buffer: &[u8], col: usize) -> u8 {
        let byte_offset = col / 8;
        let bit_offset = 7 - col % 8;
        let byte_val = buffer[byte_offset];
        (byte_val >> bit_offset) & 1
    }

    fn draw_row<'b>(&self, decoded_row_planes: Vec<&'b [u8]>) -> Box<Iterator<Item=u8> + 'b> {
        let masking = self.mask == 1;

        let ham_mask: u8 = if self.ham { if self.depth == 6 { 0x0F } else { 0x3F } } else { 0 };
        let ham_shif: u8 = if self.ham { self.depth - 2 } else { 0 };
        let depth = self.depth as usize;

        Box::new((0..self.data_width)
                 .flat_map(move |col| {
                     if masking && Self::get_bit(decoded_row_planes[depth], col as usize) != 1 {
                         repeat(0).take(4)
                     }
                     else {
                        decoded_row_planes[depth][col as usize]
                     }
                 } ))
    }

}

Meta

rustc --version --verbose:

rustc 1.0.0-beta.3 (5241bf9c3 2015-04-25) (built 2015-04-25)
binary: rustc
commit-hash: 5241bf9c34d156ea6064367a33cbd7222eeb5789
commit-date: 2015-04-25
build-date: 2015-04-25
host: x86_64-apple-darwin
release: 1.0.0-beta.3

Backtrace:

thread 'rustc' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:149

stack backtrace:
   1:        0x10affc33f - sys::backtrace::write::h0f2fc53eb11eb814gWr
   2:        0x10b004942 - panicking::on_panic::hd617a4042e8486fciUv
   3:        0x10afc1375 - rt::unwind::begin_unwind_inner::hd84dfec22ac3667d1Bv
   4:        0x10a7a09fe - rt::unwind::begin_unwind::h17792509132866387090
   5:        0x10a7a098a - diagnostic::SpanHandler::span_bug::hebb6215f61f436aaEqB
   6:        0x10867405b - middle::infer::region_inference::RegionVarBindings<'a, 'tcx>::make_subregion::h4adb78ad460601ecS8u
   7:        0x10862aeab - middle::infer::sub::Sub<'a, 'tcx>.TypeRelation<'a, 'tcx>::regions::h3f9ee82a2e72a144Mjx
   8:        0x10862ac91 - middle::infer::sub::Sub<'a, 'tcx>.TypeRelation<'a, 'tcx>::relate_with_variance::h5672739467683317342
   9:        0x10862a20b - middle::ty_relate::relate_substs::h2389761154872115822
  10:        0x1086297fa - middle::ty_relate::relate_item_substs::h7360249961707336134
  11:        0x10868b447 - middle::ty_relate::super_relate_tys::h10795509169925483940
  12:        0x108621bb2 - middle::infer::sub::Sub<'a, 'tcx>.TypeRelation<'a, 'tcx>::tys::h3174a850422a5fc1pfx
  13:        0x10868ff47 - middle::infer::InferCtxt<'a, 'tcx>::sub_types::hea49ed0ad06eecf898y
  14:        0x107ccd1d5 - check::method::probe::ProbeContext<'a, 'tcx>::consider_candidates::h2b54d2790fd0880dXoi
  15:        0x107cccf79 - check::method::probe::ProbeContext<'a, 'tcx>::pick_method::hc768ec9b0fb6e87dUki
  16:        0x107ccc346 - check::method::probe::ProbeContext<'a, 'tcx>::pick_core::h3e5895ad5629b90bOfi
  17:        0x107cc1cbc - check::method::probe::probe::closure.31574
  18:        0x107cbf389 - check::method::probe::probe::hfbf147788d37ee49T4g
  19:        0x107cd9ecd - check::method::resolve_ufcs::h9a77d5ebe946bd48d7j
  20:        0x107d65c30 - check::check_expr_with_unifier::h1091590169474595220
  21:        0x107cfaf2c - check::callee::check_call::hf304e98e66e2eee3Nhm
  22:        0x107d61b0a - check::check_expr_with_unifier::h1091590169474595220
  23:        0x107d0a18d - check::op::check_binop::h6504e0630336d4baFan
  24:        0x107d498ae - check::check_expr_with_unifier::h4364205555285070129
  25:        0x107d0a42e - check::op::check_binop::h6504e0630336d4baFan
  26:        0x107d4343b - check::check_expr_with_unifier::h8963715346170232283
  27:        0x107d2f66d - check::check_expr_with_unifier::check_then_else::h1d5d0ab6867397defIq
  28:        0x107d49b8d - check::check_expr_with_unifier::h4364205555285070129
  29:        0x107d191db - check::check_block_with_expected::h83c5e18f3456d9895hs
  30:        0x107d49d85 - check::check_expr_with_unifier::h4364205555285070129
  31:        0x107d191db - check::check_block_with_expected::h83c5e18f3456d9895hs
  32:        0x107cfa508 - check::check_fn::h5c814037ea8a2362C4n
  33:        0x107cf8966 - check::closure::check_expr_closure::h0b5d1648c0a7d5409Pl
  34:        0x107d25f08 - check::check_expr_with_unifier::h8674341778859500334
  35:        0x107d00d9c - check::check_argument_types::hbd54866e0651a010O5p
  36:        0x107d0208a - check::check_method_argument_types::h42f31152b61f4a11d3p
  37:        0x107d308cc - check::check_expr_with_unifier::check_method_call::h6fc40daeec19d10dlFq
  38:        0x107d2595e - check::check_expr_with_unifier::h8674341778859500334
  39:        0x107d00d9c - check::check_argument_types::hbd54866e0651a010O5p
  40:        0x107cfe0be - check::callee::confirm_builtin_call::h98216b80db4bfd2f5qm
  41:        0x107cfc849 - check::callee::check_call::hf304e98e66e2eee3Nhm
  42:        0x107d49701 - check::check_expr_with_unifier::h4364205555285070129
  43:        0x107d191db - check::check_block_with_expected::h83c5e18f3456d9895hs
  44:        0x107cfa508 - check::check_fn::h5c814037ea8a2362C4n
  45:        0x107d14599 - check::check_bare_fn::hd839ee74cb29d084bUn
  46:        0x107d1d4c7 - check::check_method_body::hf8957dc76229cbd6Gvo
  47:        0x107d124db - check::CheckItemBodiesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_item::hc008350ec16b94ffeRn
  48:        0x107ddbeda - check_crate::closure.38340
  49:        0x107dd72e7 - check_crate::h7f9bbce56981d322gCC
  50:        0x107b3c2d2 - driver::phase_3_run_analysis_passes::hb862dc042470f6e0nGa
  51:        0x107b1e09c - driver::compile_input::h4747d8bb1c595fdfQba
  52:        0x107be58f3 - run_compiler::hc8c95c5858347fdbz4b
  53:        0x107be341a - boxed::F.FnBox<A>::call_box::h7872786064439979928
  54:        0x107be28b7 - rt::unwind::try::try_fn::h10239991317224243769
  55:        0x10b0857c8 - rust_try_inner
  56:        0x10b0857b5 - rust_try
  57:        0x107be2b90 - boxed::F.FnBox<A>::call_box::h4543691575426869824
  58:        0x10b00348d - sys::thread::create::thread_start::h499b3be451a7bbb8AZu
  59:     0x7fff91f30267 - _pthread_body
  60:     0x7fff91f301e4 - _pthread_start
@sanxiyn sanxiyn added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label May 7, 2015
@phifty
Copy link

phifty commented May 7, 2015

+1

@pnkfelix
Copy link
Member

pnkfelix commented May 7, 2015

Reduced test case:

pub struct Ilbm<'a> { body_data: &'a[u8] }

impl<'a> Ilbm<'a> {
    fn get_bit(buffer: &[u8], i: usize) -> u8 { unimplemented!() }
    fn draw_row(&self) { Self::get_bit(&[0]) }
}

fn main() { }

arielb1 pushed a commit to arielb1/rust that referenced this issue May 20, 2015
This is needed because `Self` can be substituted to a type with
lifetime parameters.

Fixes rust-lang#24308
Fixes rust-lang#25071
Fixes rust-lang#25259
Fixes rust-lang#25279
bors added a commit that referenced this issue May 20, 2015
This is needed because `Self` can be substituted to a type with
lifetime parameters.

Fixes #24308
Fixes #25071
Fixes #25259
Fixes #25279
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

Successfully merging a pull request may close this issue.

4 participants