Skip to content

Commit 7852986

Browse files
committed
Fix &mut removal suggestion
1 parent 99c946c commit 7852986

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
450450
{
451451
err.span_label(span, format!("cannot {act}"));
452452
err.span_suggestion(
453-
span,
453+
span.with_hi(span.lo() + BytePos(5)),
454454
"try removing `&mut` here",
455455
"",
456456
Applicability::MaybeIncorrect,

tests/ui/borrowck/issue-33819.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | Some(ref v) => { let a = &mut v; },
77
help: try removing `&mut` here
88
|
99
LL - Some(ref v) => { let a = &mut v; },
10-
LL + Some(ref v) => { let a = ; },
10+
LL + Some(ref v) => { let a = v; },
1111
|
1212

1313
error: aborting due to 1 previous error

tests/ui/did_you_mean/issue-34337.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | get(&mut key);
77
help: try removing `&mut` here
88
|
99
LL - get(&mut key);
10-
LL + get();
10+
LL + get(key);
1111
|
1212

1313
error: aborting due to 1 previous error

tests/ui/did_you_mean/issue-37139.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | test(&mut x);
77
help: try removing `&mut` here
88
|
99
LL - test(&mut x);
10-
LL + test();
10+
LL + test(x);
1111
|
1212

1313
error: aborting due to 1 previous error

0 commit comments

Comments
 (0)