Skip to content

rustdoc regression: intra-doc-links not working in proc-macro crate since nightly-2023-02-12 #107950

Closed
paritytech/jsonrpsee
#1022
@taiki-e

Description

@taiki-e

Code

I ran cargo doc with this code:

# Cargo.toml
[package]
name = "repro"
version = "0.1.0"
edition = "2021"

[lib]
proc-macro = true
/// [`Unpin`]
#[proc_macro_derive(F)]
pub fn derive_(t: proc_macro::TokenStream) -> proc_macro::TokenStream {
    t
}

/// [`Unpin`]
#[proc_macro_attribute]
pub fn attr(t: proc_macro::TokenStream, _: proc_macro::TokenStream) -> proc_macro::TokenStream {
    t
}

/// [`Unpin`]
#[proc_macro]
pub fn func(t: proc_macro::TokenStream) -> proc_macro::TokenStream {
    t
}

I expected to see this happen: intra-doc-links work and no warning

Instead, this happened:

intra-doc-links is not working in the generated docs.

doc

And I got broken_intra_doc_links warnings:

warning: unresolved link to `Unpin`
 --> src/lib.rs:1:7
  |
1 | /// [`Unpin`]
  |       ^^^^^ no item named `Unpin` in scope
  |
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
  = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

warning: unresolved link to `Unpin`
 --> src/lib.rs:7:7
  |
7 | /// [`Unpin`]
  |       ^^^^^ no item named `Unpin` in scope
  |
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `Unpin`
  --> src/lib.rs:13:7
   |
13 | /// [`Unpin`]
   |       ^^^^^ no item named `Unpin` in scope
   |
   = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

Version it worked on

It most recently worked on: nightly-2023-02-11

doc-old

Version with regression

rustc --version --verbose:

rustc 1.69.0-nightly (585f3eef2 2023-02-11)
binary: rustc
commit-hash: 585f3eef26f04440bca726c29193af7b4fa90e54
commit-date: 2023-02-11
host: aarch64-apple-darwin
release: 1.69.0-nightly
LLVM version: 15.0.7

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

Metadata

Metadata

Assignees

Labels

A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions