Skip to content

ICE on nightly 1.56.0 (2021-07-29) when missing semicolon or function body in impl block #87635

Closed
@dataphract

Description

@dataphract

Playground with repro here. Not present in latest stable or beta.

Code

struct Foo {}

impl Foo {
    pub fn bar()
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (492723897 2021-07-29)
binary: rustc
commit-hash: 492723897e9b4db6701b3a75b72618d08a7d5319
commit-date: 2021-07-29
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1

Error output

   Compiling ice v0.1.0 ([redacted])
error: expected `;`, found `}`
 --> src/main.rs:4:17
  |
4 |     pub fn bar()
  |                 ^ help: add `;` here
5 | }
  | - unexpected token

thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_parse/src/parser/item.rs:1723:17
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.56.0-nightly (492723897 2021-07-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
end of query stack
error: could not compile `ice` due to previous error
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/492723897e9b4db6701b3a75b72618d08a7d5319/library/std/src/panicking.rs:516:5
   1: core::panicking::panic_fmt
             at /rustc/492723897e9b4db6701b3a75b72618d08a7d5319/library/core/src/panicking.rs:93:14
   2: core::panicking::panic
             at /rustc/492723897e9b4db6701b3a75b72618d08a7d5319/library/core/src/panicking.rs:50:5
   3: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_fn
   4: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_kind
   5: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common
   6: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_assoc_item
   7: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_impl
   8: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_kind
   9: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common
  10: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_mod
  11: rustc_parse::parse_crate_from_file
  12: rustc_session::utils::<impl rustc_session::session::Session>::time
  13: rustc_interface::passes::parse
  14: rustc_interface::queries::Queries::parse
  15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  16: rustc_span::with_source_map
  17: rustc_interface::interface::create_compiler_and_run
  18: scoped_tls::ScopedKey<T>::set

Activity

added
C-bugCategory: This is a bug.
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Jul 30, 2021
added
A-parserArea: The lexing & parsing of Rust source code to an AST
on Jul 30, 2021
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Jul 30, 2021
JohnTitor

JohnTitor commented on Jul 30, 2021

@JohnTitor
Member

Regressed since #87480, I think #87436 is the cause.

self-assigned this
on Jul 30, 2021
apiraino

apiraino commented on Jul 31, 2021

@apiraino
Contributor

right, this issue can be probably be closed as duplicate of #87647

steffahn

steffahn commented on Jul 31, 2021

@steffahn
Member

@apiraino

I would suggest not closing this issue as long as #87647 literally starts with the statement

This also ICEs, but that's a separate issue: #87635

referencing back to this issue. Furthermore, this issue is older, so if they’d be duplicates, #87647 would be closed.

added 3 commits that reference this issue on Aug 3, 2021

Rollup merge of rust-lang#87646 - JohnTitor:fix-parser-ice, r=oli-obk

f9070ca

Rollup merge of rust-lang#87646 - JohnTitor:fix-parser-ice, r=oli-obk

9b3f2b2

Rollup merge of rust-lang#87646 - JohnTitor:fix-parser-ice, r=oli-obk

f69daa2
removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @steffahn@apiraino@JohnTitor@rustbot@dataphract

    Issue actions

      ICE on nightly 1.56.0 (2021-07-29) when missing semicolon or function body in impl block · Issue #87635 · rust-lang/rust