Skip to content

Commit

Permalink
improve wording of a suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Jun 24, 2022
1 parent e25129b commit 1dfb53b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

Some((
pat.span,
format!("to declare a mutable {ident_kind} use `mut variable_name`"),
format!("to declare a mutable {ident_kind} use"),
format!("mut {binding}"),
))

Expand Down
14 changes: 7 additions & 7 deletions src/test/ui/mismatched_types/ref-pat-suggestions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ LL | fn _f1(&mut _a: u32) {}
|
= note: expected type `u32`
found mutable reference `&mut _`
note: to declare a mutable parameter use `mut variable_name`: `mut _a`
note: to declare a mutable parameter use: `mut _a`
--> $DIR/ref-pat-suggestions.rs:4:8
|
LL | fn _f1(&mut _a: u32) {}
Expand Down Expand Up @@ -127,7 +127,7 @@ LL | let _: fn(u32) = |&mut _a| ();
|
= note: expected type `u32`
found mutable reference `&mut _`
note: to declare a mutable parameter use `mut variable_name`: `mut _a`
note: to declare a mutable parameter use: `mut _a`
--> $DIR/ref-pat-suggestions.rs:12:23
|
LL | let _: fn(u32) = |&mut _a| ();
Expand Down Expand Up @@ -232,7 +232,7 @@ LL | let _ = |&mut _a: u32| ();
|
= note: expected type `u32`
found mutable reference `&mut _`
note: to declare a mutable parameter use `mut variable_name`: `mut _a`
note: to declare a mutable parameter use: `mut _a`
--> $DIR/ref-pat-suggestions.rs:19:14
|
LL | let _ = |&mut _a: u32| ();
Expand Down Expand Up @@ -314,7 +314,7 @@ LL | let &mut _a = 0;
| ^^^^^^^ - this expression has type `{integer}`
| |
| expected integer, found `&mut _`
| help: to declare a mutable variable use `mut variable_name`: `mut _a`
| help: to declare a mutable variable use: `mut _a`
|
= note: expected type `{integer}`
found mutable reference `&mut _`
Expand All @@ -329,7 +329,7 @@ LL | let S(&mut _b) = S(0);
|
= note: expected type `u8`
found mutable reference `&mut _`
note: to declare a mutable binding use `mut variable_name`: `mut _b`
note: to declare a mutable binding use: `mut _b`
--> $DIR/ref-pat-suggestions.rs:30:15
|
LL | let S(&mut _b) = S(0);
Expand All @@ -350,7 +350,7 @@ LL | let (&mut _c,) = (0,);
|
= note: expected type `{integer}`
found mutable reference `&mut _`
note: to declare a mutable binding use `mut variable_name`: `mut _c`
note: to declare a mutable binding use: `mut _c`
--> $DIR/ref-pat-suggestions.rs:31:14
|
LL | let (&mut _c,) = (0,);
Expand All @@ -371,7 +371,7 @@ LL | &mut _d => {}
|
= note: expected type `{integer}`
found mutable reference `&mut _`
note: to declare a mutable binding use `mut variable_name`: `mut _d`
note: to declare a mutable binding use: `mut _d`
--> $DIR/ref-pat-suggestions.rs:34:13
|
LL | &mut _d => {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/pattern/for-loop-bad-item.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | for ((_, _), (&mut c, _)) in &mut map {
|
= note: expected type `char`
found mutable reference `&mut _`
note: to declare a mutable binding use `mut variable_name`: `mut c`
note: to declare a mutable binding use: `mut c`
--> $DIR/for-loop-bad-item.rs:7:19
|
LL | for ((_, _), (&mut c, _)) in &mut map {
Expand Down

0 comments on commit 1dfb53b

Please sign in to comment.