From 6c19c08140b7c0c5a9f9f9a434036b460167c87d Mon Sep 17 00:00:00 2001 From: Nikita Tomashevich Date: Sun, 25 Sep 2022 10:55:42 +0300 Subject: [PATCH] More descriptive names for ActualImplExplNotes variants --- compiler/rustc_error_messages/locales/en-US/infer.ftl | 4 ++-- compiler/rustc_infer/src/errors/mod.rs | 8 ++++---- .../nice_region_error/placeholder_error.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_error_messages/locales/en-US/infer.ftl b/compiler/rustc_error_messages/locales/en-US/infer.ftl index 7a10f4b7bc5..8cfd20c6eda 100644 --- a/compiler/rustc_error_messages/locales/en-US/infer.ftl +++ b/compiler/rustc_error_messages/locales/en-US/infer.ftl @@ -184,7 +184,7 @@ infer_explicit_lifetime_required_sugg = add explicit lifetime `{$named}` to {$id *[param_type] type } -infer_actual_impl_expl_1 = {$leading_ellipsis -> +infer_actual_impl_expl_expected = {$leading_ellipsis -> [true] ... *[false] {""} }{$kind -> @@ -198,7 +198,7 @@ infer_actual_impl_expl_1 = {$leading_ellipsis -> *[nothing] {""} } -infer_actual_impl_expl_2 = {$kind_2 -> +infer_actual_impl_expl_but_actually = {$kind_2 -> [implements_trait] ...but it actually implements `{$trait_path_2}` [implemented_for_ty] ...but `{$trait_path_2}` is actually implemented for the type `{$ty}` *[ty_implements] ...but `{$ty}` actually implements `{$trait_path_2}` diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs index 55df63075d2..edd9eca24cb 100644 --- a/compiler/rustc_infer/src/errors/mod.rs +++ b/compiler/rustc_infer/src/errors/mod.rs @@ -545,8 +545,8 @@ pub struct ExplicitLifetimeRequired<'a> { #[derive(Subdiagnostic)] pub enum ActualImplExplNotes { // Field names have to be different across all variants - #[note(infer::actual_impl_expl_1)] - NoteOne { + #[note(infer::actual_impl_expl_expected)] + Expected { leading_ellipsis: bool, kind: &'static str, ty_or_sig: String, @@ -555,8 +555,8 @@ pub enum ActualImplExplNotes { lifetime_1: usize, lifetime_2: usize, }, - #[note(infer::actual_impl_expl_2)] - NoteTwo { + #[note(infer::actual_impl_expl_but_actually)] + ButActually { kind_2: &'static str, trait_path_2: String, has_lifetime: bool, diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs index d9fc2ec243f..cf1032f7006 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -451,7 +451,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { } }; - let note_1 = ActualImplExplNotes::NoteOne { + let note_1 = ActualImplExplNotes::Expected { leading_ellipsis, kind, ty_or_sig, @@ -483,7 +483,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let lifetime = actual_has_vid.unwrap_or_default(); let note_2 = - ActualImplExplNotes::NoteTwo { kind_2, trait_path_2, ty, has_lifetime, lifetime }; + ActualImplExplNotes::ButActually { kind_2, trait_path_2, ty, has_lifetime, lifetime }; vec![note_1, note_2] }