about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/diagnostics.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-07-05 19:32:17 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-07-11 20:39:24 +0000
commitb56dc8ee90582d9c1322632d570b996bcb73ecda (patch)
treef2a96576ecac22e22d7dcbf70f1c61b5129804be /compiler/rustc_resolve/src/diagnostics.rs
parentbcf1f6db4594ae6132378b179a30cdb3599a863d (diff)
downloadrust-b56dc8ee90582d9c1322632d570b996bcb73ecda.tar.gz
rust-b56dc8ee90582d9c1322632d570b996bcb73ecda.zip
Use verbose style when suggesting changing `const` with `let`
Diffstat (limited to 'compiler/rustc_resolve/src/diagnostics.rs')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index ffd495aa985..f879e548f27 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -836,11 +836,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
 
                 let ((with, with_label), without) = match sp {
                     Some(sp) if !self.tcx.sess.source_map().is_multiline(sp) => {
-                        let sp = sp.with_lo(BytePos(sp.lo().0 - (current.len() as u32)));
+                        let sp = sp
+                            .with_lo(BytePos(sp.lo().0 - (current.len() as u32)))
+                            .until(ident.span);
                         (
                         (Some(errs::AttemptToUseNonConstantValueInConstantWithSuggestion {
                                 span: sp,
-                                ident,
                                 suggestion,
                                 current,
                             }), Some(errs::AttemptToUseNonConstantValueInConstantLabelWithSuggestion {span})),