about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-06-22 21:32:39 +0000
committerMichael Goulet <michael@errs.io>2023-07-10 20:09:28 +0000
commita74db1abb3cda6f28088f816b2781a120ddc56be (patch)
tree5c5ca59d40ea6dccd7f9cf06a8ce70fa5094cebe
parent3a3f4a21445d1175294552fa40446a3116103cef (diff)
downloadrust-a74db1abb3cda6f28088f816b2781a120ddc56be.tar.gz
rust-a74db1abb3cda6f28088f816b2781a120ddc56be.zip
Fix another strange suggestion span
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/mod.rs2
-rw-r--r--compiler/rustc_borrowck/src/session_diagnostics.rs2
-rw-r--r--tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr2
-rw-r--r--tests/ui/moves/pin-mut-reborrow.stderr2
4 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs
index f81c71b7394..0e56463e17c 100644
--- a/compiler/rustc_borrowck/src/diagnostics/mod.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs
@@ -1121,7 +1121,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                             err.eager_subdiagnostic(
                                 &self.infcx.tcx.sess.parse_sess.span_diagnostic,
                                 CaptureReasonSuggest::FreshReborrow {
-                                    span: fn_call_span.shrink_to_lo(),
+                                    span: move_span.shrink_to_hi(),
                                 });
                         }
                         if let Some(clone_trait) = tcx.lang_items().clone_trait()
diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs
index fceae5bb3ff..d1d8cfa74aa 100644
--- a/compiler/rustc_borrowck/src/session_diagnostics.rs
+++ b/compiler/rustc_borrowck/src/session_diagnostics.rs
@@ -398,7 +398,7 @@ pub(crate) enum CaptureReasonSuggest<'tcx> {
     #[suggestion(
         borrowck_suggest_create_freash_reborrow,
         applicability = "maybe-incorrect",
-        code = "as_mut().",
+        code = ".as_mut()",
         style = "verbose"
     )]
     FreshReborrow {
diff --git a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr
index 7e513b73c21..a184482a446 100644
--- a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr
+++ b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr
@@ -13,7 +13,7 @@ note: `Pin::<&'a mut T>::get_mut` takes ownership of the receiver `self`, which
 help: consider reborrowing the `Pin` instead of moving it
    |
 LL |     foo(r.as_mut().get_mut());
-   |           +++++++++
+   |          +++++++++
 
 error: aborting due to previous error
 
diff --git a/tests/ui/moves/pin-mut-reborrow.stderr b/tests/ui/moves/pin-mut-reborrow.stderr
index 16fa4bacc2d..4bf207e7e98 100644
--- a/tests/ui/moves/pin-mut-reborrow.stderr
+++ b/tests/ui/moves/pin-mut-reborrow.stderr
@@ -16,7 +16,7 @@ LL |     fn foo(self: Pin<&mut Self>) {}
 help: consider reborrowing the `Pin` instead of moving it
    |
 LL |     foo.as_mut().foo();
-   |         +++++++++
+   |        +++++++++
 
 error: aborting due to previous error