Skip to content

Commit a5a039d

Browse files
committed
borrowck-mutate-in-guard: update test.
1 parent b6c472a commit a5a039d

File tree

3 files changed

+8
-61
lines changed

3 files changed

+8
-61
lines changed

src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr

-41
This file was deleted.

src/test/ui/borrowck/borrowck-mutate-in-guard.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@ fn foo() -> isize {
99
match x {
1010
Enum::A(_) if { x = Enum::B(false); false } => 1,
1111
//~^ ERROR cannot assign in a pattern guard
12-
//~| WARN cannot assign `x` in match guard
13-
//~| WARN this error has been downgraded to a warning for backwards compatibility
14-
//~| WARN this represents potential undefined behavior in your code and this warning will
12+
//~| ERROR cannot assign `x` in match guard
1513
Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
1614
//~^ ERROR cannot mutably borrow in a pattern guard
1715
//~| ERROR cannot assign in a pattern guard
18-
//~| WARN cannot mutably borrow `x` in match guard
19-
//~| WARN this error has been downgraded to a warning for backwards compatibility
20-
//~| WARN this represents potential undefined behavior in your code and this warning will
16+
//~| ERROR cannot mutably borrow `x` in match guard
2117
Enum::A(p) => *p,
2218
Enum::B(_) => 2,
2319
}

src/test/ui/borrowck/borrowck-mutate-in-guard.stderr

+6-14
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,37 @@ LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
55
| ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
66

77
error[E0301]: cannot mutably borrow in a pattern guard
8-
--> $DIR/borrowck-mutate-in-guard.rs:15:38
8+
--> $DIR/borrowck-mutate-in-guard.rs:13:38
99
|
1010
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
1111
| ^ borrowed mutably in pattern guard
1212
|
1313
= help: add `#![feature(bind_by_move_pattern_guards)]` to the crate attributes to enable
1414

1515
error[E0302]: cannot assign in a pattern guard
16-
--> $DIR/borrowck-mutate-in-guard.rs:15:41
16+
--> $DIR/borrowck-mutate-in-guard.rs:13:41
1717
|
1818
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
1919
| ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
2020

21-
warning[E0510]: cannot assign `x` in match guard
21+
error[E0510]: cannot assign `x` in match guard
2222
--> $DIR/borrowck-mutate-in-guard.rs:10:25
2323
|
2424
LL | match x {
2525
| - value is immutable in match guard
2626
LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
2727
| ^^^^^^^^^^^^^^^^^^ cannot assign
28-
|
29-
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
30-
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
31-
= note: for more information, try `rustc --explain E0729`
3228

33-
warning[E0510]: cannot mutably borrow `x` in match guard
34-
--> $DIR/borrowck-mutate-in-guard.rs:15:33
29+
error[E0510]: cannot mutably borrow `x` in match guard
30+
--> $DIR/borrowck-mutate-in-guard.rs:13:33
3531
|
3632
LL | match x {
3733
| - value is immutable in match guard
3834
...
3935
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
4036
| ^^^^^^ cannot mutably borrow
41-
|
42-
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
43-
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
44-
= note: for more information, try `rustc --explain E0729`
4537

46-
error: aborting due to 3 previous errors
38+
error: aborting due to 5 previous errors
4739

4840
Some errors have detailed explanations: E0301, E0302, E0510.
4941
For more information about an error, try `rustc --explain E0301`.

0 commit comments

Comments
 (0)