about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/errors.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/errors.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/errors.rs')
-rw-r--r--compiler/rustc_resolve/src/errors.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs
index a4bdd62acbb..79c76e7a976 100644
--- a/compiler/rustc_resolve/src/errors.rs
+++ b/compiler/rustc_resolve/src/errors.rs
@@ -240,16 +240,18 @@ pub(crate) struct AttemptToUseNonConstantValueInConstant<'a> {
 }
 
 #[derive(Subdiagnostic)]
-#[suggestion(
+#[multipart_suggestion(
     resolve_attempt_to_use_non_constant_value_in_constant_with_suggestion,
-    code = "{suggestion} ",
     style = "verbose",
-    applicability = "maybe-incorrect"
+    applicability = "has-placeholders"
 )]
 pub(crate) struct AttemptToUseNonConstantValueInConstantWithSuggestion<'a> {
-    #[primary_span]
+    // #[primary_span]
+    #[suggestion_part(code = "{suggestion} ")]
     pub(crate) span: Span,
     pub(crate) suggestion: &'a str,
+    #[suggestion_part(code = ": /* Type */")]
+    pub(crate) type_span: Option<Span>,
     pub(crate) current: &'a str,
 }