Skip to content

Regression parsing closing angle brackets near function ptr return type #78507

Closed
@dtolnay

Description

@dtolnay

Alternate title: "Rust is literally C++" https://wg21.link/N1757

As of nightly-2020-10-29, rustc fails to parse the following code. The previous nightly and all past stable releases since 1.0.0 are not affected.

pub fn f() -> Option<fn() -> Option<bool>> {
    None
}
error: unmatched angle bracket
 --> src/main.rs:1:42
  |
1 | pub fn f() -> Option<fn() -> Option<bool>> {
  |                                          ^^ help: remove extra angle bracket

error: expected one of `,` or `>`, found `{`
 --> src/main.rs:1:44
  |
1 | pub fn f() -> Option<fn() -> Option<bool>> {
  |                                            ^ expected one of `,` or `>`

The relevant commit range is 07e968b...31ee872.

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.P-criticalCritical priorityT-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