Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dtolnay opened this issue Oct 29, 2020 · 4 comments · Fixed by #78523
Closed

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

dtolnay opened this issue Oct 29, 2020 · 4 comments · Fixed by #78523
Assignees
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dtolnay
Copy link
Member

dtolnay commented Oct 29, 2020

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.

@dtolnay dtolnay added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Oct 29, 2020
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 29, 2020
@dtolnay dtolnay added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 29, 2020
@dtolnay
Copy link
Member Author

dtolnay commented Oct 29, 2020

Mentioning @estebank @varkor because #78379 "Tweak invalid `fn` header and body parsing" sounds extremely relevant.

@jyn514 jyn514 added the A-parser Area: The parsing of Rust source code to an AST label Oct 29, 2020
@camelid camelid added P-critical Critical priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 29, 2020
@camelid
Copy link
Member

camelid commented Oct 29, 2020

Assigning P-critical and removing I-prioritize as discussed in the prioritization working group.

@camelid
Copy link
Member

camelid commented Oct 29, 2020

searched nightlies: from nightly-2020-10-27 to nightly-2020-10-29
regressed nightly: nightly-2020-10-29
searched commits: from 07e968b to 31ee872
regressed commit: db241bb

bisected with cargo-bisect-rustc v0.6.0

Host triple: x86_64-apple-darwin
Reproduce with:

cargo bisect-rustc --preserve --regress=error --start=2020-10-27 

Yeah, seems likely that #78379 is the culprit.

@estebank
Copy link
Contributor

estebank commented Oct 29, 2020

Yep, this was me :-/

I'll have a PR up in the next hour.

@estebank estebank self-assigned this Oct 29, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this issue Oct 30, 2020
…ession, r=dtolnay

Revert invalid `fn` return type parsing change

Revert one of the changes in rust-lang#78379.

Fix rust-lang#78507.
@bors bors closed this as completed in f9a2664 Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants