about summary refs log tree commit diff
path: root/src/test/rustdoc
AgeCommit message (Collapse)AuthorLines
2022-07-16rustdoc: avoid inlining items with duplicate `(type, name)`Michael Howell-0/+70
Fixes #99221
2022-07-07Rollup merge of #98973 - GuillaumeGomez:inherent-impl-anchors, r=notriddleDylan DPC-0/+56
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`
2022-07-06Rollup merge of #98939 - GuillaumeGomez:rustdoc-disamb-impls, r=notriddleGuillaume Gomez-39/+39
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`
2022-07-06Rollup merge of #98911 - notriddle:notriddle/rustdoc-string-impl, ↵Guillaume Gomez-0/+12
r=GuillaumeGomez rustdoc: filter '_ lifetimes from ty::Generics Fixes a weirdly-rendered section of the std::string::String docs. Before: ![image](https://user-images.githubusercontent.com/1593513/177256873-20b9cf6e-2429-4865-853b-b269d74672f4.png) After: ![image](https://user-images.githubusercontent.com/1593513/177256900-ef3efd17-f624-40c5-af90-fe709ec034f2.png)
2022-07-06Add test for inherent impls anchorsGuillaume Gomez-0/+56
2022-07-05Rollup merge of #98256 - GuillaumeGomez:whitespace-where-clause, r=notriddleGuillaume Gomez-0/+111
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`
2022-07-05Add test for invalid whitespace display after where clauseGuillaume Gomez-0/+111
2022-07-05Update rustdoc testsGuillaume Gomez-17/+17
2022-07-05rustdoc: Add more semantic information to impl idspierwill-24/+24
Instead of generating `#impl`, `#impl-1`, etc., generate IDs like `#impl-Foo<M>`. Co-authored-by: Noah Lev <camelidcamel@gmail.com>
2022-07-05Rollup merge of #98856 - GuillaumeGomez:rustdoc-test-rm-fixme, r=Dylan-DPCDylan DPC-12/+2
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``
2022-07-04rustdoc: filter '_ lifetimes from ty::GenericsMichael Howell-0/+12
Fixes a weirdly-rendered section of the std::string::String docs.
2022-07-04Rollup merge of #98814 - fmease:minimal-fix-for-issue-97933, r=GuillaumeGomezMatthias Krüger-3/+160
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`
2022-07-04rustdoc: censor certain complex unevaluated const exprsLeón Orell Valerian Liehr-3/+160
2022-07-04Rollup merge of #98806 - GuillaumeGomez:decl-trailing-whitespace, r=notriddleMatthias Krüger-1/+38
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`
2022-07-03Add test for trailing whitespace in long declarationGuillaume Gomez-1/+38
2022-07-03Remove FIXME from rustdoc intra-doc testGuillaume Gomez-12/+2
2022-07-01Shorten def_span for more items.Camille GILLOT-6/+6
2022-06-30rustdoc: filter '_ lifetimes from ty::PolyTraitRefMichael Howell-0/+22
Fixes #98697
2022-06-26Add regression test for #92859Guillaume Gomez-0/+24
2022-06-20Add test for macro support in "jump to def" featureGuillaume Gomez-0/+25
2022-06-19Rollup merge of #98105 - notriddle:notriddle/tuple-links, r=jshaDylan DPC-0/+18
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>
2022-06-18Add test cases for tuples with linksMichael Howell-0/+18
2022-06-16Auto merge of #97842 - notriddle:notriddle/tuple-docs, r=jsha,GuillaumeGomezbors-0/+54
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>
2022-06-16Exclude cfg "doc" and "doctest" from feature `doc_auto_cfg`Sprite-10/+15
2022-06-16Fix `cfg(not)` and `cfg(all)` causing Rustdoc stab to disappearSprite-1/+17
2022-06-14rustdoc: add test case for "variadic tuple" search notationMichael Howell-0/+18
2022-06-13rustdoc: remove link on slice bracketsMichael Howell-3/+3
Since #97668 was merged, the slice::get function now looks like this: ![image](https://user-images.githubusercontent.com/1593513/173430685-1dd2b275-2439-4392-b7d4-96bcb355a377.png) 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: ![image](https://user-images.githubusercontent.com/1593513/173430968-7eed1aec-b688-4f84-a492-9210aff0037a.png) 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.
2022-06-11Add test case for #trait-implementations-1 linkMichael Howell-0/+8
2022-06-08Add regression test for #84634Guillaume Gomez-0/+28
2022-06-07rustdoc: show auto/blanket docs for tuple and unitMichael Howell-0/+28
2022-06-06Rollup merge of #90905 - GuillaumeGomez:empty-impl-blocks, r=jshaMatthias Krüger-0/+20
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: ![Screenshot from 2021-11-14 16-51-28](https://user-images.githubusercontent.com/3050060/141689100-e57123c0-bf50-4c42-adf5-d991e169a0e4.png) cc ```@jyn514``` r? ```@camelid```
2022-06-03Rollup merge of #97668 - notriddle:notriddle/slice-link, r=jshaDylan DPC-0/+32
rustdoc: clean up primitive.slice.html links Before: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a>&lt;<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>&gt; After: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a>&lt;<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">[T]</a>&gt;
2022-06-02rustdoc: clean up primitive.slice.html linksMichael Howell-0/+32
2022-06-02Rollup merge of #97502 - onlineSoftwareDevOK:rustdocTests, r=GuillaumeGomezMatthias Krüger-0/+42
rustdoc: Add more test coverage Related issue https://github.com/rust-lang/rust/issues/91113
2022-06-02rustdoc: Add more test coverageonlinesoftwaredevok@protonmail.com-0/+42
2022-06-02Rollup merge of #97617 - GuillaumeGomez:rustdoc-anonymous-reexports, r=Nemo157Dylan DPC-0/+22
Rustdoc anonymous reexports Fixes #97615. r? `@Nemo157`
2022-06-01Add test for anonymous reexportsGuillaume Gomez-0/+22
2022-06-02Rollup merge of #97613 - jsha:implementation-is-on-local-type, r=GuillaumeGomezYuki Okushi-1/+1
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`
2022-06-02Rollup merge of #97130 - notriddle:notriddle/collect-trait-impls-dup, ↵Yuki Okushi-0/+14
r=GuillaumeGomez rustdoc: avoid including impl blocks with filled-in generics Fixes #94937 # Before ![image](https://user-images.githubusercontent.com/1593513/168933282-02ccc4ae-9c89-4836-ba34-e2bd83946105.png) # After ![image](https://user-images.githubusercontent.com/1593513/168933255-4c17407d-d8d1-406e-87f5-9ea809437173.png)
2022-06-01rustdoc: add test case for auto traits on slice primitiveMichael Howell-0/+14
2022-06-01Improve calculation of "Impls on Foreign Types"Jacob Hoffman-Andrews-1/+1
2022-06-01Rollup merge of #97470 - notriddle:notriddle/test-cases, r=GuillaumeGomezYuki Okushi-2/+47
rustdoc: add more test coverage https://github.com/rust-lang/rust/issues/91113
2022-05-31Add test for empty impl blocksGuillaume Gomez-0/+20
2022-05-30Remove `#[default..]` and add `#[const_trait]`Deadbeef-1/+1
2022-05-27rustdoc: add test case for the implementors JS file placementMichael Howell-0/+43
2022-05-27rustdoc: add test case for email that looks like intra-doc linkMichael Howell-2/+4
2022-05-21Strenghten strip-enum-variant.rs testGuillaume Gomez-0/+3
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-3/+1
2022-05-20Rollup merge of #96565 - notriddle:notriddle/impl-box, r=camelidGuillaume Gomez-0/+16
rustdoc: show implementations on `#[fundamental]` wrappers Fixes #92940
2022-05-09Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errorsbors-26/+23
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.