Skip to content

Commit fc5c182

Browse files
committed
Update tests
1 parent 8ee5761 commit fc5c182

14 files changed

+503
-460
lines changed

tests/ui/feature-gates/feature-gate-exhaustive-patterns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ fn foo() -> Result<u32, !> {
55
}
66

77
fn main() {
8-
let Ok(_x) = foo(); //~ ERROR refutable pattern in local binding
8+
let Ok(_x) = &foo(); //~ ERROR refutable pattern in local binding
99
}

tests/ui/feature-gates/feature-gate-exhaustive-patterns.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error[E0005]: refutable pattern in local binding
22
--> $DIR/feature-gate-exhaustive-patterns.rs:8:9
33
|
4-
LL | let Ok(_x) = foo();
5-
| ^^^^^^ pattern `Err(_)` not covered
4+
LL | let Ok(_x) = &foo();
5+
| ^^^^^^ pattern `&Err(_)` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
88
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
9-
= note: the matched value is of type `Result<u32, !>`
9+
= note: the matched value is of type `&Result<u32, !>`
1010
help: you might want to use `let else` to handle the variant that isn't matched
1111
|
12-
LL | let Ok(_x) = foo() else { todo!() };
13-
| ++++++++++++++++
12+
LL | let Ok(_x) = &foo() else { todo!() };
13+
| ++++++++++++++++
1414

1515
error: aborting due to 1 previous error
1616

tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LL | _ if false => {}
3131
error[E0005]: refutable pattern in local binding
3232
--> $DIR/empty-match-check-notes.rs:35:9
3333
|
34-
LL | let None = x;
34+
LL | let None = *x;
3535
| ^^^^ pattern `Some(_)` not covered
3636
|
3737
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
@@ -40,8 +40,8 @@ LL | let None = x;
4040
= note: the matched value is of type `Option<SecretlyUninhabitedForeignStruct>`
4141
help: you might want to use `if let` to ignore the variant that isn't matched
4242
|
43-
LL | if let None = x { todo!() };
44-
| ++ +++++++++++
43+
LL | if let None = *x { todo!() };
44+
| ++ +++++++++++
4545

4646
error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
4747
--> $DIR/empty-match-check-notes.rs:45:11

tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@ LL | _ if false => {}
3131
error[E0005]: refutable pattern in local binding
3232
--> $DIR/empty-match-check-notes.rs:35:9
3333
|
34-
LL | let None = x;
34+
LL | let None = *x;
3535
| ^^^^ pattern `Some(_)` not covered
3636
|
3737
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
3838
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
39+
= note: pattern `Some(_)` is currently uninhabited, but this variant contains private fields which may become inhabited in the future
3940
= note: the matched value is of type `Option<SecretlyUninhabitedForeignStruct>`
4041
help: you might want to use `if let` to ignore the variant that isn't matched
4142
|
42-
LL | if let None = x { todo!() };
43-
| ++ +++++++++++
43+
LL | if let None = *x { todo!() };
44+
| ++ +++++++++++
4445

4546
error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
4647
--> $DIR/empty-match-check-notes.rs:45:11

tests/ui/pattern/usefulness/empty-match-check-notes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ fn empty_foreign_enum(x: empty::EmptyForeignEnum) {
3131
}
3232
}
3333

34-
fn empty_foreign_enum_private(x: Option<empty::SecretlyUninhabitedForeignStruct>) {
35-
let None = x;
34+
fn empty_foreign_enum_private(x: &Option<empty::SecretlyUninhabitedForeignStruct>) {
35+
let None = *x;
3636
//~^ ERROR refutable pattern in local binding
3737
//~| NOTE `let` bindings require an "irrefutable pattern"
3838
//~| NOTE for more information, visit
3939
//~| NOTE the matched value is of type
4040
//~| NOTE pattern `Some(_)` not covered
41-
//[exhaustive_patterns]~| NOTE currently uninhabited, but this variant contains private fields
41+
//~| NOTE currently uninhabited, but this variant contains private fields
4242
}
4343

4444
fn main() {

0 commit comments

Comments
 (0)