about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2022-11-11Auto merge of #104293 - Manishearth:rollup-xj92d0k, r=Manishearthbors-94/+252
Rollup of 8 pull requests Successful merges: - #95292 (Allow specialized const trait impls.) - #100386 (Make `Sized` coinductive, again) - #102215 (Implement the `+whole-archive` modifier for `wasm-ld`) - #103468 (Fix unused lint and parser caring about spaces to won't produce invalid code) - #103531 (Suggest calling the instance method of the same name when method not found) - #103960 (piece of diagnostic migrate) - #104051 (update Miri) - #104129 (rustdoc: use javascript to layout notable traits popups) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-11Rollup merge of #104129 - notriddle:notriddle/102576-js-notable-trait, ↵Manish Goregaokar-94/+252
r=Manishearth rustdoc: use javascript to layout notable traits popups Fixes #102576 Preview: https://notriddle.com/notriddle-rustdoc-demos/102576-js-notable-trait/std/iter/trait.Iterator.html#method.step_by ## Before ![image](https://user-images.githubusercontent.com/1593513/200432713-23aa8d49-ba2b-469f-9eab-089e0c174039.png) ## After ![image](https://user-images.githubusercontent.com/1593513/200432735-edd5b53d-e99d-4fc5-9410-8a79e0efdc9d.png)
2022-11-11rustdoc: fix HTML validation failure by escaping `data-ty`Michael Howell-2/+2
2022-11-10Migrate :target rules to use CSS variablesGuillaume Gomez-15/+8
2022-11-09Rollup merge of #104115 - GuillaumeGomez:migrate-crate-search-div, r=notriddleMichael Goulet-34/+27
Migrate crate-search element to CSS variables There should no UI changes. r? ```@notriddle```
2022-11-09rustdoc: sort output to make it deterministicMichael Howell-1/+2
2022-11-09Rollup merge of #104184 - jyn514:rustdoc-version, r=davidtwcoManish Goregaokar-2/+2
Fix `rustdoc --version` when used with download-rustc Previously, rustdoc would unconditionally report the version that *rustc* was compiled with. That showed things like `nightly-2022-10-30`, which wasn't right, since this was a `dev` build compiled from source. Fix it by changing `rustc_driver::version` to a macro expanded at invocation time. cc https://github.com/rust-lang/rust/issues/103206#issuecomment-1284123084
2022-11-09Migrate crate-search element to CSS variablesGuillaume Gomez-34/+27
2022-11-09Fix `rustdoc --version` when used with download-rustcJoshua Nelson-2/+2
Previously, rustdoc would unconditionally report the version that *rustc* was compiled with. That showed things like `nightly-2022-10-30`, which wasn't right, since this was a `dev` build compiled from source. Fix it by changing `rustc_driver::version` to a macro expanded at invocation time.
2022-11-08Rollup merge of #104114 - GuillaumeGomez:background-image-path, r=notriddleGuillaume Gomez-1/+1
Fix invalid background-image file name This is a follow-up of https://github.com/rust-lang/rust/pull/101702. Apparently the image hash was the wrong one. You can see the error in https://doc.rust-lang.org/nightly/core/primitive.u16.html?search=hello too. I really need to check if I can adds check for resources load errors in `browser-ui-test`. cc ``````@jsha`````` r? ``````@notriddle``````
2022-11-07rustdoc: fix font color inheritance from body, and testMichael Howell-2/+4
2022-11-07rustdoc: use javascript to layout notable traits popupsMichael Howell-74/+225
Fixes #102576
2022-11-08Auto merge of #104013 - notriddle:notriddle/rustdoc-sizeof, r=GuillaumeGomezbors-28/+22
rustdoc: use `ThinVec` and `Box<str>` to shrink `clean::ItemKind`
2022-11-07rustdoc: refactor `notable_traits_decl` to just act on the type directlyMichael Howell-68/+72
2022-11-07Fix invalid background-image file nameGuillaume Gomez-1/+1
2022-11-07Rollup merge of #104052 - TaKO8Ki:fix-103997, r=notriddleDylan DPC-1/+2
Fix `resolution_failure` ICE Fixes #103997
2022-11-07return `None` when def_kind is `DefKind::Use`Takayuki Maeda-1/+2
2022-11-07Rollup merge of #104065 - GuillaumeGomez:css-migrate-logo-filter, r=notriddleYuki Okushi-20/+13
Migrate rust logo filter to CSS variables
2022-11-07Rollup merge of #104062 - notriddle:notriddle/sidebar-filler, r=GuillaumeGomezYuki Okushi-15/+0
rustdoc: remove unused CSS `#sidebar-filler` This hack was removed in 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c, but the CSS was left in.
2022-11-07Rollup merge of #103885 - fmease:rustdoc-various-cross-crate-reexport-fixes, ↵Yuki Okushi-47/+91
r=cjgillot,GuillaumeGomez rustdoc: various cross-crate reexport fixes Fixes for various smaller cross-crate reexport issues. The PR is split into several commits for easier review. Will be squashed after approval. Most notable changes: * We finally render late-bound lifetimes in the generic parameter list of cross-crate functions & methods. Previously, we would display the re-export of `pub fn f<'s>(x: &'s str) {}` as `pub fn f(x: &'s str)` * We now render unnamed parameters of cross-crate functions and function pointers as underscores since that's exactly what we do for local definitions, too. Mentioned as a bug in #44306. * From now on, the rendering of cross-crate trait-object types is more correct: * `for<>` parameter lists (for higher-ranked lifetimes) are now shown * the return type of `Fn{,Mut,Once}` trait bounds is now displayed Regarding the last list item, here is a diff for visualization (before vs. after): ```patch - dyn FnOnce(&'any str) + 'static + dyn for<'any> FnOnce(&'any str) -> bool + 'static ``` The redundant `+ 'static` will be removed in a follow-up PR that will hide trait-object lifetime-bounds if they coincide with [their default](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes) (see [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/clean_middle_ty.3A.20I.20need.20to.20add.20a.20parameter/near/307143097)). `FIXME(fmease)`s were added. ``@rustbot`` label A-cross-crate-reexports r? ``@GuillaumeGomez``
2022-11-06Migrate rust logo filter to CSS variablesGuillaume Gomez-20/+13
2022-11-06rustdoc: remove unused CSS `#sidebar-filler`Michael Howell-15/+0
This hack was removed in 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c, but the CSS was left in.
2022-11-06Rollup merge of #104014 - GuillaumeGomez:run-button-css-var, r=notriddleMatthias Krüger-30/+18
Migrate test-arrow to CSS variables There should be no UI changes. I kept both `color` and `background-color` properties even though only the ayu theme is actually completely making use of them on hover. r? ``@notriddle``
2022-11-06Rollup merge of #103990 - notriddle:notriddle/logo-container, r=GuillaumeGomezMatthias Krüger-7/+3
rustdoc: clean up `.logo-container` layout CSS This commit should result in no appearance changes. To make the logo container exactly the desired height, you want to get rid of the part of the box used for typographic descenders (you know, the part of g, y, and j that descends below the baseline). After all, it contains no text, but the space is still left open in the layout by default, because `<img>` is `display:inline`. The CSS used to employ three different tricks to accomplish this: * By making `.sidebar .logo-container` a flex container, the image becomes a flex item and is [blockified], without synthesizing any inline boxes. No inline boxes means no descenders. * By giving `.mobile-topbar .logo-container` a max-height exactly the same as the height of the image plus the padding, the descender area gets cut off. * By setting `.sub-logo-container { line-height: 0 }`, we ensure that the only box that contributes to the height of the line box is the image itself, and not any zero-content text boxes that neighbor it. See the [logical height algorithm]. This commit gets rid of the first two hacks, leaving only the third, since it requires only one line of code to accomplish and doesn't require setting the value based on math. [blockified]: https://drafts.csswg.org/css-flexbox-1/#flex-items [logical height algorithm]: https://www.w3.org/TR/css-inline-3/#inline-height
2022-11-05rustdoc: print usize with less string manipulationMichael Howell-12/+6
2022-11-05Rollup merge of #103988 - GuillaumeGomez:fix-bottom-border-color, r=notriddleMatthias Krüger-1/+4
Fix search result bottom border color It reverts a color change while keeping the improvement made in #103938. I think it'll need to be backported once merged too. r? `@notriddle`
2022-11-05Rollup merge of #101702 - jsha:static-files2, r=notriddle,GuillaumeGomezMatthias Krüger-496/+265
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-05Migrate test-arrow to CSS variablesGuillaume Gomez-30/+18
2022-11-05rustdoc: use `ThinVec` and `Box<str>` to shrink `clean::ItemKind`Michael Howell-16/+16
2022-11-05Fix search result bottom border colorGuillaume Gomez-1/+4
2022-11-05Rollup merge of #103621 - fee1-dead-contrib:iat-fix-use, r=cjgillotDylan DPC-1/+2
Correctly resolve Inherent Associated Types I don't know if this is the best way to do this, but at least it is one way.
2022-11-04rustdoc: clean up `.logo-container` layout CSSMichael Howell-7/+3
This commit should result in no appearance changes. To make the logo container exactly the desired height, you want to get rid of the part of the box used for typographic descenders (you know, the part of g, y, and j that descends below the baseline). After all, it contains no text, but the space is still left open in the layout by default, because `<img>` is `display:inline`. The CSS used to employ three different tricks to accomplish this: * By making `.sidebar .logo-container` a flex container, the image becomes a flex item and is [blockified], without synthesizing any inline boxes. No inline boxes means no descenders. * By giving `.mobile-topbar .logo-container` a max-height exactly the same as the height of the image plus the padding, the descender area gets cut off. * By setting `.sub-logo-container { line-height: 0 }`, we ensure that the only box that contributes to the height of the line box is the image itself, and not any zero-content text boxes that neighbor it. See the [logical height algorithm]. This commit gets rid of the first two hacks, leaving only the third, since it requires only one line of code to accomplish and doesn't require setting the value based on math. [blockified]: https://drafts.csswg.org/css-flexbox-1/#flex-items [logical height algorithm]: https://www.w3.org/TR/css-inline-3/#inline-height
2022-11-04rustdoc: get rid of CSS/DOM `div.desc span`, which isn't really neededMichael Howell-11/+8
2022-11-04rustdoc: simplify search results CSS and DOMMichael Howell-18/+8
There is a layout change caused by this commit, but it's subtle. You won't notice it unless you're looking for it.
2022-11-04rustdoc: create helper `GenericParamDef::lifetime`León Orell Valerian Liehr-28/+13
2022-11-04rustdoc: add test for cross-crate trait-object typesLeón Orell Valerian Liehr-0/+3
as well as some FIXMEs
2022-11-04rustdoc: render the return type of cross-crate `Fn`-family trait bounds in ↵León Orell Valerian Liehr-7/+7
trait-object types
2022-11-04rustdoc: render `for<>` param lists of cross-crate trait-object typesLeón Orell Valerian Liehr-2/+19
2022-11-04rustdoc: move cross-crate lifetime/outlives bounds on GAT params from ↵León Orell Valerian Liehr-1/+10
where-clause to param declaration site I've overlooked this in #103190.
2022-11-04rustdoc: render unnamed arguments as underscores in cross-crate functions & ↵León Orell Valerian Liehr-14/+17
function pointers for consistency with the way we display local definitions (cleaned from HIR, not from rustc_middle).
2022-11-04rustdoc: render late-bound lifetimes in generic parameter list of ↵León Orell Valerian Liehr-7/+34
cross-crate functions and methods
2022-11-04Rollup merge of #103935 - GuillaumeGomez:remove-rustdoc-visibility-ty, ↵Matthias Krüger-153/+129
r=notriddle Remove rustdoc clean::Visibility type Fixes #90852. Follow-up of https://github.com/rust-lang/rust/pull/103690. This PR completely removes the rustdoc `clean::Visibility` type to use the `rustc_middle` one instead. I don't think there will be any impact on perf. r? `@notriddle`
2022-11-04Auto merge of #103954 - matthiaskrgr:rollup-tskpxnj, r=matthiaskrgrbors-21/+21
Rollup of 10 pull requests Successful merges: - #103825 (Remove let_underscore_must_use from list of uplifted lints) - #103884 (Add visit_fn_ret_ty to hir intravisit) - #103892 (Properly render asyncness for trait fns without default body) - #103905 (rustdoc: remove redundant mobile CSS `.sidebar-elems { background }`) - #103912 (Add howto for adding new targets) - #103915 (Improve use of ErrorGuaranteed and code cleanup) - #103930 (Move some tests from `src/test/ui` to more reasonable places) - #103931 (Add note to RELEASES.md regarding issue 102754.) - #103938 (rustdoc: clean up hardcoded CSS border color on search results) - #103940 (rustdoc: remove no-op CSS `#main-content > .item-info { margin-top: 0 }`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-04Rollup merge of #103940 - ↵Matthias Krüger-1/+0
notriddle:notriddle/main-content-item-info-margin-top, r=GuillaumeGomez rustdoc: remove no-op CSS `#main-content > .item-info { margin-top: 0 }` When this line was added in 04b4c40682c01cad8f9bc8d5b3907be91d6f81d4, it overrode a negative `margin-top` that was set on it by default. https://github.com/rust-lang/rust/blob/04b4c40682c01cad8f9bc8d5b3907be91d6f81d4/src/librustdoc/html/static/rustdoc.css#L500-L516 That negative top margin was removed in 593d6d1cb15c55c88319470dabb40126c7b7f1e2.
2022-11-04Rollup merge of #103938 - notriddle:notriddle/search-results-border-bottom, ↵Matthias Krüger-2/+1
r=GuillaumeGomez rustdoc: clean up hardcoded CSS border color on search results Hardcoded colors in rustdoc.css should usually be avoided. Preview: http://notriddle.com/notriddle-rustdoc-demos/border-bottom-search/test_dingus/?search=test
2022-11-04Rollup merge of #103905 - notriddle:notriddle/sidebar-elems-background, ↵Matthias Krüger-1/+0
r=GuillaumeGomez rustdoc: remove redundant mobile CSS `.sidebar-elems { background }` The exact same background is already set for its parent, the `nav.sidebar`.
2022-11-04Rollup merge of #103892 - compiler-errors:afit-rustdoc, r=GuillaumeGomezMatthias Krüger-17/+20
Properly render asyncness for trait fns without default body We weren't properly desugaring async fns in traits unless they had default bodies (in which case rustdoc treats them much like they came from an impl). cc ```@yoshuawuyts``` should help with https://rust-lang.zulipchat.com/#narrow/stream/330606-wg-async.2Fasync-fn-in-trait-impl/topic/type.20inside.20.60async.20fn.60.20body.20must.20be.20known.20in.20this.20context/near/306894869
2022-11-04Auto merge of #102928 - notriddle:notriddle/rustdoc-thin-vec, r=GuillaumeGomezbors-65/+62
rustdoc: use ThinVec for cleaned generics Depends on https://github.com/Gankra/thin-vec/pull/38
2022-11-03rustdoc: remove no-op CSS `#main-content > .item-info { margin-top: 0 }`Michael Howell-1/+0
When this line was added in 04b4c40682c01cad8f9bc8d5b3907be91d6f81d4, it overrode a negative `margin-top` that was set on it by default. https://github.com/rust-lang/rust/blob/04b4c40682c01cad8f9bc8d5b3907be91d6f81d4/src/librustdoc/html/static/rustdoc.css#L500-L516 That negative top margin was removed in 593d6d1cb15c55c88319470dabb40126c7b7f1e2.
2022-11-03rustdoc: clean up hardcoded CSS border color on search resultsMichael Howell-2/+1
Hardcoded colors in rustdoc.css should usually be avoided.