clippy_utils::diagnostics

Function validate_diag

Source
fn validate_diag(diag: &Diag<'_, impl EmissionGuarantee>)
Expand description

Makes sure that a diagnostic is well formed.

rustc debug asserts a few properties about spans, but the clippy repo uses a distributed rustc build with debug assertions disabled, so this has historically led to problems during subtree syncs where those debug assertions only started triggered there.

This function makes sure we also validate them in debug clippy builds.