File tree 3 files changed +7
-5
lines changed
tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental
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;
48
48
| ^^^^^^^^^ cannot borrow as mutable
49
49
50
50
error[E0596]: cannot borrow data in a `&` reference as mutable
51
- --> $DIR/borrowck-errors.rs:35 :23
51
+ --> $DIR/borrowck-errors.rs:37 :23
52
52
|
53
53
LL | if let &Some(Some(x)) = &Some(&mut Some(0)) {
54
54
| ^ cannot borrow as mutable
55
55
56
56
error[E0596]: cannot borrow data in a `&` reference as mutable
57
- --> $DIR/borrowck-errors.rs:40 :11
57
+ --> $DIR/borrowck-errors.rs:42 :11
58
58
|
59
59
LL | let &[x] = &&mut [0];
60
60
| ^ cannot borrow as mutable
61
61
62
62
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
64
64
|
65
65
LL | let [&mut x] = &mut [&mut 0];
66
66
| - ^^^^^^^^^^^^^ cannot move out of here
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ pub fn main() {
32
32
let & ref mut x = & 0 ;
33
33
//~^ cannot borrow data in a `&` reference as mutable [E0596]
34
34
35
+ // For 2021 edition, this is also a regression test for #136223
36
+ // since the maximum mutability is downgraded during the pattern check process.
35
37
if let & Some ( Some ( x) ) = & Some ( & mut Some ( 0 ) ) {
36
38
//[stable2021,classic2024]~^ ERROR: cannot borrow data in a `&` reference as mutable
37
39
let _: & u32 = x;
Original file line number Diff line number Diff line change @@ -52,13 +52,13 @@ LL | let &ref mut x = &0;
52
52
| ^^^^^^^^^ cannot borrow as mutable
53
53
54
54
error[E0596]: cannot borrow data in a `&` reference as mutable
55
- --> $DIR/borrowck-errors.rs:35 :23
55
+ --> $DIR/borrowck-errors.rs:37 :23
56
56
|
57
57
LL | if let &Some(Some(x)) = &Some(&mut Some(0)) {
58
58
| ^ cannot borrow as mutable
59
59
60
60
error[E0596]: cannot borrow data in a `&` reference as mutable
61
- --> $DIR/borrowck-errors.rs:40 :11
61
+ --> $DIR/borrowck-errors.rs:42 :11
62
62
|
63
63
LL | let &[x] = &&mut [0];
64
64
| ^ cannot borrow as mutable
You can’t perform that action at this time.
0 commit comments