Skip to content

rustdoc: broken_intra_doc_links is incorrectly reported when linking to a proc macro #91274

Open
@camelid

Description

@camelid

Rustdoc only emits a documentation page for my_macro as a macro; there's no function page for it.

Note that the link indeed fails to resolve.

Code

//! Link to [`my_macro`].

#![crate_type = "proc-macro"]

extern crate proc_macro;

#[proc_macro]
pub fn my_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    input
}

Output

warning: `my_macro` is both a function and a macro
 --> foo.rs:1:15
  |
1 | //! Link to [`my_macro`].
  |               ^^^^^^^^ ambiguous link
  |
  = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
help: to link to the function, add parentheses
  |
1 | //! Link to [`my_macro()`].
  |                       ++
help: to link to the macro, add an exclamation mark
  |
1 | //! Link to [`my_macro!`].
  |                       +

warning: 1 warning emitted

Metadata

Metadata

Assignees

Labels

A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-proc-macrosArea: Procedural macrosC-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions