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

Internal Compiler Error @ parser.rs:446:22 #66357

Closed
JulianKnodt opened this issue Nov 13, 2019 · 4 comments · Fixed by #66361
Closed

Internal Compiler Error @ parser.rs:446:22 #66357

JulianKnodt opened this issue Nov 13, 2019 · 4 comments · Fixed by #66361
Assignees
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@JulianKnodt
Copy link
Contributor

JulianKnodt commented Nov 13, 2019

When compiling a personal project, I got an error that the compiler panicked and entered unreachable code.

I've dumped the output:

    Checking small_sat v0.1.0 (/Users/julianknodt/Desktop/programming/projects/rustjects/small_sat)
error: incorrect close delimiter: `}`
  --> src/watch_list.rs:88:9
   |
85 |         match next {
   |                    - close delimiter possibly meant for this
86 |           None => self.units.push(,
   |                                  - un-closed delimiter
87 |           Some(next) => todo.push((other_lit, cref, next)),
88 |         }
   |         ^ incorrect close delimiter

error: incorrect close delimiter: `}`
  --> src/watch_list.rs:95:5
   |
91 |     for (watched_lit, clause, next) in todo {
   |                                             - close delimiter possibly meant for this
92 |       self.occurrences[watched_lit.raw()].iter_mut().find(|
   |                                                          - un-closed delimiter
...
95 |     }
   |     ^ incorrect close delimiter

error: expected one of `:`, `;`, `=`, `@`, or `|`, found `if`
  --> src/watch_list.rs:77:5
   |
75 |     let new_units
   |                  - help: a semicolon may be missing here
76 | 
77 |     if let Some(clauses) = self.occurrences.get_mut(lit.raw() as usize) {
   |     ^^

error: expected expression, found `,`
  --> src/watch_list.rs:86:35
   |
86 |           None => self.units.push(,
   |                --                 ^ expected expression
   |                |
   |                while parsing the `match` arm starting here

error: expected one of `,`, `::`, or `:`, found `.`
  --> src/watch_list.rs:93:13
   |
93 |         self.occurrences[watched_lit.raw() as usize].insert(clause, *next),
   |             ^ expected one of `,`, `::`, or `:` here

error: expected one of `,`, `:`, or `@`, found `[`
  --> src/watch_list.rs:93:25
   |
93 |         self.occurrences[watched_lit.raw() as usize].insert(clause, *next),
   |                         ^ expected one of `,`, `:`, or `@` here

error: expected one of `,`, `@`, `]`, or `|`, found `.`
  --> src/watch_list.rs:93:37
   |
93 |         self.occurrences[watched_lit.raw() as usize].insert(clause, *next),
   |                                     ^ expected one of `,`, `@`, `]`, or `|` here

error: expected one of `,`, `]`, or `|`, found `as`
  --> src/watch_list.rs:93:44
   |
93 |         self.occurrences[watched_lit.raw() as usize].insert(clause, *next),
   |                                            ^^ expected one of `,`, `]`, or `|` here

error: expected identifier, found keyword `as`
  --> src/watch_list.rs:93:44
   |
93 |         self.occurrences[watched_lit.raw() as usize].insert(clause, *next),
   |                                            ^^ expected identifier, found keyword
   |
help: you can escape reserved keywords to use them as identifiers
   |
93 |         self.occurrences[watched_lit.raw() r#as usize].insert(clause, *next),
   |                                            ^^^^

error: expected one of `,`, `@`, `]`, or `|`, found `usize`
  --> src/watch_list.rs:93:47
   |
93 |         self.occurrences[watched_lit.raw() as usize].insert(clause, *next),
   |                                               ^^^^^ expected one of `,`, `@`, `]`, or `|` here

error: expected one of `,` or `:`, found `.`
  --> src/watch_list.rs:93:53
   |
93 |         self.occurrences[watched_lit.raw() as usize].insert(clause, *next),
   |                                                     ^ expected one of `,` or `:` here

error: expected one of `)`, `-`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*`
  --> src/watch_list.rs:93:69
   |
86 |           None => self.units.push(,
   |                                  - unclosed delimiter
...
93 |         self.occurrences[watched_lit.raw() as usize].insert(clause, *next),
   |                                                                    -^
   |                                                                    |
   |                                                                    help: `)` may belong here

thread 'rustc' panicked at 'internal error: entered unreachable code', src/libsyntax/parse/parser.rs:446:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

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.40.0-nightly (95f437b3c 2019-10-27) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: aborting due to 12 previous errors

error: could not compile `small_sat`.

To learn more, run the command again with --verbose.

And I committed my code which caused the bug here:
JulianKnodt/small_sat@5e82572

It might be because I had only written half of an anonymous function at watch_list.rs at line 92.

This is not that urgent as I only saw it with half-written code, but since the compiler suggested I file a bug I did.

rustc --version --verbose:

rustc 1.40.0-nightly (95f437b3c 2019-10-27)
binary: rustc
commit-hash: 95f437b3cfb2fec966d7eaf69d7c2e36f9c274d1
commit-date: 2019-10-27
host: x86_64-apple-darwin
release: 1.40.0-nightly
LLVM version: 9.0
@memoryruins
Copy link
Contributor

It might be because I had only written half of an anonymous function at watch_list.rs at line 92.

Good call! Reducing it to fn f() { |[](* } is enough to trigger the ICE.

backtrace
thread 'rustc' panicked at 'internal error: entered unreachable code', src/librustc_parse/parser/mod.rs:446:22
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1030
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:188
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:205
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:468
  12: std::panicking::begin_panic
  13: rustc_parse::parser::expr::<impl rustc_parse::parser::Parser>::parse_closure_expr
  14: rustc_parse::parser::expr::<impl rustc_parse::parser::Parser>::parse_bottom_expr
  15: rustc_parse::parser::expr::<impl rustc_parse::parser::Parser>::parse_dot_or_call_expr
  16: rustc_parse::parser::expr::<impl rustc_parse::parser::Parser>::parse_prefix_expr
  17: rustc_parse::parser::expr::<impl rustc_parse::parser::Parser>::parse_assoc_expr_with
  18: rustc_parse::parser::stmt::<impl rustc_parse::parser::Parser>::parse_stmt_without_recovery
  19: rustc_parse::parser::stmt::<impl rustc_parse::parser::Parser>::parse_full_stmt
  20: rustc_parse::parser::stmt::<impl rustc_parse::parser::Parser>::parse_block_tail
  21: rustc_parse::parser::stmt::<impl rustc_parse::parser::Parser>::parse_inner_attrs_and_block
  22: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_fn
  23: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_implementation
  24: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_
  25: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item
  26: rustc_parse::parser::module::<impl rustc_parse::parser::Parser>::parse_mod_items
  27: rustc_parse::parser::module::<impl rustc_parse::parser::Parser>::parse_crate_mod
  28: rustc_parse::parse_crate_from_file
  29: rustc_interface::passes::parse::{{closure}}
  30: rustc_interface::passes::parse
  31: rustc_interface::queries::Query<T>::compute
  32: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::parse
  33: rustc_interface::interface::run_compiler_in_existing_thread_pool
  34: std::thread::local::LocalKey<T>::with
  35: scoped_tls::ScopedKey<T>::set
  36: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.40.0-nightly (4f03f4a98 2019-11-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: aborting due to 2 previous errors

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=8486aeccb8fba32337178ccb6937bce0

@hellow554

This comment has been minimized.

@rustbot rustbot added A-frontend Area: Compiler frontend (errors, parsing and HIR) 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 Nov 13, 2019
@Centril Centril added I-nominated A-parser Area: The parsing of Rust source code to an AST labels Nov 13, 2019
@Centril
Copy link
Contributor

Centril commented Nov 13, 2019

I've traced the problem down to this call:

self.expect_or()?;

@Centril Centril self-assigned this Nov 13, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Nov 13, 2019
@pnkfelix
Copy link
Member

triage: P-high, removing nomination label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority 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.

7 participants