Skip to content

Pattern matching regression 1.45.0 -> 1.45.1 (+nightly) #74954

Closed

Description

@jsgf

I tried this code:

fn main() {
    if let Some([b'@', filename @ ..]) = Some(b"@abc123") {
        println!("filename {:?}", filename);
    }
}

I expected this to compile and print

filename [97, 98, 99, 49, 50, 51]

which it does with 1.45.0

Instead, it failed to compile on both 1.45.1 and nightly:

error[E0425]: cannot find value `filename` in this scope
 --> src/main.rs:3:35
  |
3 |         println!("filename {:?}", filename);
  |                                   ^^^^^^^^ not found in this scope

error: aborting due to previous error

Playground link

Meta

rustc --version --verbose:

rustc 1.45.1 (c367798cf 2020-07-26)
binary: rustc
commit-hash: c367798cfd3817ca6ae908ce675d1d99242af148
commit-date: 2020-07-26
host: x86_64-unknown-linux-gnu
release: 1.45.1
LLVM version: 10.0

Activity

  1. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jul 30, 2020
  2. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jul 30, 2020
  3. cuviper commented on Jul 30, 2020

    @cuviper
    Member

    It still works on the playground 1.46.0-beta.2 though.

    There were two compiler backports in 1.45.1 -- the first from #73613 is already on beta too, but the second #74509 is not yet, so maybe that caused the regression?

  4. cuviper commented on Jul 30, 2020

    @cuviper
    Member

    Actually 174b582 looks more relevant, backported from #74557.
    edit: and the followup #74692 was also backported.

  5. Mark-Simulacrum commented on Jul 30, 2020

    @Mark-Simulacrum
    Member

    cc @petrochenkov @estebank

    It sounds like our caution in the stable-backport discussion was merited :/

    We'll probably want to back out 174b582, I guess.

  6. nagisa commented on Jul 30, 2020

    @nagisa
    Member

    I think this is the 2nd instance over the years where we end up with a breaking stable backport. Last time (in 1.27.2) we very quickly prepared another point release. This bug might merit something like that again. I’m going to preliminarily and unilaterally prioritize this as P-critical, but also leave the I-prioritize to ensure the prioritization team looks at this.

  7. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    and removed
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Jul 30, 2020
  8. Mark-Simulacrum commented on Jul 30, 2020

    @Mark-Simulacrum
    Member

    I will try and prepare artifacts for a 1.45.2 which reverts the pattern-related commits today, with an aim for a release tomorrow at 1pm eastern (or, if we can't get approval from some compiler team members that quickly, Monday).

  9. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jul 30, 2020
  10. added 2 commits that reference this issue on Jul 31, 2020
  11. JohnTitor commented on Aug 3, 2020

    @JohnTitor
    Member

    Triage: The nightly failure is fixed by #74963, waiting on 1.45.2 release for stable one.

  12. JohnTitor commented on Aug 4, 2020

    @JohnTitor
    Member

    So, the failure has been "fixed" in the both versions, I'm going to close this. If I have missed something, please re-open it :)

  13. added a commit that references this issue on Aug 6, 2020
  14. added a commit that references this issue on May 11, 2026
  15. added a commit that references this issue on May 14, 2026
  16. added a commit that references this issue on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-slice-patternsArea: Slice patterns, https://github.com/rust-lang/rust/issues/23121C-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-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions