rust-lang / rust

Empowering everyone to build reliable and efficient software.

Home Page:https://www.rust-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ICE: thread 'rustc' panicked at 'capacity overflow'

dwrensha opened this issue · comments

I'm seeing the following error on the nightly channel, but not on stable or beta:

$ echo "fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {" > main.rs

$ rustc main.rs
error: this file contains an un-closed delimiter
 --> main.rs:1:89
  |
1 | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
  |               -                       -         -                  -                  - ^
  |               |                       |         |                  |                  |
  |               |                       |         |                  |                  un-closed delimiter
  |               |                       |         |                  un-closed delimiter
  |               |                       |         un-closed delimiter
  |               un-closed delimiter     un-closed delimiter

thread 'rustc' panicked at 'capacity overflow', src/liballoc/raw_vec.rs:748:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error


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: rustc 1.38.0-nightly (0b680cfce 2019-07-09) running on x86_64-apple-darwin

Found with the help of libfuzzer-sys.

triage: P-medium. Leaving nominated so that team double-checks that priority assignment.

This is triggered here

let sugg = pprust::to_string(|s| {
use crate::print::pprust::INDENT_UNIT;
s.ibox(INDENT_UNIT);
s.bopen();
s.print_stmt(&stmt);
s.bclose_maybe_open(stmt.span, false)
});

It should be possible to use the span snippet instead.

I believe it was introduced in #62099