-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
nightly ICE: panicked at 'index out of bounds: the len is 0 but the index is 1', /checkout/src/liballoc/vec.rs:1564:14 #44021
Labels
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
$ RUST_BACKTRACE=1 rustc-nightly tmp.rs
error: expected expression, found `}`
--> tmp.rs:4:1
|
4 | }
| ^
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.21.0-nightly (8c303ed87 2017-08-20) running on i686-unknown-linux-gnu
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 1', /checkout/src/liballoc/vec.rs:1564:14
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at /checkout/src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at /checkout/src/libstd/sys_common/backtrace.rs:60
at /checkout/src/libstd/panicking.rs:381
3: std::panicking::default_hook
at /checkout/src/libstd/panicking.rs:391
4: std::panicking::rust_panic_with_hook
at /checkout/src/libstd/panicking.rs:611
5: std::panicking::begin_panic
at /checkout/src/libstd/panicking.rs:572
6: std::panicking::begin_panic_fmt
at /checkout/src/libstd/panicking.rs:522
7: rust_begin_unwind
at /checkout/src/libstd/panicking.rs:498
8: core::panicking::panic_fmt
at /checkout/src/libcore/panicking.rs:71
9: core::panicking::panic_bounds_check
at /checkout/src/libcore/panicking.rs:58
10: syntax::parse::parser::Parser::parse_impl_item
11: syntax::parse::parser::Parser::parse_item_impl
12: syntax::parse::parser::Parser::parse_item_
13: syntax::parse::parser::Parser::parse_item
14: syntax::parse::parser::Parser::parse_mod_items
15: syntax::parse::parser::Parser::parse_crate_mod
16: syntax::parse::parse_crate_from_file
17: rustc_driver::driver::phase_1_parse_input::{{closure}}
18: rustc_driver::driver::phase_1_parse_input
19: rustc_driver::driver::compile_input
20: rustc_driver::run_compiler
$ |
With more line numbers:
|
Mark-Simulacrum
added
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Aug 22, 2017
After investigating the parser, I found out it panicked after trying to parse closure argument list. impl Struct
{
fn static_meth_struct () -> Struct {|x, y} // incomplete argument list
}
On stable(1.20.0), the compiler falls into the infinite loop.
|
I'm trying to fix this. |
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Sep 9, 2017
Expect pipe symbol after closure parameter list Fixes rust-lang#44021. --- Originally, the parser just called `bump` to discard following token after parsing closure parameter list, because it assumes `|` is following. However, the following code breaks the assumption: ```rust struct MyStruct; impl MyStruct { fn f() {|x, y} } ``` Here, the parameter list is `x, y` and the following token is `}`. The parser discards `}`, and then we have a curly bracket mismatch. Indeed, this code has a syntax error. On current nightly, the compiler emits an syntax error, but with incorrect message and span, followed by an ICE. ``` error: expected expression, found `}` --> 44021.rs:4:1 | 4 | } | ^ error: internal compiler error: unexpected panic ``` Even worse, on current stable(1.20.0), the compiler falls into an infinite loop. This pull request fixes this problem. Now the compiler emits correct error message and span, and does not ICE. ``` error: expected one of `:`, `@`, or `|`, found `}` --> 44021.rs:3:20 | 3 | fn foo() {|x, y} | ^ expected one of `:`, `@`, or `|` here ```
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Sep 9, 2017
Expect pipe symbol after closure parameter list Fixes rust-lang#44021. --- Originally, the parser just called `bump` to discard following token after parsing closure parameter list, because it assumes `|` is following. However, the following code breaks the assumption: ```rust struct MyStruct; impl MyStruct { fn f() {|x, y} } ``` Here, the parameter list is `x, y` and the following token is `}`. The parser discards `}`, and then we have a curly bracket mismatch. Indeed, this code has a syntax error. On current nightly, the compiler emits an syntax error, but with incorrect message and span, followed by an ICE. ``` error: expected expression, found `}` --> 44021.rs:4:1 | 4 | } | ^ error: internal compiler error: unexpected panic ``` Even worse, on current stable(1.20.0), the compiler falls into an infinite loop. This pull request fixes this problem. Now the compiler emits correct error message and span, and does not ICE. ``` error: expected one of `:`, `@`, or `|`, found `}` --> 44021.rs:3:20 | 3 | fn foo() {|x, y} | ^ expected one of `:`, `@`, or `|` here ```
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
Sep 10, 2017
Expect pipe symbol after closure parameter list Fixes rust-lang#44021. --- Originally, the parser just called `bump` to discard following token after parsing closure parameter list, because it assumes `|` is following. However, the following code breaks the assumption: ```rust struct MyStruct; impl MyStruct { fn f() {|x, y} } ``` Here, the parameter list is `x, y` and the following token is `}`. The parser discards `}`, and then we have a curly bracket mismatch. Indeed, this code has a syntax error. On current nightly, the compiler emits an syntax error, but with incorrect message and span, followed by an ICE. ``` error: expected expression, found `}` --> 44021.rs:4:1 | 4 | } | ^ error: internal compiler error: unexpected panic ``` Even worse, on current stable(1.20.0), the compiler falls into an infinite loop. This pull request fixes this problem. Now the compiler emits correct error message and span, and does not ICE. ``` error: expected one of `:`, `@`, or `|`, found `}` --> 44021.rs:3:20 | 3 | fn foo() {|x, y} | ^ expected one of `:`, `@`, or `|` here ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The test also causes 1.18 and 1.19 to loop indefinitely.
The text was updated successfully, but these errors were encountered: