| Age | Commit message (Collapse) | Author | Lines |
|
Fixes #99221
|
|
Remove (unused) inherent impl anchors
This is something `@notriddle` realized a few days ago: we have unused anchors in the DOM.
This PR removes them.
You can test it [here](https://rustdoc.crud.net/imperio/inherent-impl-anchors/foo/index.html).
r? `@notriddle`
|
|
rustdoc: Add more semantic information to impl IDs
Take over of #92745.
I fixed the last remaining issue for the links in the sidebar (mentioned by `@jsha)` and fixed the few links broken in the std/core docs.
cc `@camelid`
r? `@notriddle`
|
|
r=GuillaumeGomez
rustdoc: filter '_ lifetimes from ty::Generics
Fixes a weirdly-rendered section of the std::string::String docs.
Before:

After:

|
|
|
|
Fix whitespace handling after where clause
Fixes #97733.
You can see the result [here](https://rustdoc.crud.net/imperio/whitespace-where-clause/doc/foo/index.html).
r? `@jsha`
|
|
|
|
|
|
Instead of generating `#impl`, `#impl-1`, etc., generate IDs
like `#impl-Foo<M>`.
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
|
|
Remove FIXME from rustdoc intra-doc test
Removed the FIXME.
For the `extern crate`, even if `pub` exported, its documentation wasn't rendered so there is no point in keeping it.
r? ``@notriddle``
|
|
Fixes a weirdly-rendered section of the std::string::String docs.
|
|
rustdoc: Censor certain complex unevaluated const exprs
Fixes #97933.
This is more of a hotfix for the aforementioned issue. By that, I mean that my proposed patch is
not the best solution but one that does not change as much existing code.
It treats symptoms rather than the root cause.
This PR “censors” certain complex unevaluated constant expressions like `match`es, blocks, function calls, struct literals etc. by pretty-printing them as `_` / `{ _ }` (number and string literals, paths and `()` are still printed as one would expect).
Resorting to this placeholder is preferable to printing the full expression verbatim since
they can be quite large and verbose resulting in an unreadable mess in the generated documentation.
Further, mindlessly printing the const would leak private and `doc(hidden)` struct fields (#97933), at least in the current
stable & nightly implementations which rely on `span_to_snippet` (!) and `rustc_hir_pretty::id_to_string`.
The censoring of _verbose_ expressions is probably going to stay longer term.
However, in regards to private and `doc(hidden)` struct fields, I have a more proper fix in mind
which I have already partially implemented locally and for which I am going to open a separate PR sometime soon.
For that, I was already in contact with `@GuillaumeGomez.`
The proper fix involves rustdoc not falling back on pretty-printing unevaluated consts so easily (what this PR is concerned about)
and instead preferring to print evaluated consts which contain more information allowing it to selectively hide private and `doc(hidden)` fields, create hyperlinks etc. generally making the output more granular and precise (compared to the brutal `_` placeholder).
Unfortunately, I was a bit too late and the issue just hit stable (1.62).
Should this be backported to beta or even a potential 1.62.1?
r? `@GuillaumeGomez`
|
|
|
|
Fix long declaration trailing whitespace
Fixes https://github.com/rust-lang/rust/issues/98803.
Interestingly enough, it even simplifies the code a bit.
r? `@notriddle`
|
|
|
|
|
|
|
|
Fixes #98697
|
|
|
|
|
|
rustdoc: remove tuple link on round braces
This is #98069 but for tuples. The reasoning is the same:
* This PR also changes it so that tuples with all-generic elements still link to the primitive.tuple.html page, just like slices. So there still plenty of on-ramps for anybody who doesn't know about it.
* It's too hard to see when round braces are a separate link from the type inside of them.
* It's too hard to click even if you do notice them.
Before:
* impl [ToSocketAddrs](https://doc.rust-lang.org/nightly/std/net/trait.ToSocketAddrs.html) for [(](https://doc.rust-lang.org/nightly/std/primitive.tuple.html)[IpAddr](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html)[)](https://doc.rust-lang.org/nightly/std/primitive.tuple.html)
* impl<K, V> [FromIterator](https://notriddle.com/notriddle-rustdoc-test/std/iter/trait.FromIterator.html)<[(](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)K, V[)](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)> for [BTreeMap](https://notriddle.com/notriddle-rustdoc-test/std/collections/struct.BTreeMap.html)<K, V>
After:
* impl [ToSocketAddrs](https://doc.rust-lang.org/nightly/std/net/trait.ToSocketAddrs.html) for ([IpAddr](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html))
* impl<K, V> [FromIterator](https://notriddle.com/notriddle-rustdoc-test/std/iter/trait.FromIterator.html)<[(K, V)](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)> for [BTreeMap](https://notriddle.com/notriddle-rustdoc-test/std/collections/struct.BTreeMap.html)<K, V>
|
|
|
|
Improve the tuple and unit trait docs
* Reduce duplicate impls; show only the `(T,)` and include a sentence saying that there exists ones up to twelve of them.
* Show `Copy` and `Clone`.
* Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.
Here's the new version:
* <https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html>
* <https://notriddle.com/notriddle-rustdoc-test/std/primitive.unit.html>
|
|
|
|
|
|
|
|
Since #97668 was merged, the slice::get function now looks like this:

That whole thing, `[T]`, is a single link to `primitive.slice.html`. This
definitely fixes it for this case, but it's not obvious what we should do for
slices of concrete types:

There are actually three links in that `[u8]`: the opening brace `[` is a
link to `primitive.slice.html`, the `u8` is a link to `primitive.u8.html`,
and the final `]` is a link to `primitive.slice.html`. This is a serious
[usability bug](https://usability.yale.edu/web-accessibility/articles/links):
the square braces are much too small for anyone who doesn't have perfect
motor control using mouse or touch, provide an excessive number of tab stops
for anyone using keyboard, and no visual indication whatsoever that they're
separate links.
Now that slices of generic types are linked, it seems reasonable to err on
the side of less clutter and stop linking concrete slices to the slice page.
|
|
|
|
|
|
|
|
Add empty impl blocks if they have documentation
Fixes https://github.com/rust-lang/rust/issues/90866.
The update for the test script is needed to count the number of impl blocks we have with only the struct. To be noted that with https://github.com/rust-lang/rust/pull/89676 merged, it wouldn't be needed (I don't know what is the status of it btw. cc ```@Mark-Simulacrum).```
It looks like this:

cc ```@jyn514```
r? ```@camelid```
|
|
rustdoc: clean up primitive.slice.html links
Before: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a><<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">[</a>T<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">]</a>>
After: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a><<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">[T]</a>>
|
|
|
|
rustdoc: Add more test coverage
Related issue https://github.com/rust-lang/rust/issues/91113
|
|
|
|
Rustdoc anonymous reexports
Fixes #97615.
r? `@Nemo157`
|
|
|
|
rustdoc: Improve calculation of "Impls on Foreign Types"
The existing code to calculate whether an implementation was on a "Foreign Type" was duplicated across the sidebar generation and the page generation. It also came to the wrong conclusion for some cases where both the trait and the "for" type were re-exports.
This PR extracts the logic into a method of `Impl`, breaks it into a multi-line method so it can be commented, and adds a case for when the trait and the "for" type came from the same crate. This fixes some cases - like the platform-specific integer types (`__m256`, `__m128`, etc). But it doesn't fix all cases. See the screenshots below.
[Before](https://doc.rust-lang.org/nightly/std/clone/trait.Clone.html#foreign-impls):
<img src="https://user-images.githubusercontent.com/220205/171338226-59ce6daf-3d76-4bad-bc8d-72a8259a8f43.png" width=200>
[After](https://rustdoc.crud.net/jsha/implementation-is-on-local-type/std/clone/trait.Clone.html):
<img src="https://user-images.githubusercontent.com/220205/171338147-28308a65-1597-4223-be47-9550062404dd.png" width=200>
The remaining types (`CString`, `NulError`, etc) are all from the `alloc` crate, while the `Clone` trait is from the `core` crate. Since `CString` and `Clone` are both re-exported by `std`, they are logically local to each other, but I couldn't figure out a good way to detect that in this code. I figure this is still a good step forward.
Related: #97610
r? `@camelid`
|
|
r=GuillaumeGomez
rustdoc: avoid including impl blocks with filled-in generics
Fixes #94937
# Before

# After

|
|
|
|
|
|
rustdoc: add more test coverage
https://github.com/rust-lang/rust/issues/91113
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rustdoc: show implementations on `#[fundamental]` wrappers
Fixes #92940
|
|
Remove `#[rustc_deprecated]`
This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`.
I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
|