Skip to content

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

@Veykril

Description

@Veykril
Member

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.

Activity

compiler-errors

compiler-errors commented on Nov 4, 2022

@compiler-errors
Member

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

compiler-errors

compiler-errors commented on Nov 4, 2022

@compiler-errors
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

Rageking8 commented on Nov 5, 2022

@Rageking8
Contributor

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

added
A-lifetimesArea: Lifetimes / regions
A-parserArea: The lexing & parsing of Rust source code to an AST
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Nov 5, 2022
added a commit that references this issue on Nov 7, 2022
170ad4a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

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

    Participants

    @compiler-errors@Veykril@rustbot@Rageking8

    Issue actions

      Lifetimes are parsed without errors when they occur in most `ExpressionWithBlock`s in front of the contained block expression · Issue #103983 · rust-lang/rust