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 "byte index 1 is out of bounds of ``" #62973

Closed
dwrensha opened this issue Jul 25, 2019 · 4 comments · Fixed by #62995
Closed

ICE on "byte index 1 is out of bounds of ``" #62973

dwrensha opened this issue Jul 25, 2019 · 4 comments · Fixed by #62995
Labels
A-parser Area: The parsing of Rust source code to an AST. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@dwrensha
Copy link
Contributor

dwrensha commented Jul 25, 2019

I'm seeing an internal compiler error on the following input (found by fuzz-rustc):

fn p() { match s { v, E { [) {) }

(EDIT: the trailing newlines are important)

error: this file contains an un-closed delimiter
 --> main.rs:2:2
  |
1 | fn p() { match s { v, E { [) {) }
  |        -         - un-closed delimiter
  |        |
  |        un-closed delimiter
2 | 
  |  ^

error: expected one of `,` or `}`, found `{`
 --> main.rs:1:25
  |
1 | fn p() { match s { v, E { [) {) }
  |                -        ^ expected one of `,` or `}` here
  |                |
  |                while parsing this struct

error: struct literals are not allowed here
 --> main.rs:1:16
  |
1 |   fn p() { match s { v, E { [) {) }
  |  ________________^
2 | |
  | |_^
thread 'rustc' panicked at 'byte index 1 is out of bounds of ``', src/libcore/str/mod.rs:2019:9
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::str::slice_error_fail
   8: core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::RangeTo<usize>>::index::{{closure}}
   9: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  10: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  11: <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit_diagnostic
  12: rustc_errors::Handler::emit_db
  13: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit
  14: syntax::parse::parser::Parser::parse_bottom_expr
  15: syntax::parse::parser::Parser::parse_dot_or_call_expr
  16: syntax::parse::parser::Parser::parse_prefix_expr
  17: syntax::parse::parser::Parser::parse_assoc_expr_with
  18: syntax::parse::parser::Parser::parse_bottom_expr
  19: syntax::parse::parser::Parser::parse_dot_or_call_expr
  20: syntax::parse::parser::Parser::parse_prefix_expr
  21: syntax::parse::parser::Parser::parse_assoc_expr_with
  22: syntax::parse::parser::Parser::parse_stmt_without_recovery
  23: syntax::parse::parser::Parser::parse_full_stmt
  24: syntax::parse::parser::Parser::parse_block_tail
  25: syntax::parse::parser::Parser::parse_inner_attrs_and_block
  26: syntax::parse::parser::Parser::parse_item_fn
  27: syntax::parse::parser::Parser::parse_item_implementation
  28: syntax::parse::parser::Parser::parse_item_
  29: syntax::parse::parser::Parser::parse_item
  30: syntax::parse::parser::Parser::parse_mod_items
  31: syntax::parse::parser::Parser::parse_crate_mod
  32: syntax::parse::parse_crate_from_file
  33: rustc_interface::passes::parse::{{closure}}
  34: rustc::util::common::time
  35: rustc_interface::passes::parse
  36: rustc_interface::queries::Query<T>::compute
  37: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::parse
  38: rustc_interface::interface::run_compiler_in_existing_thread_pool
  39: std::thread::local::LocalKey<T>::with
  40: scoped_tls::ScopedKey<T>::set
  41: 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: incorrect close delimiter: `)`
 --> main.rs:1:28
  |
1 | fn p() { match s { v, E { [) {) }
  |                           -^ incorrect close delimiter
  |                           |
  |                           un-closed delimiter

error: incorrect close delimiter: `)`
 --> main.rs:1:31
  |
1 | fn p() { match s { v, E { [) {) }
  |                              -^ incorrect close delimiter
  |                              |
  |                              un-closed delimiter

error: aborting due to 4 previous errors


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 (03f19f7ff 2019-07-24) running on x86_64-apple-darwin

The error happens on stable, beta, and nightly.

@Mark-Simulacrum
Copy link
Member

cc @estebank

@Mark-Simulacrum Mark-Simulacrum added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-parser Area: The parsing of Rust source code to an AST. labels Jul 25, 2019
@estebank
Copy link
Contributor

I haven't been able to reproduce :-/

@dwrensha
Copy link
Contributor Author

dwrensha commented Jul 25, 2019 via email

@dwrensha
Copy link
Contributor Author

dwrensha commented Jul 25, 2019 via email

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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants