Remove unnecessary dyn Display in favor of str
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 794502d..bd13c41 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -647,9 +647,9 @@ pub fn replace_span_with(&mut self, after: Span, keep_label: bool) -> &mut Self
#[rustc_lint_diagnostics]
pub fn note_expected_found(
&mut self,
- expected_label: &dyn fmt::Display,
+ expected_label: &str,
expected: DiagStyledString,
- found_label: &dyn fmt::Display,
+ found_label: &str,
found: DiagStyledString,
) -> &mut Self {
self.note_expected_found_extra(
@@ -665,9 +665,9 @@ pub fn note_expected_found(
#[rustc_lint_diagnostics]
pub fn note_expected_found_extra(
&mut self,
- expected_label: &dyn fmt::Display,
+ expected_label: &str,
expected: DiagStyledString,
- found_label: &dyn fmt::Display,
+ found_label: &str,
found: DiagStyledString,
expected_extra: DiagStyledString,
found_extra: DiagStyledString,
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs
index 55d010e..51214c8 100644
--- a/compiler/rustc_lint/src/lints.rs
+++ b/compiler/rustc_lint/src/lints.rs
@@ -513,7 +513,7 @@ fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false);
let mut found_str = DiagStyledString::new();
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);
}
}
diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs
index c7f0a88..fcb98f7 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs
@@ -967,7 +967,7 @@ fn report_sub_sup_conflict(
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() {
err.delay_as_bug()
} else {
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
index a01574f..5648021 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
@@ -2846,9 +2846,9 @@ fn add_help_message_for_fn_trait(
// Print type mismatch
let (expected_args, given_args) = self.cmp(expected_ty, given_ty);
err.note_expected_found(
- &"a closure with signature",
+ "a closure with signature",
expected_args,
- &"a closure with signature",
+ "a closure with signature",
given_args,
);
}
diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs
index 9f7bfe5..bb4aba9 100644
--- a/compiler/rustc_trait_selection/src/errors.rs
+++ b/compiler/rustc_trait_selection/src/errors.rs
@@ -415,7 +415,7 @@ fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
label_or_note(span, fluent::trait_selection_subtype);
diag.arg("requirement", requirement);
- diag.note_expected_found(&"", expected, &"", found);
+ diag.note_expected_found("", expected, "", found);
}
RegionOriginNote::WithRequirement { span, requirement, expected_found: None } => {
// FIXME: this really should be handled at some earlier stage. Our