diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-07-05 19:32:17 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-07-11 20:39:24 +0000 |
| commit | b56dc8ee90582d9c1322632d570b996bcb73ecda (patch) | |
| tree | f2a96576ecac22e22d7dcbf70f1c61b5129804be /compiler/rustc_resolve/src | |
| parent | bcf1f6db4594ae6132378b179a30cdb3599a863d (diff) | |
| download | rust-b56dc8ee90582d9c1322632d570b996bcb73ecda.tar.gz rust-b56dc8ee90582d9c1322632d570b996bcb73ecda.zip | |
Use verbose style when suggesting changing `const` with `let`
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/errors.rs | 4 |
2 files changed, 5 insertions, 4 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})), diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 0620f3d709e..a4bdd62acbb 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -242,13 +242,13 @@ pub(crate) struct AttemptToUseNonConstantValueInConstant<'a> { #[derive(Subdiagnostic)] #[suggestion( resolve_attempt_to_use_non_constant_value_in_constant_with_suggestion, - code = "{suggestion} {ident}", + code = "{suggestion} ", + style = "verbose", applicability = "maybe-incorrect" )] pub(crate) struct AttemptToUseNonConstantValueInConstantWithSuggestion<'a> { #[primary_span] pub(crate) span: Span, - pub(crate) ident: Ident, pub(crate) suggestion: &'a str, pub(crate) current: &'a str, } |
