Closed
Description
This also ICEs, but that's a separate issue: #87635. The MCVE here is also from that issue.
I think this issue is also caused by #87436, based on looking at the changes in the test output from that PR. That PR seems to have changed the parser to emit an expected `;`, found ...
error regardless of what token was actually expected.
Code
struct Foo {}
impl Foo {
pub fn bar()
}
fn main() {}
Nightly error
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 codegen-units=1 -C debuginfo=2 --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 `playground` due to previous error
Beta error
error: expected one of `->`, `;`, `where`, or `{`, found `}`
--> src/main.rs:5:1
|
4 | pub fn bar()
| --- - expected one of `->`, `;`, `where`, or `{`
| |
| while parsing this `fn`
5 | }
| ^ unexpected token
error: associated function in `impl` without body
--> src/main.rs:4:5
|
4 | pub fn bar()
| ^^^^^^^^^^^-
| |
| help: provide a definition for the function: `{ <body> }`
error: could not compile `playground` due to 2 previous errors
Meta
Regressed in nightly 1.56.0.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A structured suggestion resulting in incorrect code.Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to beta.