1
Fork 0

Remove unnecessary dyn Display in favor of str

This commit is contained in:
Michael Goulet 2025-04-08 06:09:04 +00:00
parent c5320454ed
commit d940038636
5 changed files with 9 additions and 9 deletions

View file

@ -647,9 +647,9 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
pub fn note_expected_found( pub fn note_expected_found(
&mut self, &mut self,
expected_label: &dyn fmt::Display, expected_label: &str,
expected: DiagStyledString, expected: DiagStyledString,
found_label: &dyn fmt::Display, found_label: &str,
found: DiagStyledString, found: DiagStyledString,
) -> &mut Self { ) -> &mut Self {
self.note_expected_found_extra( self.note_expected_found_extra(
@ -665,9 +665,9 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
pub fn note_expected_found_extra( pub fn note_expected_found_extra(
&mut self, &mut self,
expected_label: &dyn fmt::Display, expected_label: &str,
expected: DiagStyledString, expected: DiagStyledString,
found_label: &dyn fmt::Display, found_label: &str,
found: DiagStyledString, found: DiagStyledString,
expected_extra: DiagStyledString, expected_extra: DiagStyledString,
found_extra: DiagStyledString, found_extra: DiagStyledString,

View file

@ -513,7 +513,7 @@ impl Subdiagnostic for BuiltinClashingExternSub<'_> {
expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false); expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false);
let mut found_str = DiagStyledString::new(); let mut found_str = DiagStyledString::new();
found_str.push(self.found.fn_sig(self.tcx).to_string(), true); found_str.push(self.found.fn_sig(self.tcx).to_string(), true);
diag.note_expected_found(&"", expected_str, &"", found_str); diag.note_expected_found("", expected_str, "", found_str);
} }
} }

View file

@ -967,7 +967,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
format!("...so that the {}", sup_trace.cause.as_requirement_str()), format!("...so that the {}", sup_trace.cause.as_requirement_str()),
); );
err.note_expected_found(&"", sup_expected, &"", sup_found); err.note_expected_found("", sup_expected, "", sup_found);
return if sub_region.is_error() | sup_region.is_error() { return if sub_region.is_error() | sup_region.is_error() {
err.delay_as_bug() err.delay_as_bug()
} else { } else {

View file

@ -2846,9 +2846,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
// Print type mismatch // Print type mismatch
let (expected_args, given_args) = self.cmp(expected_ty, given_ty); let (expected_args, given_args) = self.cmp(expected_ty, given_ty);
err.note_expected_found( err.note_expected_found(
&"a closure with signature", "a closure with signature",
expected_args, expected_args,
&"a closure with signature", "a closure with signature",
given_args, given_args,
); );
} }

View file

@ -415,7 +415,7 @@ impl Subdiagnostic for RegionOriginNote<'_> {
label_or_note(span, fluent::trait_selection_subtype); label_or_note(span, fluent::trait_selection_subtype);
diag.arg("requirement", requirement); diag.arg("requirement", requirement);
diag.note_expected_found(&"", expected, &"", found); diag.note_expected_found("", expected, "", found);
} }
RegionOriginNote::WithRequirement { span, requirement, expected_found: None } => { RegionOriginNote::WithRequirement { span, requirement, expected_found: None } => {
// FIXME: this really should be handled at some earlier stage. Our // FIXME: this really should be handled at some earlier stage. Our