## report_diagnostic

# Function report_diagnostic

Source

    fn report_diagnostic(
        tcx: TyCtxt<'_>,
        lint: &'static Lint,
        msg: impl Into<DiagMessage> + Display,
        _: &DiagnosticInfo<'_>,
        decorate: impl FnOnce(&mut Diag<'_, ()>, Option<Span>, MarkdownLinkRange),
    )

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.