Rust: Pattern matching regression 1.45.0 -> 1.45.1 (+nightly)

Created on 30 Jul 2020  路  7Comments  路  Source: rust-lang/rust

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


A-slice-patterns C-bug P-critical T-compiler regression-from-stable-to-stable

Most helpful comment

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鈥檓 going to preliminarily and unilaterally prioritize this as P-critical, but also leave the I-prioritize to ensure the prioritization team looks at this.

All 7 comments

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?

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

cc @petrochenkov @estebank

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

We'll probably want to back out https://github.com/rust-lang/rust/commit/174b58287c66a6ad3eaa1897279d769611919960, I guess.

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鈥檓 going to preliminarily and unilaterally prioritize this as P-critical, but also leave the I-prioritize to ensure the prioritization team looks at this.

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).

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

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 :)

Was this page helpful?
0 / 5 - 0 ratings