This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -48,19 +48,19 @@ LL | let &ref mut x = &0;
4848 | ^^^^^^^^^ cannot borrow as mutable
4949
5050error[E0596]: cannot borrow data in a `&` reference as mutable
51- --> $DIR/borrowck-errors.rs:35 :23
51+ --> $DIR/borrowck-errors.rs:37 :23
5252 |
5353LL | if let &Some(Some(x)) = &Some(&mut Some(0)) {
5454 | ^ cannot borrow as mutable
5555
5656error[E0596]: cannot borrow data in a `&` reference as mutable
57- --> $DIR/borrowck-errors.rs:40 :11
57+ --> $DIR/borrowck-errors.rs:42 :11
5858 |
5959LL | let &[x] = &&mut [0];
6060 | ^ cannot borrow as mutable
6161
6262error[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 |
6565LL | let [&mut x] = &mut [&mut 0];
6666 | - ^^^^^^^^^^^^^ cannot move out of here
Original file line number Diff line number Diff 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;
Original file line number Diff line number Diff line change @@ -52,13 +52,13 @@ LL | let &ref mut x = &0;
5252 | ^^^^^^^^^ cannot borrow as mutable
5353
5454error[E0596]: cannot borrow data in a `&` reference as mutable
55- --> $DIR/borrowck-errors.rs:35 :23
55+ --> $DIR/borrowck-errors.rs:37 :23
5656 |
5757LL | if let &Some(Some(x)) = &Some(&mut Some(0)) {
5858 | ^ cannot borrow as mutable
5959
6060error[E0596]: cannot borrow data in a `&` reference as mutable
61- --> $DIR/borrowck-errors.rs:40 :11
61+ --> $DIR/borrowck-errors.rs:42 :11
6262 |
6363LL | let &[x] = &&mut [0];
6464 | ^ cannot borrow as mutable
You can’t perform that action at this time.
0 commit comments