Skip to content

Compiler panic: Yet another 'index out of bounds: the len is 12 but the index is 12' #19237

Closed
@IvanUkhov

Description

@IvanUkhov

Hello,

The following code:

use std::default::Default;

type Foo = u16;

#[deriving(Default)]
struct Bar {
    pub foo: Foo,
}

fn main() {
    let baz = 0u;
    match baz {
        _ => assert!(0, 0),
    }
}

makes the compiler panic:

<std macros>:8:12: 13:23 error: mismatched types: expected `bool`, found `_` (expected bool, found integral variable)
<std macros>:8         if !$cond {
<std macros>:9             panic!($($arg),+)
<std macros>:10         }
<std macros>:11     );
<std macros>:12 )
error: internal compiler error: unexpected panic
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
task 'rustc' panicked at 'index out of bounds: the len is 12 but the index is 12', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/lib.rs:1

The backtrace is as follows:

   1:        0x105e915f2 - rt::backtrace::imp::write::he31e36fe59b39292ugt
   2:        0x105e946ad - failure::on_fail::h7c2689f722982652nCt
   3:        0x1060ff575 - unwind::begin_unwind_inner::h09866e00e97d31fbI2c
   4:        0x1060ff1bf - unwind::begin_unwind_fmt::h443e47d11b48984fTZc
   5:        0x1060fef62 - rust_begin_unwind
   6:        0x106149bfc - panicking::panic_fmt::hc979f6c0b0157f68RQl
   7:        0x106152341 - panicking::panic_bounds_check::hfad71607541b5567pPl
   8:        0x103e5a1e5 - codemap::FileMap::get_line::h40447e4b57225531m4E
   9:        0x103e888d3 - diagnostic::emit::hd3a2cf9de9dee335wvG
  10:        0x103e85168 - diagnostic::EmitterWriter.Emitter::emit::h8d15319a02e5e7a2lrG
  11:        0x103e83955 - diagnostic::Handler::emit::h444f90359ca9a887F8F
  12:        0x103e5637b - diagnostic::SpanHandler::span_err::he607876660b5f38fEWF
  13:        0x103208f8d - middle::typeck::infer::error_reporting::InferCtxt<'a, 'tcx>.ErrorReporting<'tcx>::report_type_error::h295fd9075d7add0fEMv
  14:        0x1030a12d4 - middle::typeck::check::demand::suptype::h60784e61bbbd5b6eyCd
  15:        0x1031b806d - middle::typeck::check::check_expr_has_type::closure.110801
  16:        0x1031b6216 - middle::typeck::check::check_expr_with_unifier::h8837607ae16c10b8Nzm
  17:        0x1031b0442 - middle::typeck::check::check_expr_with_unifier::h8837607ae16c10b8Nzm
  18:        0x1030a44c2 - middle::typeck::check::_match::check_match::h405380e6f6849c885P8
  19:        0x1031b06f3 - middle::typeck::check::check_expr_with_unifier::h8837607ae16c10b8Nzm
  20:        0x10316a4cf - middle::typeck::check::check_block_with_expected::he7085b8c57c115ecvzo
  21:        0x103143f70 - middle::typeck::check::check_fn::h604cf1058f7c9abce0i
  22:        0x103166b1e - middle::typeck::check::check_bare_fn::h42d50bc38b24ab59jPi
  23:        0x103162ad1 - middle::typeck::check::check_item::ha935ead12b2c5b2ft9i
  24:        0x103166840 - middle::typeck::check::check_item_types::h466c6c16edcec5c9tOi
  25:        0x1034ea896 - util::common::time::h12864813766357117792
  26:        0x1034e9d14 - middle::typeck::check_crate::h1acd5e14d073c903cwM
  27:        0x102ad79a3 - driver::driver::phase_3_run_analysis_passes::h098de55f4a14acee2eS
  28:        0x102acbecc - driver::driver::compile_input::h814765d870318dcf8VR
  29:        0x102b49e65 - driver::run_compiler::h54cbb685f3e65071gUT
  30:        0x102b4863e - driver::run::closure.59668
  31:        0x1029605ae - task::TaskBuilder::try_future::closure.38921
  32:        0x105e1f2e4 - task::TaskBuilder::spawn_internal::closure.24355
  33:        0x1060fcddd - task::Task::spawn::closure.5917
  34:        0x1061616ac - rust_try_inner
  35:        0x106161696 - rust_try
  36:        0x1060fceb7 - unwind::try::h207282f5be16daac3Qc
  37:        0x1060fcc8c - task::Task::run::h7eee475ba5444e2993b
  38:        0x1060fc98f - task::Task::spawn::closure.5893
  39:        0x1060fe627 - thread::thread_start::hc58864c152053492Wnc
  40:     0x7fff986072fc - _pthread_body
  41:     0x7fff98607279 - _pthread_body

It seems there are quite many bug reports with similar panic messages. I hope my snippet of code can shed some more light on the problem. Thank you.

Regards,
Ivan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions