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

Consider reporting an ambiguity if both modules and primitives have the same name in an intra-doc link #75381

Closed
jyn514 opened this issue Aug 10, 2020 · 5 comments · Fixed by #75815
Assignees
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Aug 10, 2020

Originally this defaulted to the module. #75318 changed this to default to primitives since seemed to be the less confusing behavior (#58699). However I'm wondering if the real issue is that rustdoc didn't report an ambiguity like it normally would for multiple namespaces. I think it would be better to say 'both module@char and type@char are in scope, pick one.

@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-enhancement Category: An issue proposing an enhancement or a PR with one. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name labels Aug 10, 2020
@petrochenkov petrochenkov changed the title Consider reporting an ambiguity if both modules and primitives have the same name Consider reporting an ambiguity if both modules and primitives have the same name in an intra-doc link Aug 11, 2020
@jyn514
Copy link
Member Author

jyn514 commented Aug 22, 2020

Note the ambiguity here is because both are in the type namespace. The way rustdoc currently finds ambiguity is if there are multiple namespaces with a match, but because these are in the same namespace, it doesn't notice.

@jyn514
Copy link
Member Author

jyn514 commented Aug 22, 2020

This needs to happen before stabilization (#74430) since it's not backwards compatible.

@jyn514 jyn514 self-assigned this Aug 22, 2020
@jyn514
Copy link
Member Author

jyn514 commented Aug 22, 2020

Ugh, this breaks type@char because both modules and primitives are in the type namespace. Maybe we could introduce a primitive@ or prim@ disambiguator? There was some talk of that for #63351. That seems a little silly to do just for this though ...

@jyn514
Copy link
Member Author

jyn514 commented Aug 22, 2020

The other alternative is to special case type@char as meaning the primitive, which is what happens currently. But that seems pretty hacky.

@jyn514
Copy link
Member Author

jyn514 commented Aug 22, 2020

Going to introduce prim@char for now and we can discuss it more during review.

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-enhancement Category: An issue proposing an enhancement or a PR with one. 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.

1 participant