1use rustc_data_structures::sync::{DynSend, DynSync};
2use rustc_error_messages::MultiSpan;
3use rustc_errors::{Diag, DiagCtxtHandle, Level};
4use rustc_lint_defs::LintId;
5
6use crate::HirId;
7
8pub type DelayedLints = Box<[DelayedLint]>;
9
10pub struct DelayedLint {
17 pub lint_id: LintId,
18 pub id: HirId,
19 pub span: MultiSpan,
20 pub callback: Box<
21 dyn for<'a> FnOnce(DiagCtxtHandle<'a>, Level, &dyn std::any::Any) -> Diag<'a, ()>
22 + DynSend
23 + DynSync
24 + 'static,
25 >,
26}
27
28impl std::fmt::Debug for DelayedLint {
29 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30 f.debug_struct("DelayedLint")
31 .field("lint_id", &self.lint_id)
32 .field("id", &self.id)
33 .field("span", &self.span)
34 .finish()
35 }
36}