summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2023-01-19Revert "Improve code readability"Guillaume Gomez-1/+1
This reverts commit eb93d1bedeab64c6f5d661df6a309a5b8a9273ca.
2023-01-19Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkovbors-1/+1
Various cleanups around pre-TyCtxt queries and functions part of #105462 based on https://github.com/rust-lang/rust/pull/106776 (everything starting at [0e2b39f](https://github.com/rust-lang/rust/pull/106810/commits/0e2b39fd1ffde51b50d45ccbe41de52b85136b8b) is new in this PR) r? `@petrochenkov` I think this should be most of the uncontroversial part of #105462.
2023-01-17Rollup merge of #106869 - notriddle:notriddle/item-decl-pre-rust, ↵Matthias Krüger-16/+16
r=GuillaumeGomez rustdoc: remove redundant item kind class from `.item-decl > pre` This class originated in the very first commit of `rustdoc_ng`, and was used to add a color border around the item decl based on its kind. https://github.com/rust-lang/rust/blob/4fd061c426902b0904c65e64a3780b21f9ab3afb/src/rustdoc_ng/html/static/main.css#L102-L106 The item decl no longer has a border, and there aren't any kind-specific styles in modern rustdoc's rendering of this UI item. Most of this PR is updating test cases so that they use `item-decl` to find the `<pre>` tag instead of relying on the fact that the class name had `rust {kind}` in it while other `<pre>` tags only had class `rust`.
2023-01-16Move compiler input and ouput paths into sessionOli Scherer-1/+1
2023-01-15rustdoc: simplify some & ref erencesMatthias Krüger-2/+2
2023-01-14rustdoc: remove redundant item kind class from `.item-decl > pre`Michael Howell-16/+16
This class originated in the very first commit of `rustdoc_ng`, and was used to add a color border around the item decl based on its kind. https://github.com/rust-lang/rust/blob/4fd061c426902b0904c65e64a3780b21f9ab3afb/src/rustdoc_ng/html/static/main.css#L102-L106 The item decl no longer has a border, and there aren't any kind-specific styles in modern rustdoc's rendering of this UI item. Most of this commit is updating test cases so that they use `item-decl` to find the `<pre>` tag instead of relying on the fact that the class name had `rust {kind}` in it while other `<pre>` tags only had class `rust`.
2023-01-14Rollup merge of #106855 - klensy:rd-s, r=notriddleMatthias Krüger-13/+12
rustdoc: few small cleanups
2023-01-14Rollup merge of #106828 - notriddle:notriddle/notable-trait-docblock, ↵Matthias Krüger-1/+1
r=GuillaumeGomez rustdoc: remove `docblock` class from notable trait popover This commit builds on b72de9be74dd5ac1d8b23d5ece03a7690274a14c, which removes the `docblock` class from the All Items page, and 9457380ac902db3febf92077c5b645db55998ad4, which removes the `docblock` class from the item decl. Fixes #92974
2023-01-14Rollup merge of #106819 - notriddle:notriddle/rm-h1-fqn, r=GuillaumeGomezYuki Okushi-5/+5
rustdoc: remove unnecessary DOM class `h1.fqn` It's misleading. The main heading sometimes isn't an fully qualified name at all. It's also redundant. It's always a child of `div.main-heading`, so just use that.
2023-01-13rustdoc: remove `docblock` class from notable trait popoverMichael Howell-1/+1
This commit builds on b72de9be74dd5ac1d8b23d5ece03a7690274a14c, which removes the `docblock` class from the All Items page, and 9457380ac902db3febf92077c5b645db55998ad4, which removes the `docblock` class from the item decl. Fixes #92974
2023-01-13rustdoc: rename CSS rustdoc-toggle -> toggle and toggle -> settings-toggleMichael Howell-7/+7
This swaps things around so that the class that gets used more often has the shorter name.
2023-01-13rustdoc: remove unnecessary DOM class `h1.fqn`Michael Howell-5/+5
It's misleading. The main heading sometimes isn't an fully qualified name at all. It's also redundant. It's always a child of `div.main-heading`, so just use that.
2023-01-13CrateData: don't allocate String when Serialize, &str is enoughklensy-1/+1
2023-01-13Playground.crate_name String -> Symbolklensy-3/+2
2023-01-13IndexItem.name String -> Symbolklensy-5/+5
2023-01-13evade clonesklensy-4/+4
2023-01-10Remove unneeded ItemId::Primitive variantGuillaume Gomez-20/+55
2023-01-06Correctly render sidebar for relative module pathsclubby789-25/+59
2023-01-03clean: Remove `ctor_kind` from `VariantStruct`.Nixon Enraght-Moony-10/+1
It's always `None`.
2023-01-01clean: Always store enum disriminant.Nixon Enraght-Moony-17/+20
2022-12-29Fix index out of bounds issues in rustdocyukang-2/+1
2022-12-22Rollup merge of #106027 - notriddle:notriddle/more-scraped-examples-inner, ↵Matthias Krüger-3/+2
r=GuillaumeGomez rustdoc: simplify CSS and DOM for more-scraped-examples This gets rid of the more-scraped-examples-inner wrapper, instead nesting the children directly and using absolute positioning for the toggle line.
2022-12-22Auto merge of #104889 - GuillaumeGomez:fix-impl-block-in-const-expr, r=notriddlebors-1/+1
Fix impl block in const expr Fixes #83026. The problem was that we didn't visit block expressions. Considering how big the [walk_expr](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_hir/intravisit.rs.html#678) function is, I decided to instead implement the `hir` visitor on the struct. It also answers the question which was in a comment for `RustdocVisitor`: we should have used a visitor instead of our ad-hoc implementation. Adding this visitor also added some extra checks that weren't present before (check changes in `rustdoc-ui` tests). r? `@notriddle`
2022-12-21rustdoc: simplify CSS and DOM for more-scraped-examplesMichael Howell-3/+2
This gets rid of the more-scraped-examples-inner wrapper, instead nesting the children directly and using absolute positioning for the toggle line.
2022-12-16Don't add "Read more" link if there is no extra contentGuillaume Gomez-2/+3
2022-12-13Rollup merge of #105639 - notriddle:notriddle/text-css, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: remove `type="text/css" from stylesheet links MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>, since "CSS is the only stylesheet language used on the web." Like 07a243b2a46384235d7e2c08688978b7cf018973, but a few places that were missed the first time.
2022-12-12rustdoc: remove `type="text/css" from stylesheet linksMichael Howell-1/+1
MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>, since "CSS is the only stylesheet language used on the web." Like 07a243b2a46384235d7e2c08688978b7cf018973, but a few places that were missed the first time.
2022-12-12rustdoc: stop treating everything in a trait item as a methodMichael Howell-3/+3
This was added in 0b9b4b70683db6ef707755f520f139eb7b92a944 to fix the spacing on trait pages, but stopped being needed because 791f04e5a47ee78951552c7ed1545b2b01a44c74 stopped styling method-toggle. By only putting the method-toggle class on actual methods, the JS setting does the right thing.
2022-12-07Improve code readabilityGuillaume Gomez-1/+1
2022-12-07Update scrape-examples help, fix documentation typosWill Crichton-7/+8
2022-12-07Improve several aspects of the Rustdoc scrape-examples UI.Will Crichton-5/+13
* Examples take up less screen height. * Snippets from binary crates are prioritized. * toggle-all-docs does not expand "More examples" sections.
2022-12-01rustc_hir: Change representation of import paths to support multiple resolutionsVadim Petrochenkov-8/+0
2022-12-01rustc_hir: Relax lifetime requirements on `Visitor::visit_path`Vadim Petrochenkov-1/+1
2022-11-28rustdoc: remove `fnname` CSS class that's styled exactly like `fn`Michael Howell-2/+2
It's not obvious why this was ever a separate class name, since even in c4219a478354b464079b1b7ab081e071e8e39765 when it was first added, it was styled identically to regular `fn` links.
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-2/+2
2022-11-24make rustc_target usable outside of rustchkalbasi-4/+4
2022-11-23Improve accessibility:Guillaume Gomez-15/+15
* Set aria-label attribute on search input * Put anchor text directly into the DOM and not in the CSS
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-12/+12
2022-11-19rustdoc: use real buttons for scrape examples controlsMichael Howell-1/+1
2022-11-17rustdoc: use `code-header` class to format enum variantsMichael Howell-15/+16
The font size and weights should be exactly the same after this commit, but the spacing is changed to be exactly the same as methods.
2022-11-13Rollup merge of #104177 - notriddle:notriddle/js-notable-trait-v2, ↵Yuki Okushi-4/+2
r=GuillaumeGomez rustdoc: use consistent "popover" styling for notable traits Follow-up to #104129 Fixes https://github.com/rust-lang/rust/issues/104313. Preview: https://notriddle.com/notriddle-rustdoc-demos/js-notable-trait-v2/std/iter/trait.Iterator.html#method.step_by ## Before ![image](https://user-images.githubusercontent.com/1593513/200710372-d2d992ce-0bdc-4437-9a2e-379a29df09cf.png) ![image](https://user-images.githubusercontent.com/1593513/200711266-e372b176-daa9-45f3-a022-738ef0a77d3c.png) ## After ![image](https://user-images.githubusercontent.com/1593513/200710601-09b3b717-116f-43c6-b14f-34a8b02b33c0.png) ![image](https://user-images.githubusercontent.com/1593513/200711288-3978cdc1-a6c2-47f6-9216-e22e3c1f5bdf.png)
2022-11-13Rollup merge of #103650 - notriddle:notriddle/line-anchors, r=GuillaumeGomezYuki Okushi-4/+1
rustdoc: change `.src-line-numbers > span` to `.src-line-numbers > a` Example: https://notriddle.com/notriddle-rustdoc-demos/line-anchors/test_dingus/fn.test.html This allows people to treat them like real links, such as right-click to copy URL, and makes the line numbers in a scraped example work at all, when before this commit was added, they had the clickable pointer cursor but did not actually do anything when clicked.
2022-11-12rustdoc: avoid excessive HTML generated in example sourcesMichael Howell-5/+1
2022-11-11rustdoc: use consistent "popover" styling for notable traitsMichael Howell-4/+2
2022-11-11rustdoc: fix HTML validation failure by escaping `data-ty`Michael Howell-2/+2
2022-11-09rustdoc: sort output to make it deterministicMichael Howell-1/+2
2022-11-07rustdoc: use javascript to layout notable traits popupsMichael Howell-59/+122
Fixes #102576
2022-11-07rustdoc: refactor `notable_traits_decl` to just act on the type directlyMichael Howell-68/+72
2022-11-05Rollup merge of #101702 - jsha:static-files2, r=notriddle,GuillaumeGomezMatthias Krüger-264/+60
rustdoc: add hash to filename of toolchain files All static files used by rustdoc are now stored in static.files/ and their filenames include a hash of their contents. Their filenames no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL. Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix. This has a useful side effect: once toolchain files aren't affected by resource suffix, it will become possible for docs.rs to include crate version in the resource suffix. That should fix a caching issue with `/latest/` URLs: https://github.com/rust-lang/docs.rs/issues/1593. My goal is that it should be safe to serve all rustdoc JS, CSS, and fonts with infinite caching headers, even when new versions of a crate are uploaded in the same place as old versions. The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration. Example listing: ``` $ cd build/x86_64-unknown-linux-gnu/doc/ && find . | egrep 'js$|css$' | egrep -v 'sidebar-items|implementors' | sort ./crates1.65.0.js ./rust.css ./search-index1.65.0.js ./source-files1.65.0.js ./static.files/ayu-2bfd0af01c176fd5.css ./static.files/dark-95d11b5416841799.css ./static.files/light-c83a97e93a11f15a.css ./static.files/main-efc63f77fb116394.js ./static.files/normalize-76eba96aa4d2e634.css ./static.files/noscript-5bf457055038775c.css ./static.files/rustdoc-7a422337900fa894.css ./static.files/scrape-examples-3dd10048bcead3a4.js ./static.files/search-47f3c289722672cf.js ./static.files/settings-17b08337296ac774.js ./static.files/settings-3f95eacb845293c0.css ./static.files/source-script-215e9db86679192e.js ./static.files/storage-26d846fcae82ff09.js ``` Fixes #98413
2022-11-03Remove rustdoc clean::Visibility typeGuillaume Gomez-22/+27