mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
16ce4f7513
convert slice doc link to intra-doc links Continuing where #80189 stopped, with `core::slice`. I had an issue with two dead links in my doc when implementing `Deref<Target = [T]>` for one of my type. This means that [`binary_search_by_key`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.binary_search_by_key) was available, but not [`sort_by_key`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.sort_by_key) even though it was linked in it's doc (same issue with [`as_ptr`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.as_ptr) and [`as_mut_pbr`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.as_mut_ptr)). It becomes available if I implement `DerefMut`, as it needs an `&mut self`. <details> <summary>Code that will have dead links in its doc</summary> ```rust pub struct A; pub struct B; impl std::ops::Deref for B{ type Target = [A]; fn deref(&self) -> &Self::Target { &A } } ``` </details> I removed the link to `sort_by_key` from `binary_search_by_key` doc as I didn't find a nice way to have a live link: - `binary_search_by_key` is in `core` - `sort_by_key` is in `alloc` - intra-doc link `slice::sort_by_key` doesn't work, as `alloc` is not available when `core` is being build (the warning can't be ignored: ```error[E0710]: an unknown tool name found in scoped lint: `rustdoc::broken_intra_doc_links` ```) - keeping the link as an anchor `#method.sort_by_key` meant a dead link - an absolute link would work but doesn't feel right... |
||
---|---|---|
.. | ||
alloc | ||
backtrace@af078ecc0b | ||
core | ||
panic_abort | ||
panic_unwind | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@9c732a56f6 | ||
term | ||
test | ||
unwind |