mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Add new LintBuffer::dyn_buffer_lint method
This commit is contained in:
@@ -81,4 +81,21 @@ pub fn buffer_lint(
|
||||
diagnostic: decorate.into(),
|
||||
});
|
||||
}
|
||||
|
||||
pub fn dyn_buffer_lint<
|
||||
F: for<'a> FnOnce(DiagCtxtHandle<'a>, Level) -> Diag<'a, ()> + DynSend + 'static,
|
||||
>(
|
||||
&mut self,
|
||||
lint: &'static Lint,
|
||||
node_id: NodeId,
|
||||
span: impl Into<MultiSpan>,
|
||||
callback: F,
|
||||
) {
|
||||
self.add_early_lint(BufferedEarlyLint {
|
||||
lint_id: LintId::of(lint),
|
||||
node_id,
|
||||
span: Some(span.into()),
|
||||
diagnostic: DecorateDiagCompat::Dynamic(Box::new(callback)),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user