about summary refs log tree commit diff
path: root/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr
blob: b7fb70dfd24693fd113875d5f700ecda2606d7a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
error[E0308]: mismatched types
  --> $DIR/ref-binding-on-inh-ref-errors.rs:54:10
   |
LL |     let [&mut ref x] = &[&mut 0];
   |          ^^^^^
   |
   = note: cannot match inherited `&` with `&mut` pattern
help: replace this `&mut` pattern with `&`
   |
LL |     let [&ref x] = &[&mut 0];
   |          ~

error: binding modifiers may only be written when the default binding mode is `move`
  --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10
   |
LL |     let [ref mut x] = &[0];
   |          ^^^^^^^ binding modifier not allowed under `ref` default binding mode
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
  --> $DIR/ref-binding-on-inh-ref-errors.rs:67:9
   |
LL |     let [ref mut x] = &[0];
   |         ^^^^^^^^^^^ this matches on type `&_`
help: make the implied reference pattern explicit
   |
LL |     let &[ref mut x] = &[0];
   |         +

error[E0596]: cannot borrow data in a `&` reference as mutable
  --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10
   |
LL |     let [ref mut x] = &[0];
   |          ^^^^^^^^^ cannot borrow as mutable

error: binding modifiers may only be written when the default binding mode is `move`
  --> $DIR/ref-binding-on-inh-ref-errors.rs:75:10
   |
LL |     let [ref x] = &[0];
   |          ^^^ binding modifier not allowed under `ref` default binding mode
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
  --> $DIR/ref-binding-on-inh-ref-errors.rs:75:9
   |
LL |     let [ref x] = &[0];
   |         ^^^^^^^ this matches on type `&_`
help: make the implied reference pattern explicit
   |
LL |     let &[ref x] = &[0];
   |         +

error: binding modifiers may only be written when the default binding mode is `move`
  --> $DIR/ref-binding-on-inh-ref-errors.rs:79:10
   |
LL |     let [ref x] = &mut [0];
   |          ^^^ binding modifier not allowed under `ref mut` default binding mode
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
  --> $DIR/ref-binding-on-inh-ref-errors.rs:79:9
   |
LL |     let [ref x] = &mut [0];
   |         ^^^^^^^ this matches on type `&mut _`
help: make the implied reference pattern explicit
   |
LL |     let &mut [ref x] = &mut [0];
   |         ++++

error: binding modifiers may only be written when the default binding mode is `move`
  --> $DIR/ref-binding-on-inh-ref-errors.rs:83:10
   |
LL |     let [ref mut x] = &mut [0];
   |          ^^^^^^^ binding modifier not allowed under `ref mut` default binding mode
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
  --> $DIR/ref-binding-on-inh-ref-errors.rs:83:9
   |
LL |     let [ref mut x] = &mut [0];
   |         ^^^^^^^^^^^ this matches on type `&mut _`
help: make the implied reference pattern explicit
   |
LL |     let &mut [ref mut x] = &mut [0];
   |         ++++

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0308, E0596.
For more information about an error, try `rustc --explain E0308`.