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: 'index out of bounds: the len is 1 but the index is 1' for println! and writeln! #35082

Closed
silvio opened this issue Jul 28, 2016 · 4 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@silvio
Copy link

silvio commented Jul 28, 2016

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
@silvio silvio changed the title 'index out of bounds: the len is 1 but the index is 1' for println! and writeln! ICE: 'index out of bounds: the len is 1 but the index is 1' for println! and writeln! Jul 28, 2016
@Aatch Aatch added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jul 28, 2016
@TimNN
Copy link
Contributor

TimNN commented Jul 28, 2016

This is a regression from stable to nightly.

Apart from the ICE, during my tests, the error error: there is no argument named valueb`` is reported on nightly, however the error error: named argument never used reported on stable / beta is not reported on nightly.

On a hunch I would guess that this was probably cause by #33642.

@TimNN
Copy link
Contributor

TimNN commented Jul 28, 2016

cc @xen0n, you probably know best what's going on in that code right now, although I suspect that the early return from verify_arg_type in case of an there is no argument named error causes args to contain less arguments than expected when reporting an argument never used error.

@alexcrichton alexcrichton added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated labels Jul 28, 2016
@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added P-high High priority and removed I-nominated labels Jul 28, 2016
@xen0n
Copy link
Contributor

xen0n commented Jul 29, 2016

Formatting code, my fault. I'll investigate immediately.

steveklabnik added a commit to steveklabnik/rust that referenced this issue Jul 30, 2016
syntax_ext: format: fix ICE with bad named arguments

Fixes rust-lang#35082 by guarding against a new case of malformed invocation not previously covered.

r? @alexcrichton
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 30, 2016
syntax_ext: format: fix ICE with bad named arguments

Fixes rust-lang#35082 by guarding against a new case of malformed invocation not previously covered.

r? @alexcrichton
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) ❄️ P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants