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

Lifetimes are parsed without errors when they occur in most ExpressionWithBlocks in front of the contained block expression #103983

Closed
Veykril opened this issue Nov 4, 2022 · 3 comments · Fixed by #103986
Assignees
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Veykril
Copy link
Member

Veykril commented Nov 4, 2022

I tried this code playground:

fn main() {
    if let () = () 'a {}
    if true 'a {}
    loop 'a {}
    while true 'a {}
    while let () = () 'a {}
    for _ in 0..0 'a {}
    unsafe 'a {}
}

I expected to see this happen: The compiler rejects all these expressions as the lifetimes are in a nonsensical position.

Instead, this happened: The compiler accepted the expressions without saying anything

Meta

This behavior seems to occur since 1.61.
1.60 and below properly reject the code.

@Veykril Veykril added the C-bug Category: This is a bug. label Nov 4, 2022
@compiler-errors compiler-errors self-assigned this Nov 4, 2022
@compiler-errors
Copy link
Member

This very likely regressed in #92823, I'll put up a fix in like 30 mins.

@compiler-errors
Copy link
Member

For the record --

Bisection points at:
found 9 bors merge commits in the specified range
commit[0] 2022-02-27UTC: Auto merge of #94412 - scottmcm:cfg-out-miri-from-swap, r=oli-obk
commit[1] 2022-02-27UTC: Auto merge of #94157 - erikdesjardins:more-noundef, r=nikic
commit[2] 2022-02-28UTC: Auto merge of #94431 - matthiaskrgr:rollup-1jsj0wu, r=matthiaskrgr
commit[3] 2022-02-28UTC: Auto merge of #94437 - RalfJung:miri, r=RalfJung
commit[4] 2022-02-28UTC: Auto merge of #94158 - erikdesjardins:more-more-noundef, r=nikic
commit[5] 2022-02-28UTC: Auto merge of #94427 - cjgillot:inline-fresh-expn, r=oli-obk
commit[6] 2022-02-28UTC: Auto merge of #94216 - psumbera:sparc64-abi-fix2, r=nagisa
commit[7] 2022-02-28UTC: Auto merge of #94447 - matthiaskrgr:rollup-d8rj2xv, r=matthiaskrgr
commit[8] 2022-02-28UTC: Auto merge of #94453 - matthiaskrgr:rollup-xv9y98j, r=matthiaskrgr

@Rageking8
Copy link
Contributor

@rustbot label +T-compiler +A-parser +A-lifetimes

@rustbot rustbot added A-lifetimes Area: Lifetimes / regions A-parser Area: The parsing of Rust source code to an AST T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 5, 2022
@compiler-errors compiler-errors removed the A-lifetimes Area: Lifetimes / regions label Nov 5, 2022
@bors bors closed this as completed in 170ad4a Nov 7, 2022
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. 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.

4 participants