Skip to content

ICE: 'index out of bounds: the len is 1 but the index is 1' for println! and writeln! #35082

Closed
@silvio

Description

@silvio

rustc crash:

I tried this code:

fn main() {
    let a = 5;
    let b = 7;

    println!("{valuea} {valueb}", valuea=a, valuec=b);
}

I expected to see this happen:

error: there is no argument named `valueb`

Instead, this happened:

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 'index out of bounds: the len is 1 but the index is 1', ../src/libcollections/vec.rs:1245
stack backtrace:
   1:     0x7fc198c298df - std::sys::backtrace::tracing::imp::write::h29f5fdb9fc0a7395
   2:     0x7fc198c3b69b - std::panicking::default_hook::_{{closure}}::h2cc84f0378700526
   3:     0x7fc198c39d7c - std::panicking::default_hook::hbbe7fa36a995aca0
   4:     0x7fc198c3a41e - std::panicking::rust_panic_with_hook::h105c3d42fcd2fb5e
   5:     0x7fc198c3a281 - std::panicking::begin_panic::hbf62ea4a5ff3f9de
   6:     0x7fc198c3a1aa - std::panicking::begin_panic_fmt::h20f5943904e5791d
   7:     0x7fc198c3a11e - rust_begin_unwind
   8:     0x7fc198ca570f - core::panicking::panic_fmt::h19323e466869c656
   9:     0x7fc198ca56b2 - core::panicking::panic_bounds_check::ha883fe1527ce6884
  10:     0x7fc19852c0ac - syntax_ext::format::expand_preparsed_format_args::h82fd405df00f188d
  11:     0x7fc1984f9740 - _<F as syntax..ext..base..TTMacroExpander>::expand::hedb879b2c8c7c910
  12:     0x7fc1911488c3 - syntax::ext::expand::expand_mac_invoc::mac_result::ha687d7bad8e98897
  13:     0x7fc19115be37 - _<syntax..ext..expand..MacroExpander<'a, 'b> as syntax..fold..Folder>::fold_opt_expr::h800fad7903fd3f2d
  14:     0x7fc190fd9221 - syntax::fold::Folder::fold_exprs::h0d3a179f1ee08509
  15:     0x7fc1910258e9 - syntax::fold::noop_fold_expr::hc0a72ed4c6fc46a8
  16:     0x7fc191140843 - syntax::ext::expand::expand_expr::h8c7885a0be31d72f
  17:     0x7fc19115c00f - _<syntax..ext..expand..MacroExpander<'a, 'b> as syntax..fold..Folder>::fold_opt_expr::h800fad7903fd3f2d
  18:     0x7fc19115bfc8 - _<syntax..ext..expand..MacroExpander<'a, 'b> as syntax..fold..Folder>::fold_opt_expr::h800fad7903fd3f2d
  19:     0x7fc19114ab4f - syntax::ext::expand::expand_stmt::h4ee6a8c486a9d552
  20:     0x7fc190f5c733 - _<collections..vec..Vec<T> as syntax..util..move_map..MoveMap<T>>::move_flat_map::h0128ecd55ca2ec60
  21:     0x7fc1910d9c9f - _<syntax..ptr..P<T>>::map::he44b10a98f141c7d
  22:     0x7fc19115e673 - _<syntax..ext..expand..MacroExpander<'a, 'b> as syntax..fold..Folder>::fold_block::h705cb0963f737f81
  23:     0x7fc191156d47 - syntax::ext::expand::expand_impl_item::hab999ea4844fac21
  24:     0x7fc19114e6fd - syntax::ext::expand::expand_annotatable::he10687f1f71324a3
  25:     0x7fc19115f005 - _<syntax..ext..expand..MacroExpander<'a, 'b> as syntax..fold..Folder>::fold_impl_item::hcdf1de7be4a3d049
  26:     0x7fc1911995e9 - syntax::fold::noop_fold_item_kind::_{{closure}}::h4240781a08854267
  27:     0x7fc190ff9fcc - syntax::fold::noop_fold_item_kind::h36b5e3bd517f1177
  28:     0x7fc190fd8173 - syntax::fold::Folder::fold_item_simple::h44490c66c54409eb
  29:     0x7fc1910d7d4a - _<syntax..ptr..P<T>>::map::h279fe63aed2b3282
  30:     0x7fc191151949 - syntax::ext::expand::expand_annotatable::he10687f1f71324a3
  31:     0x7fc191148ec4 - syntax::ext::expand::expand_item::h26a928b599bd1ab4
  32:     0x7fc19115dd31 - _<syntax..ext..expand..MacroExpander<'a, 'b> as syntax..fold..Folder>::fold_item::hda4a78ec0eda02fe
  33:     0x7fc191012332 - syntax::fold::noop_fold_mod::h2d77441ecaa79d92
  34:     0x7fc190ffa5a4 - syntax::fold::noop_fold_item_kind::h36b5e3bd517f1177
  35:     0x7fc190fd8173 - syntax::fold::Folder::fold_item_simple::h44490c66c54409eb
  36:     0x7fc1910d7d4a - _<syntax..ptr..P<T>>::map::h279fe63aed2b3282
  37:     0x7fc191151f9e - syntax::ext::expand::expand_annotatable::he10687f1f71324a3
  38:     0x7fc191148ec4 - syntax::ext::expand::expand_item::h26a928b599bd1ab4
  39:     0x7fc19115dfaf - _<syntax..ext..expand..MacroExpander<'a, 'b> as syntax..fold..Folder>::fold_item::hda4a78ec0eda02fe
  40:     0x7fc191012332 - syntax::fold::noop_fold_mod::h2d77441ecaa79d92
  41:     0x7fc190ffa5a4 - syntax::fold::noop_fold_item_kind::h36b5e3bd517f1177
  42:     0x7fc190fd8173 - syntax::fold::Folder::fold_item_simple::h44490c66c54409eb
  43:     0x7fc1910d7d4a - _<syntax..ptr..P<T>>::map::h279fe63aed2b3282
  44:     0x7fc191151f9e - syntax::ext::expand::expand_annotatable::he10687f1f71324a3
  45:     0x7fc191148ec4 - syntax::ext::expand::expand_item::h26a928b599bd1ab4
  46:     0x7fc19115dfaf - _<syntax..ext..expand..MacroExpander<'a, 'b> as syntax..fold..Folder>::fold_item::hda4a78ec0eda02fe
  47:     0x7fc19115ad0f - _<syntax..ext..expand..MacroExpander<'a, 'b> as syntax..fold..Folder>::fold_crate::h3d2c22bc23783ddf
  48:     0x7fc19115fedc - syntax::ext::expand::expand_crate::h1e4c4debc3e6d4d6
  49:     0x7fc1991ff373 - rustc_driver::driver::phase_2_configure_and_expand::_{{closure}}::h650e136516de4da2
  50:     0x7fc1991b90b6 - rustc_driver::driver::phase_2_configure_and_expand::h23617908add5ca02
  51:     0x7fc1991ad637 - rustc_driver::driver::compile_input::hb4cc34cf85dc1edf
  52:     0x7fc1991d8a6c - rustc_driver::run_compiler::h50f95674bd902ab5
  53:     0x7fc19911de1d - std::panicking::try::call::h4577500a5284c6ff
  54:     0x7fc198c497f6 - __rust_maybe_catch_panic
  55:     0x7fc199138854 - _<F as alloc..boxed..FnBox<A>>::call_box::h24f3eb0b42327962
  56:     0x7fc198c37e04 - std::sys::thread::Thread::new::thread_start::h8f3bd45211e9f5ea
  57:     0x7fc190389483 - start_thread
  58:     0x7fc1988836dc - clone
  59:                0x0 - <unknown>

Meta

$ rustc --version --verbose
rustc 1.12.0-nightly (feeca9457 2016-07-26)
binary: rustc
commit-hash: feeca945738ffc6d252ae0fbb2f35723e4eb95a6
commit-date: 2016-07-26
host: x86_64-unknown-linux-gnu
release: 1.12.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions