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 on "index out of bounds: the len is 0 but the index is 1" #62881

Closed
dwrensha opened this issue Jul 22, 2019 · 3 comments · Fixed by #62887
Closed

ICE on "index out of bounds: the len is 0 but the index is 1" #62881

dwrensha opened this issue Jul 22, 2019 · 3 comments · Fixed by #62887
Labels
A-parser Area: The parsing of Rust source code to an AST. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dwrensha
Copy link
Contributor

When I try to run rustc on this program (found by fuzz-rustc)

fn f() -> isize { fn f() -> isize {} pub f<

it crashes with this error:

error: this file contains an un-closed delimiter
 --> main.rs:1:45
  |
1 | fn f() -> isize { fn f() -> isize {} pub f<
  |                 - un-closed delimiter       ^

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 1', /rustc/273f42b5964c29dda2c5a349dd4655529767b07f/src/libcore/slice/mod.rs:2687:14
stack backtrace:
   0: std::panicking::default_hook::{{closure}}
   1: std::panicking::default_hook
   2: rustc::util::common::panic_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::continue_panic_fmt
   5: rust_begin_unwind
   6: core::panicking::panic_fmt
   7: core::panicking::panic_bounds_check
   8: syntax::parse::parser::Parser::parse_item_
   9: syntax::parse::parser::Parser::parse_stmt_without_recovery
  10: syntax::parse::parser::Parser::parse_full_stmt
  11: syntax::parse::parser::Parser::parse_block_tail
  12: syntax::parse::parser::Parser::parse_inner_attrs_and_block
  13: syntax::parse::parser::Parser::parse_item_fn
  14: syntax::parse::parser::Parser::parse_item_implementation
  15: syntax::parse::parser::Parser::parse_item_
  16: syntax::parse::parser::Parser::parse_item
  17: syntax::parse::parser::Parser::parse_mod_items
  18: syntax::parse::parser::Parser::parse_crate_mod
  19: syntax::parse::parse_crate_from_file
  20: rustc_interface::passes::parse::{{closure}}
  21: rustc::util::common::time
  22: rustc_interface::passes::parse
  23: rustc_interface::queries::Query<T>::compute
  24: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::parse
  25: rustc_interface::interface::run_compiler_in_existing_thread_pool
  26: std::thread::local::LocalKey<T>::with
  27: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
end of query stack
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 (273f42b59 2019-07-21) running on x86_64-apple-darwin

The error happens on stable, beta, and nightly.

@estebank estebank added A-parser Area: The parsing of Rust source code to an AST. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jul 22, 2019
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 22, 2019
@estebank estebank added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jul 22, 2019
@estebank
Copy link
Contributor

Introduced in 1.33.

@dwrensha
Copy link
Contributor Author

I'm seeing the error on nightly-2018-12-14 (f4a421e) but not on nightly-2018-12-08 (4a45578).

@dwrensha
Copy link
Contributor Author

#56248 looks suspicious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants