Files
rust/tests/rustdoc-ui/lints/broken-footnote.rs
Guillaume Gomez 116fdd183a Fix tidy error
2026-08-12 14:59:31 +02:00

51 lines
915 B
Rust

#![deny(rustdoc::broken_footnote)]
//! Footnote referenced [^1]. And [^2]. And [^bla].
//!
//! [^1]: footnote defined
//~^^^ ERROR: no footnote definition matching this footnote
//~| ERROR: no footnote definition matching this footnote
// Should not lint.
//! foo[^1]
//!
//! ```
//!
//! [^1]: bar
//!
//! ```
// Edge cases from https://pulldown-cmark.github.io/pulldown-cmark/specs/footnotes.html
/// The following are not footnote references:
///
/// \[^a]
///
/// [\^b]
///
/// [^c\]
///
/// [^d
/// e]
///
/// [^f\
/// g]
pub struct NotReferences;
/// The following are not footnote references:
///
/// [^a b]
//~^ ERROR: no footnote definition matching this footnote
pub struct EdgeCases1;
/// Another:
///
/// [^1\.2]
//~^ ERROR: no footnote definition matching this footnote
pub struct EdgeCases2;
/// Last:
///
/// [^*]
//~^ ERROR: no footnote definition matching this footnote
pub struct EdgeCases3;