Skip to content

Commit ba12489

Browse files
committed
Add comment for regression #136223 on borrowck-errors.rs
Signed-off-by: Shunpoco <[email protected]>
1 parent a9e7b30 commit ba12489

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Diff for: tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic2024.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ LL | let &ref mut x = &0;
4848
| ^^^^^^^^^ cannot borrow as mutable
4949

5050
error[E0596]: cannot borrow data in a `&` reference as mutable
51-
--> $DIR/borrowck-errors.rs:35:23
51+
--> $DIR/borrowck-errors.rs:37:23
5252
|
5353
LL | if let &Some(Some(x)) = &Some(&mut Some(0)) {
5454
| ^ cannot borrow as mutable
5555

5656
error[E0596]: cannot borrow data in a `&` reference as mutable
57-
--> $DIR/borrowck-errors.rs:40:11
57+
--> $DIR/borrowck-errors.rs:42:11
5858
|
5959
LL | let &[x] = &&mut [0];
6060
| ^ cannot borrow as mutable
6161

6262
error[E0508]: cannot move out of type `[&mut i32; 1]`, a non-copy array
63-
--> $DIR/borrowck-errors.rs:44:20
63+
--> $DIR/borrowck-errors.rs:46:20
6464
|
6565
LL | let [&mut x] = &mut [&mut 0];
6666
| - ^^^^^^^^^^^^^ cannot move out of here

Diff for: tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ pub fn main() {
3232
let &ref mut x = &0;
3333
//~^ cannot borrow data in a `&` reference as mutable [E0596]
3434

35+
// For 2021 edition, this is also a regression test for #136223
36+
// since the maximum mutability is downgraded during the pattern check process.
3537
if let &Some(Some(x)) = &Some(&mut Some(0)) {
3638
//[stable2021,classic2024]~^ ERROR: cannot borrow data in a `&` reference as mutable
3739
let _: &u32 = x;

Diff for: tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.stable2021.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ LL | let &ref mut x = &0;
5252
| ^^^^^^^^^ cannot borrow as mutable
5353

5454
error[E0596]: cannot borrow data in a `&` reference as mutable
55-
--> $DIR/borrowck-errors.rs:35:23
55+
--> $DIR/borrowck-errors.rs:37:23
5656
|
5757
LL | if let &Some(Some(x)) = &Some(&mut Some(0)) {
5858
| ^ cannot borrow as mutable
5959

6060
error[E0596]: cannot borrow data in a `&` reference as mutable
61-
--> $DIR/borrowck-errors.rs:40:11
61+
--> $DIR/borrowck-errors.rs:42:11
6262
|
6363
LL | let &[x] = &&mut [0];
6464
| ^ cannot borrow as mutable

0 commit comments

Comments
 (0)