Change label to "consider changing this to mut f
"
Change the wording of mutable borrow on immutable binding from "this should be `mut`" to "consider changing this to `mut f`".
This commit is contained in:
parent
6ba494b68b
commit
38b5b29c57
@ -748,7 +748,9 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
|
||||
db.span_label(span, &msg);
|
||||
}
|
||||
if let Some(span) = local_def {
|
||||
db.span_label(span, &"this should be `mut`");
|
||||
if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) {
|
||||
db.span_label(span, &format!("consider changing this to `mut {}`", snippet));
|
||||
}
|
||||
}
|
||||
db
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ error: cannot borrow immutable field `z.x` as mutable
|
||||
--> $DIR/issue-39544.rs:21:18
|
||||
|
|
||||
20 | let z = Z { x: X::Y };
|
||||
| - this should be `mut`
|
||||
| - consider changing this to `mut z`
|
||||
21 | let _ = &mut z.x;
|
||||
| ^^^
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user