about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/errors.rs
diff options
context:
space:
mode:
authorNikita Tomashevich <quant3234@gmail.com>2022-08-24 15:46:29 +0300
committerNikita Tomashevich <quant3234@gmail.com>2022-08-24 15:46:29 +0300
commit3fae3904b130272c782255066f79a13fa9fcdad6 (patch)
tree950327fad609a1dfa74440532098bf717147dded /compiler/rustc_infer/src/errors.rs
parent74f99738244fc9ba2f6ad93b8c891d44d638b0f8 (diff)
downloadrust-3fae3904b130272c782255066f79a13fa9fcdad6.tar.gz
rust-3fae3904b130272c782255066f79a13fa9fcdad6.zip
Use `IntoDiagnosticArg` where it makes sense
Diffstat (limited to 'compiler/rustc_infer/src/errors.rs')
-rw-r--r--compiler/rustc_infer/src/errors.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler/rustc_infer/src/errors.rs b/compiler/rustc_infer/src/errors.rs
index 1db8763e499..938f8aa77a5 100644
--- a/compiler/rustc_infer/src/errors.rs
+++ b/compiler/rustc_infer/src/errors.rs
@@ -3,6 +3,11 @@ use rustc_hir::FnRetTy;
 use rustc_macros::SessionDiagnostic;
 use rustc_span::{BytePos, Span};
 
+use crate::infer::error_reporting::{
+    need_type_info::{GeneratorKindAsDiagArg, UnderspecifiedArgKind},
+    ObligationCauseAsDiagArg,
+};
+
 #[derive(SessionDiagnostic)]
 #[diag(infer::opaque_hidden_type)]
 pub struct OpaqueHiddenTypeDiag {
@@ -73,7 +78,7 @@ pub struct AmbigousReturn<'a> {
 pub struct NeedTypeInfoInGenerator<'a> {
     #[primary_span]
     pub span: Span,
-    pub generator_kind: &'static str,
+    pub generator_kind: GeneratorKindAsDiagArg,
     #[subdiagnostic]
     pub bad_label: InferenceBadError<'a>,
 }
@@ -85,7 +90,7 @@ pub struct InferenceBadError<'a> {
     #[primary_span]
     pub span: Span,
     pub bad_kind: &'static str,
-    pub prefix_kind: &'static str,
+    pub prefix_kind: UnderspecifiedArgKind,
     pub has_parent: bool,
     pub prefix: &'a str,
     pub parent_prefix: &'a str,
@@ -107,7 +112,7 @@ pub enum SourceKindSubdiag<'a> {
         type_name: String,
         kind: &'static str,
         x_kind: &'static str,
-        prefix_kind: &'static str,
+        prefix_kind: UnderspecifiedArgKind,
         prefix: &'a str,
         arg_name: String,
     },
@@ -199,7 +204,7 @@ pub enum RegionOriginNote<'a> {
     },
     WithRequirement {
         span: Span,
-        requirement: &'static str,
+        requirement: ObligationCauseAsDiagArg<'a>,
         expected_found: Option<(DiagnosticStyledString, DiagnosticStyledString)>,
     },
 }