rustdoc::broken_intra_doc_links behavior change with macro_rules not in scope since 1.63 · Issue #106142 · rust-lang/rust (original) (raw)

rustdoc >= 1.63 complains about this intra-doc link:

pub mod a { /// [m] pub fn f() {}

#[macro_export]
macro_rules! m {
    () => {};
}

}

with:

warning: unresolved link to m --> c.rs:2:11 | 2 | /// [m] | ^ no item named m in scope | = note: macro_rules named m exists in this crate, but it is not in scope at this link's location = note: #[warn(rustdoc::broken_intra_doc_links)] on by default

warning: 1 warning emitted

However, the link is still generated in the rendered output, and points to the right place. Thus the text "unresolved link" is a bit confusing, especially since in earlier versions (<= 1.62), there was no warning for this case (and the link still got generated too).

With e.g. crate::m, the warning goes away.

Therefore, if the intended behavior is that the user writes something like crate::m, then when the user just wrote m the link should not be generated (which would make the text of the lint consistent) or the link could be generated but then the warning should say the link may still be generated.

On the other hand, if the intended behavior is that m still works as-is like in previous versions, then it is a false positive and a regression on the lint.