diff --git a/compiler/rustc_infer/src/errors.rs b/compiler/rustc_infer/src/errors.rs index 7bd418ddf5f..51993f37bb3 100644 --- a/compiler/rustc_infer/src/errors.rs +++ b/compiler/rustc_infer/src/errors.rs @@ -73,7 +73,7 @@ pub struct AmbigousReturn<'a> { pub struct NeedTypeInfoInGenerator<'a> { #[primary_span] pub span: Span, - pub generator_kind: String, + pub generator_kind: &'static str, #[subdiagnostic] pub bad_label: InferenceBadError<'a>, } diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs index da0035d2519..daf64aeb053 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs @@ -568,7 +568,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { NeedTypeInfoInGenerator { bad_label: data.make_bad_error(span), span, - generator_kind: kind.to_string(), + generator_kind: kind.descr(), } .into_diagnostic(&self.tcx.sess.parse_sess) }