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: diagnostic.rs panics due to index out of bounds error #19500

Closed
0x1cedc0ffee opened this issue Dec 3, 2014 · 2 comments
Closed

ICE: diagnostic.rs panics due to index out of bounds error #19500

0x1cedc0ffee opened this issue Dec 3, 2014 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@0x1cedc0ffee
Copy link

I was experimenting with macros on a dummy project of mine. After doing something stupid I recieved this message:

 ➜  src git:(master) ✗ cargo test                                              
   Compiling libstuff v0.0.1 (file:///home/cake/projects/libstuff)
/home/cake/projects/libstuff/src/suffix.rs:53:35: 53:41 error: cannot borrow `*suffix` as immutable because it is also borrowed as mutable
/home/cake/projects/libstuff/src/suffix.rs:53             mutate_char!(suffix->[suffix.char_len() - 1] = mutation);
                                                                                 ^~~~~~
/home/cake/projects/libstuff/src/common.rs:21:1: 28:2 note: in expansion of mutate_char!
/home/cake/projects/libstuff/src/suffix.rs:53:13: 53:70 note: expansion site
/home/cake/projects/libstuff/src/suffix.rs:53:26: 53:32 note: previous borrow of `*suffix` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `*suffix` until the borrow ends
/home/cake/projects/libstuff/src/suffix.rs:53             mutate_char!(suffix->[suffix.char_len() - 1] = mutation);
                                                                        ^~~~~~
/home/cake/projects/libstuff/src/common.rs:21:1: 28:2 note: in expansion of mutate_char!
/home/cake/projects/libstuff/src/suffix.rs:53:13: 53:70 note: expansion site
/home/cake/projects/libstuff/src/common.rs:24:35: 24:35 note: previous borrow ends here
/home/cake/projects/libstuff/src/suffix.rs:53:35: 53:41 error: cannot borrow `*suffix` as immutable because it is also borrowed as mutable
/home/cake/projects/libstuff/src/suffix.rs:53             mutate_char!(suffix->[suffix.char_len() - 1] = mutation);
                                                                                 ^~~~~~
/home/cake/projects/libstuff/src/common.rs:21:1: 28:2 note: in expansion of mutate_char!
/home/cake/projects/libstuff/src/suffix.rs:53:13: 53:70 note: expansion site
/home/cake/projects/libstuff/src/suffix.rs:53:26: 53:32 note: previous borrow of `*suffix` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `*suffix` until the borrow ends
error: internal compiler error: unexpected panic
/home/cake/projects/libstuff/src/suffix.rs:53             mutate_char!(suffix->[suffix.char_len() - 1] = mutation);
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
/home/cake/projects/libstuff/src/common.rs:21:1: 28:2 note: in expansion of mutate_char!
/home/cake/projects/libstuff/src/suffix.rs:53:13: 53:70 note: expansion site
/home/cake/projects/libstuff/src/common.rs:24:35: 24:35 note: previous borrow ends here
task 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 4294967295', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:535

stack backtrace:
   1: 0xb71fab50 - rt::backtrace::imp::write::ha919104d3a2cc2d39ay
   2: 0xb71fd9d0 - failure::on_fail::hc1b4eecd3de36abczDy
   3: 0xb706d550 - unwind::begin_unwind_inner::hb8ade4b3c397e25d6Qc
   4: 0xb706d170 - unwind::begin_unwind_fmt::h96b3ecc0c9195862hOc
   5: 0xb706d110 - rust_begin_unwind
   6: 0xb70b7fc0 - panicking::panic_fmt::h954780ce7200e90bVXl
   7: 0xb70be750 - panicking::panic_bounds_check::hf8e9aa67b630c0a4tWl
   8: 0xb59734a0 - diagnostic::emit::ha133b318627bd6d5oCG
   9: 0xb5970250 - diagnostic::EmitterWriter.Emitter::custom_emit::h219dee222ab8e3dbvAG
  10: 0xb596eda0 - diagnostic::SpanHandler::span_end_note::h07d1c89382f3eb8365F
  11: 0xb617ccd0 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::report_error_if_loan_conflicts_with_restriction::hf5390e53f971a3a9lpd
  12: 0xb617c2d0 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::report_error_if_loans_conflict::he4b6f11c9a52f8e4rmd
  13: 0xb617c220 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::check_for_conflicting_loans::closure.93330
  14: 0xb617b940 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::each_issued_loan::closure.93302
  15: 0xb617a9f0 - middle::dataflow::DataFlowContext<'a, 'tcx, O>::each_bit_for_node::h2757123354813815921
  16: 0xb617a630 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::each_issued_loan::h15ff3291d452c8edDcd
  17: 0xb6168a80 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>.euv..Delegate<'tcx>::borrow::h5a6a3537b8882e35EZc
  18: 0xb6172e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  19: 0xb6178e90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  20: 0xb6172e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  21: 0xb6178e90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  22: 0xb6172e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  23: 0xb6178e90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  24: 0xb6172e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  25: 0xb6178e90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  26: 0xb6172a30 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_block::h7708675825477625079
  27: 0xb6172e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  28: 0xb6178e90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  29: 0xb6172a30 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_block::h7708675825477625079
  30: 0xb6172e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  31: 0xb6178e90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  32: 0xb6172a30 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_block::h7708675825477625079
  33: 0xb616c0d0 - middle::borrowck::check_loans::check_loans::h03c8805865748350l6c
  34: 0xb61afe70 - middle::borrowck::borrowck_fn::h7bffaa42cc140af0Jli
  35: 0xb61b1ed0 - visit::walk_item::h8054865281593630383
  36: 0xb61b0e40 - visit::walk_mod::h11576973683542387380
  37: 0xb61b1ed0 - visit::walk_item::h8054865281593630383
  38: 0xb61b0e40 - visit::walk_mod::h11576973683542387380
  39: 0xb61b0890 - middle::borrowck::check_crate::ha9f42352a77d91e4fei
  40: 0xb766df00 - driver::driver::phase_3_run_analysis_passes::closure.58445
  41: 0xb74633a0 - util::common::time::h13760200948250138612
  42: 0xb76095f0 - driver::driver::phase_3_run_analysis_passes::h82d85a20fe7af3b07mS
  43: 0xb75fdfe0 - driver::driver::compile_input::he7a063ddc92829ca73R
  44: 0xb76833c0 - driver::run_compiler::h592ab58384c3f9d5n2T
  45: 0xb76832a0 - driver::run::closure.60785
  46: 0xb747bb50 - task::TaskBuilder::try_future::closure.39742
  47: 0xb71ce980 - task::TaskBuilder::spawn_internal::closure.30929
  48: 0xb706b350 - task::Task::spawn::closure.5761
  49: 0xb706cf40 - unwind::try::try_fn::hcc972c8eed9f09daDHc
  50: 0xb70ce440 - rust_try_inner
  51: 0xb70ce400 - rust_try
  52: 0xb706b430 - unwind::try::hd0fca846ae5e5c96pFc
  53: 0xb706b1e0 - task::Task::run::h4011677d931ed843fOb
  54: 0xb706add0 - task::Task::spawn::closure.5737
  55: 0xb706c760 - thread::thread_start::h1333e306c9ad24dci6b
  56: 0xb37d6c80 - start_thread
  57:        0x0 - <unknown>

Build failed, waiting for other jobs to finish...
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 0 but the index is 4294967295', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:535

stack backtrace:
   1: 0xb7201b50 - rt::backtrace::imp::write::ha919104d3a2cc2d39ay
   2: 0xb72049d0 - failure::on_fail::hc1b4eecd3de36abczDy
   3: 0xb7074550 - unwind::begin_unwind_inner::hb8ade4b3c397e25d6Qc
   4: 0xb7074170 - unwind::begin_unwind_fmt::h96b3ecc0c9195862hOc
   5: 0xb7074110 - rust_begin_unwind
   6: 0xb70befc0 - panicking::panic_fmt::h954780ce7200e90bVXl
   7: 0xb70c5750 - panicking::panic_bounds_check::hf8e9aa67b630c0a4tWl
   8: 0xb597a4a0 - diagnostic::emit::ha133b318627bd6d5oCG
   9: 0xb5977250 - diagnostic::EmitterWriter.Emitter::custom_emit::h219dee222ab8e3dbvAG
  10: 0xb5975da0 - diagnostic::SpanHandler::span_end_note::h07d1c89382f3eb8365F
  11: 0xb6183cd0 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::report_error_if_loan_conflicts_with_restriction::hf5390e53f971a3a9lpd
  12: 0xb61832d0 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::report_error_if_loans_conflict::he4b6f11c9a52f8e4rmd
  13: 0xb6183220 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::check_for_conflicting_loans::closure.93330
  14: 0xb6182940 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::each_issued_loan::closure.93302
  15: 0xb61819f0 - middle::dataflow::DataFlowContext<'a, 'tcx, O>::each_bit_for_node::h2757123354813815921
  16: 0xb6181630 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>::each_issued_loan::h15ff3291d452c8edDcd
  17: 0xb616fa80 - middle::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx>.euv..Delegate<'tcx>::borrow::h5a6a3537b8882e35EZc
  18: 0xb6179e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  19: 0xb617fe90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  20: 0xb6179e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  21: 0xb617fe90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  22: 0xb6179e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  23: 0xb617fe90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  24: 0xb6179e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  25: 0xb617fe90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  26: 0xb6179a30 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_block::h7708675825477625079
  27: 0xb6179e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  28: 0xb617fe90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  29: 0xb6179a30 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_block::h7708675825477625079
  30: 0xb6179e00 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h6597893224547873452
  31: 0xb617fe90 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::consume_expr::h8888979236244829760
  32: 0xb6179a30 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_block::h7708675825477625079
  33: 0xb61730d0 - middle::borrowck::check_loans::check_loans::h03c8805865748350l6c
  34: 0xb61b6e70 - middle::borrowck::borrowck_fn::h7bffaa42cc140af0Jli
  35: 0xb61b8ed0 - visit::walk_item::h8054865281593630383
  36: 0xb61b7e40 - visit::walk_mod::h11576973683542387380
  37: 0xb61b8ed0 - visit::walk_item::h8054865281593630383
  38: 0xb61b7e40 - visit::walk_mod::h11576973683542387380
  39: 0xb61b7890 - middle::borrowck::check_crate::ha9f42352a77d91e4fei
  40: 0xb7674f00 - driver::driver::phase_3_run_analysis_passes::closure.58445
  41: 0xb746a3a0 - util::common::time::h13760200948250138612
  42: 0xb76105f0 - driver::driver::phase_3_run_analysis_passes::h82d85a20fe7af3b07mS
  43: 0xb7604fe0 - driver::driver::compile_input::he7a063ddc92829ca73R
  44: 0xb768a3c0 - driver::run_compiler::h592ab58384c3f9d5n2T
  45: 0xb768a2a0 - driver::run::closure.60785
  46: 0xb7482b50 - task::TaskBuilder::try_future::closure.39742
  47: 0xb71d5980 - task::TaskBuilder::spawn_internal::closure.30929
  48: 0xb7072350 - task::Task::spawn::closure.5761
  49: 0xb7073f40 - unwind::try::try_fn::hcc972c8eed9f09daDHc
  50: 0xb70d5440 - rust_try_inner
  51: 0xb70d5400 - rust_try
  52: 0xb7072430 - unwind::try::hd0fca846ae5e5c96pFc
  53: 0xb70721e0 - task::Task::run::h4011677d931ed843fOb
  54: 0xb7071dd0 - task::Task::spawn::closure.5737
  55: 0xb7073760 - thread::thread_start::h1333e306c9ad24dci6b
  56: 0xb37ddc80 - start_thread
  57:        0x0 - <unknown>

Could not compile `libstuff`.

To learn more, run the command again with --verbose.
➜  src git:(master) ✗ rustc --version=verbose
rustc 0.13.0-nightly (5484d6f6d 2014-12-02 00:22:00 +0000)
binary: rustc
commit-hash: 5484d6f6d2844e9c52d42db52a1ba94739e10996
commit-date: 2014-12-02 00:22:00 +0000
host: i686-unknown-linux-gnu
release: 0.13.0-nightly

This seems to be the guilty line: https://github.com/rust-lang/rust/blob/master/src/libsyntax/diagnostic.rs#L535

Also, as you can see I am running the latest rust, installed using rustup.sh

Hope someone with better skill sets can determine the reason and submit a fix, though it looks like a minor issue.

@sfackler sfackler added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-diagnostics Area: Messages for errors, warnings, and lints labels Dec 3, 2014
@0x1cedc0ffee 0x1cedc0ffee changed the title libsyntax/diagnostic.rs panics due to index out of bounds error ICE: diagnostic.rs panics due to index out of bounds error Dec 3, 2014
@tamird
Copy link
Contributor

tamird commented Apr 21, 2015

@0x1cedc0ffee can you include your code that triggers this?

@steveklabnik
Copy link
Member

Without a reproduction, we can't fix. @0x1cedc0ffee , please let us know if you are still having this problem, and can share the code that reproduces it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants