Skip to content

Under FAF we now wrongly accept final $($expr)? in stmt position parsing it as $($expr)? #152820

@fmease

Description

@fmease

Found thanks to @matthiaskrgr continuously fuzzing https://github.com/fmease/rasur versus rustc (downstream report: fmease/rasur#26).


With the introduction of FAF in PR #151783, we now wrongfully accept the following program (if the feature is enabled):

#![feature(final_associated_functions)]

fn main() {
    final;
    final 1 + 1;
    final { println!("text"); };
}

It essentially gets parsed as:

#![feature(final_associated_functions)]

fn main() {
    ;
    1 + 1;
    { println!("text"); };
}

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.F-final_associated_functions`#![feature(final_associated_functions)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions