Stream: t-compiler/wg-prioritization/alerts

Topic: I-prioritize #78115 ICE: variable should be placed in scopeā€¦


triagebot (Oct 19 2020 at 19:59, on Zulip):

@WG-prioritization/alerts issue #78115 has been requested for prioritization.

Procedure

Hameer Abbasi (Oct 19 2020 at 20:01, on Zulip):

P-high at least? Sound like a regression from stable and could be a pretty common pattern.

LeSeulArtichaut (Oct 19 2020 at 20:04, on Zulip):

This is invalid code though, right?

LeSeulArtichaut (Oct 19 2020 at 20:04, on Zulip):

Can this happen with valid code?

Stu (Oct 19 2020 at 20:06, on Zulip):

Yes it can.

struct Foo {
    a: bool,
}

fn main() {
    let foo = Foo { a: true };
    let s = async {
        match foo {
            Foo { a } | Foo { a } if true => {}
        }
    };
}
LeSeulArtichaut (Oct 19 2020 at 20:07, on Zulip):

If bisection is correct it broke a while ago though Nvm can't read

LeSeulArtichaut (Oct 19 2020 at 20:09, on Zulip):

The ICE occurs if you're using a match guard and binding the same variable name in both sides of an "or" in a match pattern.

Looks like a fairly serious regression indeed, I think P-high is fine but do you think it warrants P-critical?

Stu (Oct 19 2020 at 20:09, on Zulip):

Probably even P-critical? This code seems very likely to happen in normal code you would write

LeSeulArtichaut (Oct 19 2020 at 20:09, on Zulip):

Let me do a quick bisection check

LeSeulArtichaut (Oct 19 2020 at 20:12, on Zulip):

@Stu Your last snippet doesn't compile on stable though:

error[E0004]: non-exhaustive patterns: `Foo { .. }` not covered
 --> src/main.rs:8:15
  |
1 | / struct Foo {
2 | |     a: bool,
3 | | }
  | |_- `Foo` defined here
...
8 |           match foo {
  |                 ^^^ pattern `Foo { .. }` not covered
  |
  = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
  = note: the matched value is of type `Foo`
Stu (Oct 19 2020 at 20:12, on Zulip):

the ICE is only on nightly, so I tested it on nightly

Yuki Okushi (Oct 19 2020 at 20:15, on Zulip):

wildcard pattern is required, as diags said

Stu (Oct 19 2020 at 20:16, on Zulip):

But it still panics on nightly, even with a wildcard pattern

Stu (Oct 19 2020 at 20:18, on Zulip):

So what should we pick? critical or high? I'm fine with both but I would label it as critical

LeSeulArtichaut (Oct 19 2020 at 20:19, on Zulip):

Also ICEs in async fns

LeSeulArtichaut (Oct 19 2020 at 20:19, on Zulip):
async fn bar() {
    match foo {
        Foo::A(a) | Foo::B(a) if true => {}
        _ => {}
    }
}

Triggers an ICE

LeSeulArtichaut (Oct 19 2020 at 20:19, on Zulip):

So I think it should be P-critical

triagebot (Oct 19 2020 at 20:20, on Zulip):

Issue #78115's prioritization request has been removed.

LeSeulArtichaut (Oct 19 2020 at 21:39, on Zulip):

(Filed a potential fix: #78121)

Last update: Apr 11 2021 at 18:30UTC