Skip to content

Commit d940038

Browse files
Remove unnecessary dyn Display in favor of str
1 parent c532045 commit d940038

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

compiler/rustc_errors/src/diagnostic.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,9 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
647647
#[rustc_lint_diagnostics]
648648
pub fn note_expected_found(
649649
&mut self,
650-
expected_label: &dyn fmt::Display,
650+
expected_label: &str,
651651
expected: DiagStyledString,
652-
found_label: &dyn fmt::Display,
652+
found_label: &str,
653653
found: DiagStyledString,
654654
) -> &mut Self {
655655
self.note_expected_found_extra(
@@ -665,9 +665,9 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
665665
#[rustc_lint_diagnostics]
666666
pub fn note_expected_found_extra(
667667
&mut self,
668-
expected_label: &dyn fmt::Display,
668+
expected_label: &str,
669669
expected: DiagStyledString,
670-
found_label: &dyn fmt::Display,
670+
found_label: &str,
671671
found: DiagStyledString,
672672
expected_extra: DiagStyledString,
673673
found_extra: DiagStyledString,

compiler/rustc_lint/src/lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ impl Subdiagnostic for BuiltinClashingExternSub<'_> {
513513
expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false);
514514
let mut found_str = DiagStyledString::new();
515515
found_str.push(self.found.fn_sig(self.tcx).to_string(), true);
516-
diag.note_expected_found(&"", expected_str, &"", found_str);
516+
diag.note_expected_found("", expected_str, "", found_str);
517517
}
518518
}
519519

compiler/rustc_trait_selection/src/error_reporting/infer/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
967967
format!("...so that the {}", sup_trace.cause.as_requirement_str()),
968968
);
969969

970-
err.note_expected_found(&"", sup_expected, &"", sup_found);
970+
err.note_expected_found("", sup_expected, "", sup_found);
971971
return if sub_region.is_error() | sup_region.is_error() {
972972
err.delay_as_bug()
973973
} else {

compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2846,9 +2846,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
28462846
// Print type mismatch
28472847
let (expected_args, given_args) = self.cmp(expected_ty, given_ty);
28482848
err.note_expected_found(
2849-
&"a closure with signature",
2849+
"a closure with signature",
28502850
expected_args,
2851-
&"a closure with signature",
2851+
"a closure with signature",
28522852
given_args,
28532853
);
28542854
}

compiler/rustc_trait_selection/src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl Subdiagnostic for RegionOriginNote<'_> {
415415
label_or_note(span, fluent::trait_selection_subtype);
416416
diag.arg("requirement", requirement);
417417

418-
diag.note_expected_found(&"", expected, &"", found);
418+
diag.note_expected_found("", expected, "", found);
419419
}
420420
RegionOriginNote::WithRequirement { span, requirement, expected_found: None } => {
421421
// FIXME: this really should be handled at some earlier stage. Our

0 commit comments

Comments
 (0)