diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-06 16:35:19 +1100 | 
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-08 13:02:44 +1100 | 
| commit | 6b175a848d72f0ea60d80de3bd74d0806a64c40f (patch) | |
| tree | 453f31160bb5cdf9ad56d2c825c0070640f6c03e /compiler/rustc_errors/src/diagnostic.rs | |
| parent | 0d531351e848ad69a03c704d40985c9003847427 (diff) | |
| download | rust-6b175a848d72f0ea60d80de3bd74d0806a64c40f.tar.gz rust-6b175a848d72f0ea60d80de3bd74d0806a64c40f.zip | |
Add `SubdiagnosticMessageOp` as a trait alias.
It avoids a lot of repetition.
Diffstat (limited to 'compiler/rustc_errors/src/diagnostic.rs')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 7 | 
1 files changed, 4 insertions, 3 deletions
| diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 1763c355069..03717a4d654 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -77,11 +77,12 @@ where /// Add a subdiagnostic to an existing diagnostic where `f` is invoked on every message used /// (to optionally perform eager translation). - fn add_to_diagnostic_with<F>(self, diag: &mut Diagnostic, f: F) - where - F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage; + fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, f: F); } +pub trait SubdiagnosticMessageOp = + Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage; + /// Trait implemented by lint types. This should not be implemented manually. Instead, use /// `#[derive(LintDiagnostic)]` -- see [rustc_macros::LintDiagnostic]. #[rustc_diagnostic_item = "DecorateLint"] | 
