Skip to content

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

@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 

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

No branches or pull requests

Issue actions