about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/errors
diff options
context:
space:
mode:
authorNikita Tomashevich <quant3234@gmail.com>2022-11-03 20:45:14 +0300
committerNikita Tomashevich <quant3234@gmail.com>2022-12-28 14:53:48 +0300
commit7ecd064bbe32419eb473b28cdc8e41dd34f20aa9 (patch)
tree17a935d316a9b032737a564c59537cb8f900b7e0 /compiler/rustc_infer/src/errors
parent19b8579803979dd3b1e83f7aa9655920eef14b98 (diff)
Split infer_explicit_lifetime_required into several diags
Diffstat (limited to 'compiler/rustc_infer/src/errors')
-rw-r--r--compiler/rustc_infer/src/errors/mod.rs49
1 files changed, 32 insertions, 17 deletions
diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs
index 51b04eb0df0..9e3def93a6d 100644
--- a/compiler/rustc_infer/src/errors/mod.rs
+++ b/compiler/rustc_infer/src/errors/mod.rs
@@ -523,23 +523,38 @@ pub struct MismatchedStaticLifetime<'a> {
 }
 
 #[derive(Diagnostic)]
-#[diag(infer_explicit_lifetime_required, code = "E0621")]
-pub struct ExplicitLifetimeRequired<'a> {
-    #[primary_span]
-    #[label]
-    pub span: Span,
-    pub ident_kind: &'static str,
-    pub simple_ident: String,
-    pub named: String,
-
-    #[suggestion(
-        infer_explicit_lifetime_required_sugg,
-        code = "{new_ty}",
-        applicability = "unspecified"
-    )]
-    pub new_ty_span: Span,
-    #[skip_arg]
-    pub new_ty: Ty<'a>,
+pub enum ExplicitLifetimeRequired<'a> {
+    #[diag(infer_explicit_lifetime_required_with_ident, code = "E0621")]
+    WithIdent {
+        #[primary_span]
+        #[label]
+        span: Span,
+        simple_ident: Ident,
+        named: String,
+        #[suggestion(
+            infer_explicit_lifetime_required_sugg_with_ident,
+            code = "{new_ty}",
+            applicability = "unspecified"
+        )]
+        new_ty_span: Span,
+        #[skip_arg]
+        new_ty: Ty<'a>,
+    },
+    #[diag(infer_explicit_lifetime_required_with_param_type, code = "E0621")]
+    WithParamType {
+        #[primary_span]
+        #[label]
+        span: Span,
+        named: String,
+        #[suggestion(
+            infer_explicit_lifetime_required_sugg_with_param_type,
+            code = "{new_ty}",
+            applicability = "unspecified"
+        )]
+        new_ty_span: Span,
+        #[skip_arg]
+        new_ty: Ty<'a>,
+    },
 }
 
 #[derive(Subdiagnostic)]