Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

proc macro (derive) does not recognized as ambiguous intra doc link #82478

Closed
pickfire opened this issue Feb 24, 2021 · 3 comments
Closed

proc macro (derive) does not recognized as ambiguous intra doc link #82478

pickfire opened this issue Feb 24, 2021 · 3 comments
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-discussion Category: Discussion or questions that doesn't represent real issues. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@pickfire
Copy link
Contributor

I tried this code:

/// [`Dummy`] should be ambiguous. But it works.
pub trait Dummy<T>: Sized {
}

#[cfg(feature = "derive")]
pub use dummy::Dummy; // this is a derive macro

Try doing that on https://github.com/cksac/fake-rs crate or serde

I expected to see this happen: ambiguous Dummy link found, use explicit macro@Dummy.

Instead, this happened: It compiles

@pickfire pickfire added the C-bug Category: This is a bug. label Feb 24, 2021
@jonas-schievink jonas-schievink 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 Feb 24, 2021
@jyn514
Copy link
Member

jyn514 commented Feb 24, 2021

This is intentional:

fn is_derive_trait_collision<T>(ns: &PerNS<Result<(Res, T), ResolutionFailure<'_>>>) -> bool {
. Otherwise every time you link to Copy or Debug you'd get an ambiguity error.

@pickfire
Copy link
Contributor Author

pickfire commented Feb 24, 2021

Otherwise every time you link to Copy or Debug you'd get an ambiguity error.

But what about other crates? It would be weird that users does not know about that? Should we make Copy and Debug special case that we can ignore for warning? Otherwise users can easily link to the wrong link if they didn't check the generated doc. Or maybe we should just warn after all.

@jyn514 jyn514 added C-discussion Category: Discussion or questions that doesn't represent real issues. and removed C-bug Category: This is a bug. labels Feb 24, 2021
@jyn514
Copy link
Member

jyn514 commented Apr 26, 2023

This was documented in #110328. I'm going to close this since we're not planning to change the behavior.

@jyn514 jyn514 closed this as completed Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-discussion Category: Discussion or questions that doesn't represent real issues. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants