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-08 19:43:20 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-07-11 20:39:24 +0000
commitcbe75486f7eb6ae9fb00602f5347a09a62a7a9de (patch)
tree98bbb9812a87a5bdb586f7287fb491570de207ac /compiler/rustc_resolve/src/diagnostics.rs
parentb56dc8ee90582d9c1322632d570b996bcb73ecda (diff)
downloadrust-cbe75486f7eb6ae9fb00602f5347a09a62a7a9de.tar.gz
rust-cbe75486f7eb6ae9fb00602f5347a09a62a7a9de.zip
Account for `let foo = expr`; to suggest `const foo: Ty = expr;`
Diffstat (limited to 'compiler/rustc_resolve/src/diagnostics.rs')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index f879e548f27..09221041031 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -819,7 +819,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
             ResolutionError::CannotCaptureDynamicEnvironmentInFnItem => {
                 self.dcx().create_err(errs::CannotCaptureDynamicEnvironmentInFnItem { span })
             }
-            ResolutionError::AttemptToUseNonConstantValueInConstant(ident, suggestion, current) => {
+            ResolutionError::AttemptToUseNonConstantValueInConstant {
+                ident,
+                suggestion,
+                current,
+                type_span,
+            } => {
                 // let foo =...
                 //     ^^^ given this Span
                 // ------- get this Span to have an applicable suggestion
@@ -844,6 +849,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                                 span: sp,
                                 suggestion,
                                 current,
+                                type_span,
                             }), Some(errs::AttemptToUseNonConstantValueInConstantLabelWithSuggestion {span})),
                             None,
                         )