Skip to content

Disallow cast with trailing braced macro in let-else#125049

Merged
bors merged 3 commits intorust-lang:masterfrom
dtolnay:castbrace
May 22, 2024
Merged

Disallow cast with trailing braced macro in let-else#125049
bors merged 3 commits intorust-lang:masterfrom
dtolnay:castbrace

Conversation

@dtolnay
Copy link
Copy Markdown
Member

@dtolnay dtolnay commented May 12, 2024

This fixes an edge case I noticed while porting #118880 and #119062 to syn.

Previously, rustc incorrectly accepted code such as:

let foo = &std::ptr::null as &'static dyn std::ops::Fn() -> *const primitive! {
    8
} else {
    return;
};

even though a right curl brace } directly before else in a let...else statement is not supposed to be valid syntax.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area: The lexing & parsing of Rust source code to an AST T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants