about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2022-06-28Remove unused CSS rulesGuillaume Gomez-17/+0
2022-06-27Add comments, fixes for `0` sentinelMichael Howell-5/+36
2022-06-27Update src/librustdoc/html/static/js/externs.jsMichael Howell-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-06-27Put back, fix ()-output optimizationMichael Howell-1/+2
2022-06-27Add documentationMichael Howell-1/+87
2022-06-26Rollup merge of #98297 - GuillaumeGomez:help-pocket-menu, r=notriddleMatthias Krüger-169/+174
Transform help popup into a pocket menu Just like we moved the settings menu into a "pocket menu", it's doing the same to the help popup. You can test it [here](https://rustdoc.crud.net/imperio/help-pocket-menu/doc/foo/index.html) and here is a screenshot: ![Screenshot from 2022-06-20 20-58-29](https://user-images.githubusercontent.com/3050060/174663718-538e9d11-3bf9-48b2-8909-f9bfe75af135.png) r? ``````````@jsha``````````
2022-06-25Fix CSS rule for selected and hovered items in the source sidebarGuillaume Gomez-6/+6
2022-06-24Fix rustdoc under `#[no_core]`Michael Howell-28/+32
2022-06-24rustdoc: reference function signature types from the `p` arrayMichael Howell-123/+242
This reduces the size of the function signature index, because it's common to have many functions that operate on the same types. $ wc -c search-index-old.js search-index-new.js 5224374 search-index-old.js 3932314 search-index-new.js By my math, this reduces the uncompressed size of the search index by 32%. On compressed signatures, the wins are less drastic, a mere 8%: $ wc -c search-index-old.js.gz search-index-new.js.gz 404532 search-index-old.js.gz 371635 search-index-new.js.gz
2022-06-24Rollup merge of #91264 - GuillaumeGomez:macro-jump-to-def, r=jshaYuki Okushi-51/+229
Add macro support in jump to definition feature Fixes #91174. To do so, I check if the span comes from an expansion, and if so, I infer the original macro `DefId` or `Span` depending if it's a defined in the current crate or not. There is one limitation due to macro expansion though: ```rust macro_rules! yolo { () => {}} fn foo() { yolo!(); } ``` In `foo`, `yolo!` won't be linked because after expansion, it is replaced by nothing (which seems logical). So I can't get an item from the `Visitor` from which I could tell if its `Span` comes from an expansion. I added a test for this specific limitation alongside others. Demo: https://rustdoc.crud.net/imperio/macro-jump-to-def/src/foo/check-source-code-urls-to-def-std.rs.html As for the empty macro issue that cannot create a jump to definition, you can see it [here](https://rustdoc.crud.net/imperio/macro-jump-to-def/src/foo/check-source-code-urls-to-def-std.rs.html#35). r? ```@jyn514```
2022-06-23Rollup merge of #98310 - jsha:defer-source-sidebar, r=GuillaumeGomezMichael Goulet-20/+36
rustdoc: optimize loading of source sidebar The source sidebar has a setting to remember whether it should be open or closed. Previously, this setting was handled in source-script.js, which is loaded with `defer`, meaning it is often run after the document is rendered. Since CSS renders the source sidebar as closed by default, changing this after the initial render results in a relayout. Instead, handle the setting in storage.js, which is the first script to load and is the only script that blocks render. This avoids a relayout and means navigating between files with the sidebar open is faster. Demo: https://rustdoc.crud.net/jsha/defer-source-sidebar/src/alloc/ffi/c_str.rs.html r? ````@GuillaumeGomez````
2022-06-23Don't test the rustdoc rendering context size on Windows.Dan Gohman-1/+1
This assert is just making sure the size of `Context` doens't grow unexpectedly, and it's already not being checked on every platform. `PathBuf` now has a different size on Windows, so adjust this to avoid checking the size on Windows.
2022-06-23Merge all popover hide functions into oneGuillaume Gomez-27/+18
2022-06-23Move help popup into a pocket menu as wellGuillaume Gomez-159/+173
2022-06-20rustdoc: optimize loading of source sidebarJacob Hoffman-Andrews-20/+36
The source sidebar has a setting to remember whether it should be open or closed. Previously, this setting was handled in source-script.js, which is loaded with `defer`, meaning it is often run after the document is rendered. Since CSS renders the source sidebar as closed by default, changing this after the initial render results in a relayout. Instead, handle the setting in storage.js, which is the first script to load and is the only script that blocks render. This avoids a relayout and means navigating between files with the sidebar open is faster.
2022-06-20Fix panic by checking if `CStore` has the crate data we want before actually ↵Guillaume Gomez-6/+14
querying it
2022-06-20Integrate `generate_macro_def_id_path` into `href_with_root_path`Guillaume Gomez-68/+72
2022-06-20Improve code readability and documentationGuillaume Gomez-54/+94
2022-06-20Improve loading of crates.js and sidebar-items.jsJacob Hoffman-Andrews-136/+86
Now that the "All Crates" dropdown is only rendered on the search results page, there is no need to load crates.js on most pages. Load it only on crate pages. Also, add the `defer` attribute so it does not block page rendering. For sidebar-items.js, move the script tag to `<head>`. Since it already has the defer attribute it won't block loading. The defer attribute does preserve ordering between scripts, so instead of the callback on load, it can set a global variable on load, which is slightly simpler. Also, since it is required to finish rendering the page, beginning its load earlier is better. Remove generation and handling of sidebar-vars. Everything there can be computed with information available in JS via other means. Remove the "other" wrapper in the sidebar. It was unnecessary. Remove excess script fields
2022-06-20Rename ContextInfo into HrefContextGuillaume Gomez-26/+26
2022-06-20Add support for macro in "jump to def" featureGuillaume Gomez-36/+162
2022-06-19Rollup merge of #98105 - notriddle:notriddle/tuple-links, r=jshaDylan DPC-10/+34
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-19Rollup merge of #98230 - GuillaumeGomez:weird-js-condition, r=notriddleMatthias Krüger-4/+1
Fix weird js condition While going around the code, I found this weird condition. Fixing also affects the generated results in some cases apparently (could only find this one). Any idea maybe `@notriddle?` r? `@notriddle`
2022-06-19Rollup merge of #98229 - GuillaumeGomez:eslint-checks, r=Dylan-DPCMatthias Krüger-0/+2
Add new eslint checks r? ```@Dylan-DPC```
2022-06-19Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-seMatthias Krüger-1/+1
once cell renamings This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128 - Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}` - Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}` (I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc) ```@rustbot``` label +T-libs-api -T-libs
2022-06-18Remove weird JS conditionGuillaume Gomez-4/+1
2022-06-18Adding new eslint checks:Guillaume Gomez-0/+2
* no-sequences * no-throw-literal
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-1/+1
2022-06-16Auto merge of #97842 - notriddle:notriddle/tuple-docs, r=jsha,GuillaumeGomezbors-3/+19
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-16Rollup merge of #98092 - GuillaumeGomez:fix-sidebar-items-expand-collapse, ↵Yuki Okushi-3/+3
r=notriddle Fix sidebar items expand collapse The collapse/expand event was not working for the items in the source code viewer sidebar (talking about these items: ![Screenshot from 2022-06-14 11-21-58](https://user-images.githubusercontent.com/3050060/173543346-af056928-e921-458f-b918-60f6fd0ecbde.png) ). This PR fixes it and adds a GUI test to prevent another regression. r? ```@notriddle```
2022-06-14rustdoc: change "variadic tuple" notation to look less like real syntaxMichael Howell-1/+1
2022-06-14rustdoc: remove tuple link on round bracesMichael Howell-10/+34
This is 682889fb06591c4245422b73b005c5d8ae2d0cad but for tuples. The reasoning is the same: * This commit 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.
2022-06-14Fix expand/collapse on source viewer sidebar foldersGuillaume Gomez-3/+3
2022-06-13rustdoc: remove link on slice bracketsMichael Howell-27/+2
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/+2
2022-06-11Fix incorrectly spelled "variadic"Michael Howell-1/+1
2022-06-11Add eslint rule "no-script-url"Guillaume Gomez-0/+1
2022-06-11Add eslint rule "no-return-assign"Guillaume Gomez-0/+1
2022-06-11Add eslint rule "no-multi-assign"Guillaume Gomez-0/+1
2022-06-11Add eslint rule "no-mixed-operator"Guillaume Gomez-0/+1
2022-06-11Add eslint rule "no-lonely-if"Guillaume Gomez-0/+1
2022-06-09Auto merge of #97772 - GuillaumeGomez:minifier-update, r=notriddlebors-4/+6
Update minifier version to 0.2.1 This change and these changes come from an idea of `@camelid:` instead of creating a string, we just `write` the type into the file directly. I don't think it'll have a big impact on perf but it's still a potential small improvement. r? `@notriddle`
2022-06-08rustdoc: show tuple impls as `impl Trait for (T, ...)`Michael Howell-3/+17
This commit adds a new unstable attribute, `#[doc(tuple_varadic)]`, that shows a 1-tuple as `(T, ...)` instead of just `(T,)`, and links to a section in the tuple primitive docs that talks about these.
2022-06-07Update minifier version to 0.2.1Guillaume Gomez-4/+6
2022-06-07Rollup merge of #97792 - GuillaumeGomez:eslint-checks, r=Dylan-DPCMatthias Krüger-1/+7
More eslint checks Here is the list of newly added eslint checks: * [no-confusing-arrow](https://eslint.org/docs/rules/no-confusing-arrow) * [no-div-regex](https://eslint.org/docs/rules/no-div-regex) * [no-floating-decimal](https://eslint.org/docs/rules/no-floating-decimal) * [no-implicit-globals](https://eslint.org/docs/rules/no-implicit-globals) * [no-implied-eval](https://eslint.org/docs/rules/no-implied-eval) * [no-label-var](https://eslint.org/docs/rules/no-label-var) Since you already reviewed the previous ones: r? `@Dylan-DPC`
2022-06-06Add "no-label-var" eslint checkGuillaume Gomez-0/+1
2022-06-06Add "no-implied-eval" eslint checkGuillaume Gomez-0/+1
2022-06-06Add "no-implicit-globals" eslint checkGuillaume Gomez-0/+1
2022-06-06Add "no-floating-decimal" eslint checkGuillaume Gomez-0/+1
2022-06-06Add "no-div-regex" eslint checkGuillaume Gomez-0/+1