Function rustdoc::passes::collect_intra_doc_links::report_diagnostic
source · [−]fn report_diagnostic(
tcx: TyCtxt<'_>,
lint: &'static Lint,
msg: &str,
_: &DiagnosticInfo<'_>,
decorate: impl FnOnce(&mut Diagnostic, Option<Span>)
)
Expand description
Reports a diagnostic for an intra-doc link.
If no link range is provided, or the source span of the link cannot be determined, the span of the entire documentation block is used for the lint. If a range is provided but the span calculation fails, a note is added to the diagnostic pointing to the link in the markdown.
The decorate
callback is invoked in all cases to allow further customization of the
diagnostic before emission. If the span of the link was able to be determined, the second
parameter of the callback will contain it, and the primary span of the diagnostic will be set
to it.