Skip to content

Intra-doc links doesn't work for proc macros #73173

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Manishearth opened this issue Jun 9, 2020 · 4 comments · Fixed by #73183
Closed

Intra-doc links doesn't work for proc macros #73173

Manishearth opened this issue Jun 9, 2020 · 4 comments · Fixed by #73183
Assignees
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Manishearth
Copy link
Member

Manishearth commented Jun 9, 2020

Part of #43466

intra-doc links is incapable of linking to proc macros

You can reproduce this both with and without the pub use

Reproduction

Cargo.toml

[package]
name = "repro"
version = "0.1.0"
edition = "2018"

[dependencies]
the-macro = { path = "the-macro" }

src/lib.rs

//! Please check out the procedural macro:
//!
//! - [Repro]
//! - [Repro][]
//! - [Repro](Repro)
//!
//! - [Repro!]
//! - [Repro!][]
//! - [Repro!](Repro!)
//!
//! - [macro Repro]
//! - [macro Repro][]
//! - [macro Repro](macro@Repro)
//!
//! - [macro Repro!]
//! - [macro Repro!][]
//! - [macro Repro!](macro@Repro!)

pub use the_macro::Repro;

the-macro/Cargo.toml

[package]
name = "the-macro"
version = "0.1.0"
edition = "2018"

[lib]
proc-macro = true

[dependencies]

the-macro/src/lib.rs

use proc_macro::TokenStream;

#[proc_macro_derive(Repro)]
pub fn repro_derive(input: TokenStream) -> TokenStream {
    input
}

Originally posted by @shepmaster in #43466 (comment)

@Manishearth Manishearth added A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 9, 2020
@Manishearth
Copy link
Member Author

This is probably because macro_resolve() doesn't fall back to resolve_str_path for non-bang macros

@Manishearth
Copy link
Member Author

Right, I wrote this code in 2017, pre proc macro resolution, and MBEs resolve differently from proc macros.

@Manishearth
Copy link
Member Author

My guess was right, I have a fix

@Manishearth
Copy link
Member Author

Got a fix at #73183

@crlf0710 crlf0710 added the C-bug Category: This is a bug. label Jun 11, 2020
@bors bors closed this as completed in d9cf7a1 Jun 11, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants