@@ -24,6 +24,11 @@ LL | fn _f1(&mut _a: u32) {}
2424   |
2525   = note:           expected type `u32`
2626           found mutable reference `&mut _`
27+ note: to declare a mutable parameter use: `mut _a`
28+   --> $DIR/ref-pat-suggestions.rs:4:8
29+    |
30+ LL | fn _f1(&mut _a: u32) {}
31+    |        ^^^^^^^
2732help: to take parameter `_a` by reference, move `&mut` to the type
2833   |
2934LL - fn _f1(&mut _a: u32) {}
@@ -122,6 +127,11 @@ LL |     let _: fn(u32) = |&mut _a| ();
122127   |
123128   = note:           expected type `u32`
124129           found mutable reference `&mut _`
130+ note: to declare a mutable parameter use: `mut _a`
131+   --> $DIR/ref-pat-suggestions.rs:12:23
132+    |
133+ LL |     let _: fn(u32) = |&mut _a| ();
134+    |                       ^^^^^^^
125135help: consider removing `&mut` from the pattern
126136   |
127137LL -     let _: fn(u32) = |&mut _a| ();
@@ -222,6 +232,11 @@ LL |     let _ = |&mut _a: u32| ();
222232   |
223233   = note:           expected type `u32`
224234           found mutable reference `&mut _`
235+ note: to declare a mutable parameter use: `mut _a`
236+   --> $DIR/ref-pat-suggestions.rs:19:14
237+    |
238+ LL |     let _ = |&mut _a: u32| ();
239+    |              ^^^^^^^
225240help: to take parameter `_a` by reference, move `&mut` to the type
226241   |
227242LL -     let _ = |&mut _a: u32| ();
@@ -292,6 +307,81 @@ LL -     let _ = |&mut &mut _a: &mut u32| ();
292307LL +     let _ = |&mut _a: &mut u32| ();
293308   |
294309
295- error: aborting due to 18 previous errors
310+ error[E0308]: mismatched types
311+   --> $DIR/ref-pat-suggestions.rs:29:13
312+    |
313+ LL |         let &mut _a = 0;
314+    |             ^^^^^^^   - this expression has type `{integer}`
315+    |             |
316+    |             expected integer, found `&mut _`
317+    |             help: to declare a mutable variable use: `mut _a`
318+    |
319+    = note:           expected type `{integer}`
320+            found mutable reference `&mut _`
321+ 
322+ error[E0308]: mismatched types
323+   --> $DIR/ref-pat-suggestions.rs:30:15
324+    |
325+ LL |         let S(&mut _b) = S(0);
326+    |               ^^^^^^^    ---- this expression has type `S`
327+    |               |
328+    |               expected `u8`, found `&mut _`
329+    |
330+    = note:           expected type `u8`
331+            found mutable reference `&mut _`
332+ note: to declare a mutable binding use: `mut _b`
333+   --> $DIR/ref-pat-suggestions.rs:30:15
334+    |
335+ LL |         let S(&mut _b) = S(0);
336+    |               ^^^^^^^
337+ help: consider removing `&mut` from the pattern
338+    |
339+ LL -         let S(&mut _b) = S(0);
340+ LL +         let S(_b) = S(0);
341+    |
342+ 
343+ error[E0308]: mismatched types
344+   --> $DIR/ref-pat-suggestions.rs:31:14
345+    |
346+ LL |         let (&mut _c,) = (0,);
347+    |              ^^^^^^^     ---- this expression has type `({integer},)`
348+    |              |
349+    |              expected integer, found `&mut _`
350+    |
351+    = note:           expected type `{integer}`
352+            found mutable reference `&mut _`
353+ note: to declare a mutable binding use: `mut _c`
354+   --> $DIR/ref-pat-suggestions.rs:31:14
355+    |
356+ LL |         let (&mut _c,) = (0,);
357+    |              ^^^^^^^
358+ help: consider removing `&mut` from the pattern
359+    |
360+ LL -         let (&mut _c,) = (0,);
361+ LL +         let (_c,) = (0,);
362+    |
363+ 
364+ error[E0308]: mismatched types
365+   --> $DIR/ref-pat-suggestions.rs:34:13
366+    |
367+ LL |         match 0 {
368+    |               - this expression has type `{integer}`
369+ LL |             &mut _d => {}
370+    |             ^^^^^^^ expected integer, found `&mut _`
371+    |
372+    = note:           expected type `{integer}`
373+            found mutable reference `&mut _`
374+ note: to declare a mutable binding use: `mut _d`
375+   --> $DIR/ref-pat-suggestions.rs:34:13
376+    |
377+ LL |             &mut _d => {}
378+    |             ^^^^^^^
379+ help: consider removing `&mut` from the pattern
380+    |
381+ LL -             &mut _d => {}
382+ LL +             _d => {}
383+    |
384+ 
385+ error: aborting due to 22 previous errors
296386
297387For more information about this error, try `rustc --explain E0308`.
0 commit comments