You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rustdoc doesn't warn if links to associated items are ambiguous if primitives are involved #83862
Oof I just realized this is a lot harder than I expected. For the case where usize is a module, usize::MAX resolves normally with resolve_path, before the hacky string splitting for resolve_associated_item. So to support prim@usize::MAX I need to do the string splitting before resolve_path ever runs, and call resolve_primitive_associated_item instead.
@Manishearth btw do you want that prim@usize::MAX syntax to work? Or should it just not be possible to disambiguate the two? It does seem weird for the disambiguator to refer to the root res usize instead of MAX, that's inconsistent with how it works eveywhere else.
@Manishearth btw do you want that prim@usize::MAX syntax to work? Or should it just not be possible to disambiguate the two? It does seem weird for the disambiguator to refer to the root res usize instead of MAX, that's inconsistent with how it works eveywhere else.
Hmm, this sounds like a pretty big complication; unsure if we should.
We can just special case the primitives and do both lookups.
changed the title [-]Rustdoc doesn't warn if links to associated items are ambiguous[/-][+]Rustdoc doesn't warn if links to associated items are ambiguous if primitives are involved[/+]on Apr 8, 2021
Activity
jyn514 commentedon Apr 8, 2021
Oof I just realized this is a lot harder than I expected. For the case where
usizeis a module,usize::MAXresolves normally withresolve_path, before the hacky string splitting forresolve_associated_item. So to supportprim@usize::MAXI need to do the string splitting before resolve_path ever runs, and callresolve_primitive_associated_iteminstead.@Manishearth btw do you want that
prim@usize::MAXsyntax to work? Or should it just not be possible to disambiguate the two? It does seem weird for the disambiguator to refer to the root resusizeinstead ofMAX, that's inconsistent with how it works eveywhere else.Manishearth commentedon Apr 8, 2021
Hmm, this sounds like a pretty big complication; unsure if we should.
We can just special case the primitives and do both lookups.
jyn514 commentedon Apr 8, 2021
Sorry, I don't follow - what should happen if it's ambiguous (both resolve)?
[-]Rustdoc doesn't warn if links to associated items are ambiguous[/-][+]Rustdoc doesn't warn if links to associated items are ambiguous if primitives are involved[/+]jyn514 commentedon Apr 8, 2021
I would also be ok with saying "don't name modules after primitives" and closing this as WONTFIX, that seems confusing anyway.
Manishearth commentedon Apr 8, 2021
I mean, don't name modules after primitives such that the names clash. Fine with wontfixing