1- error[E0308]: mismatched types
1+ error: cannot match inherited `&` with `&mut` pattern
22 --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:7:17
33 |
44LL | if let Some(&mut Some(&_)) = &Some(&Some(0)) {
5- | ^^^^^^^^^^^^^ --------------- this expression has type `&Option<&Option<{integer}>>`
6- | |
7- | expected `Option<{integer}>`, found `&mut _`
5+ | ^^^^^
86 |
9- = note: expected enum `Option<{integer}>`
10- found mutable reference `&mut _`
7+ help: replace this `&mut` pattern with `&`
8+ |
9+ LL | if let Some(&Some(&_)) = &Some(&Some(0)) {
10+ | ~
1111
12- error[E0308]: mismatched types
12+ error: cannot match inherited `&` with `&mut` pattern
1313 --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:10:23
1414 |
1515LL | if let Some(&Some(&mut _)) = &Some(&mut Some(0)) {
16- | ^^^^^^ ------------------- this expression has type `&Option<&mut Option<{integer}>>`
17- | |
18- | expected integer, found `&mut _`
16+ | ^^^^^
1917 |
20- = note: expected type `{integer}`
21- found mutable reference `&mut _`
18+ help: replace this `&mut` pattern with `&`
19+ |
20+ LL | if let Some(&Some(&_)) = &Some(&mut Some(0)) {
21+ | ~
2222
2323error[E0308]: mismatched types
2424 --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:14:27
@@ -31,59 +31,59 @@ LL | let _: &mut u32 = x;
3131 = note: expected mutable reference `&mut u32`
3232 found reference `&{integer}`
3333
34- error[E0308]: mismatched types
34+ error: cannot match inherited `&` with `&mut` pattern
3535 --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:17:23
3636 |
3737LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) {
38- | ^^^^^^ ------------------- this expression has type `&mut Option<&Option<{integer}>>`
39- | |
40- | expected integer, found `&mut _`
38+ | ^^^^^
4139 |
42- = note: expected type `{integer}`
43- found mutable reference `&mut _`
40+ help: replace this `&mut` pattern with `&`
41+ |
42+ LL | if let Some(&Some(&_)) = &mut Some(&Some(0)) {
43+ | ~
4444
45- error[E0308]: mismatched types
45+ error: cannot match inherited `&` with `&mut` pattern
4646 --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:20:29
4747 |
4848LL | if let Some(&Some(Some((&mut _)))) = &Some(Some(&mut Some(0))) {
49- | ^^^^^^ ------------------------- this expression has type `&Option<Option<&mut Option<{integer}>>>`
50- | |
51- | expected integer, found `&mut _`
49+ | ^^^^^
5250 |
53- = note: expected type `{integer}`
54- found mutable reference `&mut _`
51+ help: replace this `&mut` pattern with `&`
52+ |
53+ LL | if let Some(&Some(Some((&_)))) = &Some(Some(&mut Some(0))) {
54+ | ~
5555
56- error[E0308]: mismatched types
56+ error: cannot match inherited `&` with `&mut` pattern
5757 --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:23:17
5858 |
5959LL | if let Some(&mut Some(x)) = &Some(Some(0)) {
60- | ^^^^^^^^^^^^ -------------- this expression has type `&Option<Option<{integer}>>`
61- | |
62- | expected `Option<{integer}>`, found `&mut _`
60+ | ^^^^^
6361 |
64- = note: expected enum `Option<{integer}>`
65- found mutable reference `&mut _`
62+ help: replace this `&mut` pattern with `&`
63+ |
64+ LL | if let Some(&Some(x)) = &Some(Some(0)) {
65+ | ~
6666
67- error[E0308]: mismatched types
67+ error: cannot match inherited `&` with `&mut` pattern
6868 --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:26:17
6969 |
7070LL | if let Some(&mut Some(x)) = &Some(Some(0)) {
71- | ^^^^^^^^^^^^ -------------- this expression has type `&Option<Option<{integer}>>`
72- | |
73- | expected `Option<{integer}>`, found `&mut _`
71+ | ^^^^^
7472 |
75- = note: expected enum `Option<{integer}>`
76- found mutable reference `&mut _`
73+ help: replace this `&mut` pattern with `&`
74+ |
75+ LL | if let Some(&Some(x)) = &Some(Some(0)) {
76+ | ~
7777
7878error[E0308]: mismatched types
7979 --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:30:9
8080 |
8181LL | let &mut _ = &&0;
8282 | ^^^^^^ --- this expression has type `&&{integer}`
8383 | |
84- | expected integer, found `&mut _`
84+ | types differ in mutability
8585 |
86- = note: expected type ` {integer}`
86+ = note: expected reference `&& {integer}`
8787 found mutable reference `&mut _`
8888
8989error[E0308]: mismatched types
@@ -92,11 +92,66 @@ error[E0308]: mismatched types
9292LL | let &mut _ = &&&&&&&&&&&&&&&&&&&&&&&&&&&&0;
9393 | ^^^^^^ ----------------------------- this expression has type `&&&&&&&&&&&&&&&&&&&&&&&&&&&&{integer}`
9494 | |
95- | expected integer, found `&mut _`
95+ | types differ in mutability
96+ |
97+ = note: expected reference `&&&&&&&&&&&&&&&&&&&&&&&&&&&&{integer}`
98+ found mutable reference `&mut _`
99+
100+ error: cannot match inherited `&` with `&mut` pattern
101+ --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:36:17
102+ |
103+ LL | if let Some(&mut Some(&_)) = &Some(&mut Some(0)) {
104+ | ^^^^^
105+ |
106+ help: replace this `&mut` pattern with `&`
107+ |
108+ LL | if let Some(&Some(&_)) = &Some(&mut Some(0)) {
109+ | ~
110+
111+ error: cannot match inherited `&` with `&mut` pattern
112+ --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:40:22
113+ |
114+ LL | if let Some(Some(&mut x)) = &Some(Some(&mut 0)) {
115+ | ^^^^^
116+ |
117+ help: replace this `&mut` pattern with `&`
118+ |
119+ LL | if let Some(Some(&x)) = &Some(Some(&mut 0)) {
120+ | ~
121+
122+ error[E0308]: mismatched types
123+ --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:44:9
124+ |
125+ LL | let &mut _ = &&mut 0;
126+ | ^^^^^^ ------- this expression has type `&&mut {integer}`
127+ | |
128+ | types differ in mutability
129+ |
130+ = note: expected reference `&&mut {integer}`
131+ found mutable reference `&mut _`
132+
133+ error[E0308]: mismatched types
134+ --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:47:9
135+ |
136+ LL | let &mut _ = &&&&&&&&&&&&&&&&&&&&&&&&&&&&mut 0;
137+ | ^^^^^^ --------------------------------- this expression has type `&&&&&&&&&&&&&&&&&&&&&&&&&&&&mut {integer}`
138+ | |
139+ | types differ in mutability
140+ |
141+ = note: expected reference `&&&&&&&&&&&&&&&&&&&&&&&&&&&&mut {integer}`
142+ found mutable reference `&mut _`
143+
144+ error[E0308]: mismatched types
145+ --> $DIR/ref_pat_eat_one_layer_2024_fail.rs:50:14
146+ |
147+ LL | let &mut &mut &mut &mut _ = &mut &&&&mut &&&mut &mut 0;
148+ | ^^^^^^^^^^^^^^^^ -------------------------- this expression has type `&mut &&&&mut &&&mut &mut {integer}`
149+ | |
150+ | types differ in mutability
96151 |
97- = note: expected type ` {integer}`
152+ = note: expected reference `&&&&mut &&&mut &mut {integer}`
98153 found mutable reference `&mut _`
99154
100- error: aborting due to 9 previous errors
155+ error: aborting due to 14 previous errors
101156
102157For more information about this error, try `rustc --explain E0308`.
0 commit comments