-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Intra-rustdoc links do not work for all primitives #63351
Comments
I'll recheck it and see what's going on. |
The problem here is that, even if being primitive types, they're not considered as is in the compiler since they're generic. Therefore, the problem might be way more complicated to fix considering I have no idea how to link to a slice or a pointer... |
Yea looking at the code, it seems things might stem from here: rust/src/librustc_resolve/lib.rs Lines 770 to 793 in 60960a2
Based on this and the list of primatives in the STD docs, I'm guessing the following is a complete list of generic (or otherwise unimplemented) primitives:
This seems to be more broad than just generics however, since the Given the precedence set by the STD documentation for these primitives, I believe I'd expect to link to each with the English name and not the syntax, e.g. I'm wondering if a solution to the need for separate primitive modules would also solve this. That's probably way more work than is needed for this specific issue however. Food for thought? Otherwise simply fixing this issue would be nice indeed, though does seem harder than I was hoping. |
The solution would be to "simply" try to check the current path and if not working, try to check if the first part of the path can be considered as primitive type (such as slice or pointer) and retry with this change. We already do something similar in some cases. |
I'm not sure it's that simple. If you look at https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.PrimTy.html, none of the primitives you listed are present. Looking at https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def/enum.Res.html, there isn't even a
This isn't the issue, |
This comment has been minimized.
This comment has been minimized.
A possible solution is to move from Relevant code:
|
Yeah no I take it back, |
Move to intra-doc links for task.rs and vec.rs Partial fix for rust-lang#75080 links for [`get`], [`get_mut`] skipped due to rust-lang#75643 link for [`copy_from_slice`] skipped due to rust-lang#63351
Ok, the bits that are actually used from
inline::record_extern_fqn(cx, did, kind);
if let TypeKind::Trait = kind {
inline::record_extern_trait(cx, did);
} The URL fragment is independent of So, this scheme might work: enum Resolution {
Def(DefKind, DefId), // replaces `Res::Def`
Primitive { fragment: String },
} Hmm ... that doesn't seem so bad. |
The only link that I did not change is a link to a function on the `pointer` primitive because intra-doc links for the `pointer` primitive don't work yet (see rust-lang#63351).
…r, r=jyn514 Use intra-doc links in `core::ptr` Part of rust-lang#75080. The only link that I did not change is a link to a function on the `pointer` primitive because intra-doc links for the `pointer` primitive don't work yet (see rust-lang#63351). --- @rustbot modify labels: A-intra-doc-links T-doc
…r, r=jyn514 Use intra-doc links in `core::ptr` Part of rust-lang#75080. The only link that I did not change is a link to a function on the `pointer` primitive because intra-doc links for the `pointer` primitive don't work yet (see rust-lang#63351). --- @rustbot modify labels: A-intra-doc-links T-doc
Not sure if this is 100% related, but if you auto-link |
@clarfonthey correct, that's this issue. |
…shearth Fix intra-doc links for non-path primitives This does *not* currently work for associated items that are auto-implemented by the compiler (e.g. `never::eq`), because they aren't present in the source code. I plan to fix this in a follow-up PR. Fixes rust-lang#63351 using the approach mentioned in rust-lang#63351 (comment). r? `@Manishearth` cc `@petrochenkov` - this makes `rustc_resolve::Res` public, is that ok? I'd just add an identical type alias in rustdoc if not, which seems a waste.
Now that rust-lang#63351 is fixed, there's no reason not to.
…=thomcc docs: use intra-doc links for `Vec::get(_mut)` Now that rust-lang#63351 is fixed, there's no reason not to. CC rust-lang#75672
…=thomcc docs: use intra-doc links for `Vec::get(_mut)` Now that rust-lang#63351 is fixed, there's no reason not to. CC rust-lang#75672
Coming from the tracking issue #43466.
I'm trying to link to
slice::rotate_left
and it doesn't seem to be supported I testedpointer::is_null
as well, to test if it's just polymorphic primitives, and it seems that might be the issue, since it also doesn't work as a intra-link./cc @GuillaumeGomez
The text was updated successfully, but these errors were encountered: