2025-08-29 20:39:36 +00:00
|
|
|
// Issue #51976
|
|
|
|
|
//@ run-rustfix
|
2025-08-30 16:24:26 +00:00
|
|
|
#![allow(unused_variables)] // allowed so we don't get overlapping suggestions
|
2025-08-29 20:39:36 +00:00
|
|
|
enum Lol {
|
|
|
|
|
Foo,
|
|
|
|
|
Bar,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn foo(x: (Lol, Lol)) {
|
|
|
|
|
use Lol::*;
|
2025-08-30 01:44:40 +00:00
|
|
|
match &x {
|
2025-08-29 20:39:36 +00:00
|
|
|
(Foo, Bar) | (Ban, Foo) => {}
|
|
|
|
|
//~^ ERROR: variable `Ban` is not bound in all patterns
|
|
|
|
|
//~| HELP: you might have meant to use the similarly named previously used binding `Bar`
|
|
|
|
|
//~| NOTE: pattern doesn't bind `Ban`
|
|
|
|
|
//~| NOTE: variable not in all patterns
|
|
|
|
|
_ => {}
|
|
|
|
|
}
|
2025-08-30 01:44:40 +00:00
|
|
|
match &x {
|
|
|
|
|
(Foo, _) | (Ban, Foo) => {}
|
|
|
|
|
//~^ ERROR: variable `Ban` is not bound in all patterns
|
|
|
|
|
//~| HELP: you might have meant to use the similarly named unit variant `Bar`
|
|
|
|
|
//~| NOTE: pattern doesn't bind `Ban`
|
|
|
|
|
//~| NOTE: variable not in all patterns
|
|
|
|
|
_ => {}
|
|
|
|
|
}
|
2025-08-29 20:39:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
use Lol::*;
|
|
|
|
|
foo((Foo, Bar));
|
|
|
|
|
}
|