summary refs log tree commit diff
path: root/tests/rustdoc
AgeCommit message (Collapse)AuthorLines
2023-04-16Don't collect return-position impl traits for documentationMichael Goulet-0/+15
2023-02-23rustdoc: avoid including `<li>` tags in item table short descMichael Howell-0/+10
Fixes a bug seen at https://docs.rs/gl_constants/0.1.1/gl_constants/index.html
2023-02-23Rollup merge of #108349 - GuillaumeGomez:fix-duplicated-imports2, r=notriddleMatthias Krüger-0/+26
rustdoc: Prevent duplicated imports Fixes #108163. Interestingly enough, the AST is providing us an import for each corresponding item, even though the `Res` links to multiple ones each time, which leaded to the same import being duplicated. So in this PR, I decided to prevent the add of the import before the clean pass. However, I originally took a different path by instead filtering after cleaning the path. You can see it [here](https://github.com/rust-lang/rust/compare/master...GuillaumeGomez:rust:fix-duplicated-imports?expand=1). Only the second commit differs. I think this approach is better though, but at least we can compare both if we want. The first commit adds the check for duplicated items in the rustdoc-json output as asked in #108163. cc `@aDotInTheVoid` r? `@notriddle`
2023-02-22Add test to ensure there are no duplicated importsGuillaume Gomez-0/+26
2023-02-22rustdoc: update test case with intra-doc link pointing to methodMichael Howell-4/+12
2023-02-22Rollup merge of #108310 - ↵Guillaume Gomez-0/+25
GuillaumeGomez:fix-reexports-duplicated-attributes, r=notriddle rustdoc: Fix duplicated attributes for first reexport Fixes #108281. r? ``@notriddle``
2023-02-21Add regression test for #108281Guillaume Gomez-0/+25
2023-02-20Rollup merge of #108241 - GuillaumeGomez:fix-reexported-macro-handling, ↵Matthias Krüger-0/+45
r=notriddle Fix handling of reexported macro in doc hidden items Fixes https://github.com/rust-lang/rust/issues/108231. Fixes #59368. r? `@notriddle`
2023-02-20Add test for reexported hidden macroGuillaume Gomez-0/+22
2023-02-20Add regression test for #108231Guillaume Gomez-0/+23
2023-02-19Rollup merge of #108129 - ↵Guillaume Gomez-0/+28
GuillaumeGomez:correctly-handle-links-starting-with-whitespace, r=petrochenkov Correctly handle links starting with whitespace Part of https://github.com/rust-lang/rust/issues/107995. I just got this issue, wrote a fix and then saw the issue. So here's the PR. ^^' r? `@petrochenkov`
2023-02-19Rollup merge of #107783 - notriddle:notriddle/item-table-ul, r=GuillaumeGomezDylan DPC-43/+43
rustdoc: simplify DOM for `.item-table` This switches from using `<div>` to the more semantic `<ul>`, and using class names that rhyme with the classes the search results table uses.
2023-02-18Add regression test for #107995Guillaume Gomez-0/+28
2023-02-16Rollup merge of #108057 - GuillaumeGomez:fix-reexport-attr-merge, r=notriddleMatthias Krüger-0/+33
Prevent some attributes from being merged with others on reexports Final fix for https://github.com/rust-lang/rust/issues/59368. As discussed on zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Filtering.20sub.20attributes.20in.20ast.3A.3AAttribute), we need to clone the `Attribute` to be able to filter some parts of it. Then we need to go through the attributes to able to only keep what we want (everything except a few attributes in short). As for the second commit, when I wrote the test, I realized that the code to traverse all reexports one by one to collect all their attributes was not completely working so I fixed the few issues remaining. r? `@notriddle`
2023-02-15Correctly handle reexports of `#[doc(hidden)]` is reexport does not use ↵Guillaume Gomez-3/+10
`#[doc(inline)]`
2023-02-14Add test for reexports attr mergeGuillaume Gomez-0/+26
2023-02-13rustdoc: add more tooltips to intra-doc linksMichael Howell-0/+17
This commit makes intra-doc link tooltips consistent with generated links in function signatures and item tables, with the format `itemtype foo::bar::baz`. This way, you can tell if a link points at a trait or a type (for example) by mousing over it. See also fce944d4e79b3a87ddf511206724edf33acfd704
2023-02-13Rollup merge of #107340 - notriddle:notriddle/simplify-doctest-tooltip, ↵Matthias Krüger-5/+5
r=GuillaumeGomez rustdoc: merge doctest tooltip with notable traits tooltip Fixes https://discord.com/channels/442252698964721669/443150878111694848/1066420140167680000 <details><summary>a user report where the tooltip arrow overlaps the text</summary> ![](https://cdn.discordapp.com/attachments/443150878111694848/1066420139530145812/this-example-is-not-tested-busted-rendering.png) </details> Fixes #91100 Preview: <https://notriddle.com/notriddle-rustdoc-demos/simplify-doctest-tooltip/std/vec/struct.Vec.html#indexing> Screenshot: ![image](https://user-images.githubusercontent.com/1593513/214975516-72667632-4609-49fa-8c37-e8d2ba1ba7dc.png)
2023-02-12Rollup merge of #107934 - ↵Matthias Krüger-0/+6
notriddle:notriddle/intra-doc-link-meta-description, r=camelid,GuillaumeGomez rustdoc: account for intra-doc links in `<meta name="description">` Similar to #86451, but for the SEO descriptions instead of the search descriptions.
2023-02-11rustdoc: account for intra-doc links in `<meta name="description">`Michael Howell-0/+6
2023-02-11Rollup merge of #107897 - GuillaumeGomez:reexported-macros-docs, r=notriddleMatthias Krüger-0/+23
Reexported macros docs Part of #59368 (doesn't fix it, only improve the current situation a bit). Macros were not correctly handled in reexports and the reexport attributes were not merged with the item either. This PR fixes both. r? `@notriddle`
2023-02-11Rollup merge of #107490 - notriddle:notriddle/rm-sidebar-tooltip, ↵Dylan DPC-27/+0
r=GuillaumeGomez rustdoc: remove inconsistently-present sidebar tooltips Discussed in https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Inconsistent.20sidebar.20tooltips/near/323565625
2023-02-10Add regression test for reexported macros docsGuillaume Gomez-0/+23
2023-02-09Rollup merge of #107655 - notriddle:notriddle/small-url-encode, r=GuillaumeGomezDylan DPC-14/+14
rustdoc: use the same URL escape rules for fragments as for examples Carries over improvements from #107284
2023-02-07rustdoc: simplify DOM for `.item-table`Michael Howell-43/+43
This switches from using `<div>` to the more semantic `<ul>`, and using class names that rhyme with the classes the search results table uses.
2023-02-07rustdoc: use a newline instead of `<br>` to format code headersMichael Howell-22/+47
Since these elements now use `white-space: pre-wrap` since 784665d4ce59c5239791f1f96fa2137e47ca1817, it's fine to use newlines for formatting, which is smaller and a bit less complicated.
2023-02-04rustdoc: trait bound formattingRoland Strasser-10/+44
rustdoc: fix item-spacer rustdoc: use proper comment style rustdoc: change formatting where clauses for traits rustdoc: remove semicolon from provided methods update provided methods formatting
2023-02-03rustdoc: use the same URL escape rules for fragments as for examplesMichael Howell-14/+14
2023-02-03Rollup merge of #107615 - notriddle:notriddle/nbsp, r=GuillaumeGomezMichael Goulet-5/+5
Replace nbsp in all rustdoc code blocks Based on #106125 by `@dtolnay` — this PR fixes the line wrapping bug. Fixes #106098. This makes code copyable from rustdoc rendered documentation into a Rust source file.
2023-02-03Replace nbsp in all rustdoc code blocksMichael Howell-5/+5
Co-Authored-By: David Tolnay <dtolnay@gmail.com>
2023-02-02Auto merge of #107000 - GuillaumeGomez:fix-items-in-doc-hidden-block, ↵bors-1/+95
r=notriddle,petrochenkov Fix handling of items inside a `doc(hidden)` block Fixes #106373. cc `@aDotInTheVoid` r? `@notriddle`
2023-01-31rustdoc: stop making unstable items transparentMichael Howell-5/+7
Fixes #93393
2023-01-31rustdoc: remove inconsistently-present sidebar tooltipsMichael Howell-27/+0
Discussed in https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Inconsistent.20sidebar.20tooltips/near/323565625
2023-01-31Rollup merge of #107479 - compiler-errors:probe-can-call-ocx, r=BoxyUwUYuki Okushi-0/+17
Use `ObligationCtxt::new_in_snapshot` in `satisfied_from_param_env` We can evaluate nested `ConstEvaluatable` obligations in an evaluation probe, which will ICE if we use `ObligationCtxt::new`. Fixes #107474 Fixes #106666 r? `@BoxyUwU` but feel free to reassign cc `@JulianKnodt` who i think added this assertion code Not sure if the rustdoc test is needed, but can't hurt. They're the same root cause, though.
2023-01-30Use ObligationCtxt::new_in_snapshot in satisfied_from_param_envMichael Goulet-0/+17
2023-01-30rustdoc: remove unnecessary wrapper div.item-decl from HTMLMichael Howell-253/+253
2023-01-28rustdoc: remove unused class `has-srclink`Michael Howell-86/+86
Stopped being used in CSS with 73d0f7c7b68784f1db0a1f53855c20d118a7e8b0
2023-01-27Add rustdoc test to ensure that items into a `doc(hidden)` block are handled ↵Guillaume Gomez-0/+50
as expected
2023-01-27rustdoc: merge doctest tooltip with notable traits tooltipMichael Howell-5/+5
Fixes https://discord.com/channels/442252698964721669/443150878111694848/1066420140167680000 Fixes #91100
2023-01-27Update rustdoc/redirect testGuillaume Gomez-1/+2
2023-01-27Add regression test for impl blocks in const exprGuillaume Gomez-0/+43
2023-01-27Add regression test for #107350Guillaume Gomez-0/+18
2023-01-27Rollup merge of #107336 - notriddle:notriddle/import-item-module-item, ↵Yuki Okushi-18/+18
r=GuillaumeGomez rustdoc: remove mostly-unused CSS classes `import-item` and `module-item`
2023-01-27Rollup merge of #107284 - notriddle:notriddle/plus, r=jshaYuki Okushi-4/+4
rustdoc: use smarter encoding for playground URL The old way would compress okay with DEFLATE, but this version makes uncompressed docs smaller, which matters for memory usage and stuff like `cargo doc`. Try it out: <https://play.rust-lang.org/?code=fn+main()+{%0Alet+mut+v+=+Vec::new();%0Av.push(1+/+1);%0Aprintln!(%22{}%22,+v[0]);%0A}> In local testing, this change shrinks sample pages by anywhere between 4.0% and 0.031% $ du -b after.dir/std/vec/struct.Vec.html before.dir/std/vec/struct.Vec.html 759235 after.dir/std/vec/struct.Vec.html 781842 before.dir/std/vec/struct.Vec.html 100*((759235-781842)/781842)=-2.8 $ du -b after.dir/std/num/struct.Wrapping.html before.dir/std/num/struct.Wrapping.html 3194173 after.dir/std/num/struct.Wrapping.html 3204351 before.dir/std/num/struct.Wrapping.html 100*((3194173-3204351)/3204351)=-0.031 $ du -b after.dir/std/keyword.match.html before.dir/std/keyword.match.html 8151 after.dir/std/keyword.match.html 8495 before.dir/std/keyword.match.html 100*((8151-8495)/8495)=-4.0 Gzipped tarball sizes seem shrunk, but not by much. du -s before.tar.gz after.tar.gz 69600 before.tar.gz 69480 after.tar.gz 100*((69480-69600)/69600)=-0.17
2023-01-27Rollup merge of #107242 - notriddle:notriddle/title-ordering, r=GuillaumeGomezYuki Okushi-5/+5
rustdoc: make item links consistently use `title="{shortty} {path}"` The ordering in item tables was flipped in 3030cbea957adbd560bf2eaa34c1b8a56daee16a, making it inconsistent with the ordering in method signatures. Compare these (before this PR is merged): https://github.com/rust-lang/rust/blob/c8e6a9e8b6251bbc8276cb78cabe1998deecbed7/src/librustdoc/html/render/print_item.rs#L455-L459 https://github.com/rust-lang/rust/blob/c8e6a9e8b6251bbc8276cb78cabe1998deecbed7/src/librustdoc/html/format.rs#L903-L908
2023-01-26rustdoc: remove mostly-unused CSS classes import/module-itemMichael Howell-18/+18
2023-01-26rustdoc: use smarter encoding for playground URLMichael Howell-4/+4
The old way would compress okay with DEFLATE, but this version makes uncompressed docs smaller, which matters for memory usage and stuff like `cargo doc`. Try it out: <https://play.rust-lang.org/?code=fn+main()+{%0Alet+mut+v+=+Vec::new();%0Av.push(1+/+1);%0Aprintln!(%22{}%22,+v[0]);%0A}> In local testing, this change shrinks sample pages by anywhere between 4.0% and 0.031% $ du -b after.dir/std/vec/struct.Vec.html before.dir/std/vec/struct.Vec.html 759235 after.dir/std/vec/struct.Vec.html 781842 before.dir/std/vec/struct.Vec.html 100*((759235-781842)/781842)=-2.8 $ du -b after.dir/std/num/struct.Wrapping.html before.dir/std/num/struct.Wrapping.html 3194173 after.dir/std/num/struct.Wrapping.html 3204351 before.dir/std/num/struct.Wrapping.html 100*((3194173-3204351)/3204351)=-0.031 $ du -b after.dir/std/keyword.match.html before.dir/std/keyword.match.html 8151 after.dir/std/keyword.match.html 8495 before.dir/std/keyword.match.html 100*((8151-8495)/8495)=-4.0 Gzipped tarball sizes seem shrunk, but not by much. du -s before.tar.gz after.tar.gz 69600 before.tar.gz 69480 after.tar.gz 100*((69480-69600)/69600)=-0.17
2023-01-23rustdoc: rearrange HTML in primitive reference linksMichael Howell-4/+4
This patch avoids hard-to-click single character links by making the generic part of the link: Before: <a href="#">&</a>T After: <a href="#">&T</a>
2023-01-23rustdoc: make item links consistently use `title="{shortty} {path}"`Michael Howell-5/+5
The ordering in item tables was flipped in 3030cbea957adbd560bf2eaa34c1b8a56daee16a, making it inconsistent with the ordering in method signatures. Compare these: https://github.com/rust-lang/rust/blob/c8e6a9e8b6251bbc8276cb78cabe1998deecbed7/src/librustdoc/html/render/print_item.rs#L455-L459 https://github.com/rust-lang/rust/blob/c8e6a9e8b6251bbc8276cb78cabe1998deecbed7/src/librustdoc/html/format.rs#L903-L908
2023-01-19Revert "Add regression test for impl blocks in const expr"Guillaume Gomez-43/+0
This reverts commit 9cce0bc583ee2cff88935ce0e08d8ec1eb1239a8.