diff options
| author | Xiretza <xiretza@xiretza.xyz> | 2024-04-18 19:18:35 +0000 |
|---|---|---|
| committer | Xiretza <xiretza@xiretza.xyz> | 2024-04-21 07:45:03 +0000 |
| commit | 5646b65cf58123679fdf4ef489f690d1b21e1436 (patch) | |
| tree | e28ccda3f8d6b4c16e17650251afecc98c292d7e /compiler/rustc_errors/src | |
| parent | 13eb8c736ce58a794434ee316cb86f1091f66c7e (diff) | |
| download | rust-5646b65cf58123679fdf4ef489f690d1b21e1436.tar.gz rust-5646b65cf58123679fdf4ef489f690d1b21e1436.zip | |
Pass translation closure to add_to_diag_with() as reference
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_impls.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index a17e0da47a5..6c84eeaf888 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -177,7 +177,7 @@ where { /// Add a subdiagnostic to an existing diagnostic. fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) { - self.add_to_diag_with(diag, |_, m| m); + self.add_to_diag_with(diag, &|_, m| m); } /// Add a subdiagnostic to an existing diagnostic where `f` is invoked on every message used @@ -185,7 +185,7 @@ where fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>( self, diag: &mut Diag<'_, G>, - f: F, + f: &F, ); } @@ -1197,7 +1197,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { dcx: &crate::DiagCtxt, subdiagnostic: impl Subdiagnostic, ) -> &mut Self { - subdiagnostic.add_to_diag_with(self, |diag, msg| { + subdiagnostic.add_to_diag_with(self, &|diag, msg| { let args = diag.args.iter(); let msg = diag.subdiagnostic_message_to_diagnostic_message(msg); dcx.eagerly_translate(msg, args) diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index 6c0551848d6..1ef945985be 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -302,7 +302,7 @@ impl Subdiagnostic for SingleLabelManySpans { fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>( self, diag: &mut Diag<'_, G>, - _: F, + _: &F, ) { diag.span_labels(self.spans, self.label); } |
