about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2023-01-20Rollup merge of #107131 - ↵Michael Goulet-6/+1
notriddle:notriddle/rustdoc-radio-display-inline-flex, r=GuillaumeGomez rustdoc: use CSS inline layout for radio line instead of flexbox This uses less code to lay them out the same way. Already tested here: https://github.com/rust-lang/rust/blob/5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14/tests/rustdoc-gui/settings.goml#L123
2023-01-20Rollup merge of #107095 - notriddle:notriddle/sidebar-current, r=GuillaumeGomezMichael Goulet-1/+1
rustdoc: remove redundant CSS selector `.sidebar .current` Since the current sidebar item is already a link, it doesn't do anything.
2023-01-20rustdoc: use CSS inline layout for radio line instead of flexboxMichael Howell-6/+1
This uses less code to lay them out the same way.
2023-01-19rustdoc: remove redundant CSS selector `.sidebar .current`Michael Howell-1/+1
Since the current sidebar item is already a link, it doesn't do anything.
2023-01-19Revert "Fix missing const expression items visit"Guillaume Gomez-158/+115
This reverts commit cdfc5051b1286938f56160243c28538f79dce6b1.
2023-01-19Revert "Improve code readability"Guillaume Gomez-23/+15
This reverts commit eb93d1bedeab64c6f5d661df6a309a5b8a9273ca.
2023-01-19Revert "Speed up execution a bit by removing some walks"Guillaume Gomez-21/+2
This reverts commit a9d582f51f547583380f2f2894ae0c799b609a86.
2023-01-19Revert "Improve code"Guillaume Gomez-90/+93
This reverts commit a954d6334d000225ae38f65f5f9e9c182e6764ae.
2023-01-19Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkovbors-4/+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-18Rollup merge of #107045 - notriddle:notriddle/settings-css-setting-line, ↵Michael Goulet-5/+1
r=GuillaumeGomez rustdoc: remove redundant CSS rule `#settings .setting-line` Since the current version of settings.js always nests things below a div with ID `settings`, this rule always overrode the one above.
2023-01-18Rollup merge of #107042 - notriddle:notriddle/rustdoc-js-question, ↵Michael Goulet-1/+5
r=GuillaumeGomez rustdoc: fix corner cases with "?" JS keyboard command
2023-01-18Rollup merge of #105796 - ↵Michael Goulet-50/+64
notriddle:notriddle/rustdoc-search-stop-doing-demerits, r=GuillaumeGomez rustdoc: simplify JS search routine by not messing with lev distance Since the sorting function accounts for an `index` field, there's not much reason to also be applying changes to the levenshtein distance. Instead, we can just not treat `lev` as a filter if there's already a non-sentinel value for `index`. <details> This change gives slightly more weight to the index and path part, as search criteria, than it used to. This changes some of the test cases, but not in any obviously-"worse" way, and, in particular, substring matches are a bigger deal than levenshtein distances (we're assuming that a typo is less likely than someone just not typing the entire name). The biggest change is the addition of a `path_lev` field to result items. It's always zero if the search query has no parent path part and for type queries, making the check in the `sortResults` function a no-op. When it's present, it is used to implement different precedence for the parent path and the tail. Consider the query `hashset::insert`, a test case [that already exists and can be found here](https://github.com/rust-lang/rust/blob/5c6a1681a9a7b815febdd9de2f840da338984e68/src/test/rustdoc-js-std/path-ordering.js). We want the ordering shown in the test case: ``` { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' }, { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' }, ``` We do not want this ordering, which is the ordering that would occur if substring position took priority over `path_lev`: ``` { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' }, { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' }, // BAD { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' }, ``` We also do not want `HashSet::iter` to appear before `HashMap::insert`, which is what would happen if `path_lev` took priority over the appearance of any substring match. This is why the `sortResults` function has `path_lev` sandwiched between a `index < 0` check and a `index` comparison check: ``` { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'iter' }, // BAD { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' }, ``` The old code implemented a similar feature by manipulating the `lev` member based on whether a substring match was found and averaging in the path distance (`item.lev = name_lev + path_lev / 10`), so the path lev wound up acting like a tie breaker, but it gives slightly different results for `Vec::new`, [changing the test case](https://github.com/rust-lang/rust/pull/105796/files#diff-b346e2ef72a407915f438063c8c2c04f7a621df98923d441b41c0312211a5b21) because of the slight changes to ordering priority. </details> Based on https://github.com/rust-lang/rust/pull/103710#issuecomment-1296894296 Previews: * https://notriddle.com/notriddle-rustdoc-demos/rustdoc-search-stop-doing-demerits/std/index.html * https://notriddle.com/notriddle-rustdoc-demos/rustdoc-search-stop-doing-demerits-compiler/index.html
2023-01-18rustdoc: remove redundant rule `#settings .setting-line`Michael Howell-5/+1
Since the current version of settings.js always nests things below a div with ID `settings`, this rule always overrode the one above.
2023-01-18rustdoc: fix "?" keyboard command when radio button is focusedMichael Howell-1/+2
This extends the special case with checkbox settings to also cover radios.
2023-01-18rustdoc: put focus on the help link when opening it from keyboardMichael Howell-0/+3
This prevents some strange blur-event-related bugs with the "?" command by ensuring that the focus remains in the same spot when the settings area closes.
2023-01-18Rollup merge of #107014 - notriddle:notriddle/js-cleanup, r=GuillaumeGomezDylan DPC-9/+4
rustdoc: remove deprecated / unused code from main.js
2023-01-18Auto merge of #107021 - matthiaskrgr:rollup-0dzxfyi, r=matthiaskrgrbors-5/+1
Rollup of 7 pull requests Successful merges: - #106244 (Improve Markdown styling in README) - #106747 (Add 'static lifetime suggestion when GAT implied 'static requirement from HRTB) - #106873 (dont randomly use `_` to print out const generic arguments) - #106992 (Remove unused `#![feature(box_syntax)]` in `alloc`) - #106995 (bump failing assembly & codegen tests from LLVM 14 to LLVM 15) - #106996 (rustdoc: instead of `.setting-name { width: 100% }`, use default div CSS) - #106997 (Add heapsort fallback in `select_nth_unstable`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-18Auto merge of #106952 - petrochenkov:docglob, r=notriddle,GuillaumeGomezbors-4/+21
rustdoc: Fix glob import inlining Filter away names that are not actually imported by the glob, e.g. because they are shadowed by something else. Fixes the issue found in https://github.com/rust-lang/rust/pull/94857#issuecomment-1382912356.
2023-01-17rustdoc: stop using deprecated `window.event` when there's an `ev` paramMichael Howell-1/+1
2023-01-17rustdoc: remove function `handleClick` that's only used onceMichael Howell-8/+3
2023-01-17rustdoc: instead of `.setting-name { width: 100% }`, use default div CSSMichael Howell-5/+1
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-17rustdoc: Fix glob import inliningVadim Petrochenkov-4/+21
Filter away names that are not actually imported by the glob, e.g. because they are shadowed by something else
2023-01-16Move compiler input and ouput paths into sessionOli Scherer-1/+1
2023-01-16Remove redundant `input_path` field from `Config`Oli Scherer-3/+0
2023-01-15rustdoc: simplify some & ref erencesMatthias Krüger-14/+12
2023-01-14Auto merge of #106866 - matthiaskrgr:rollup-r063s44, r=matthiaskrgrbors-32/+41
Rollup of 8 pull requests Successful merges: - #105526 (libcore: make result of iter::from_generator Clone) - #106563 (Fix `unused_braces` on generic const expr macro call) - #106661 (Stop probing for statx unless necessary) - #106820 (Deprioritize fulfillment errors that come from expansions.) - #106828 (rustdoc: remove `docblock` class from notable trait popover) - #106849 (Allocate one less vec while parsing arrays) - #106855 (rustdoc: few small cleanups) - #106860 (Remove various double spaces in the libraries.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-14rustdoc: simplify JS search routine by not messing with lev distanceMichael Howell-50/+64
Since the sorting function accounts for an `index` field, there's not much reason to also be applying changes to the levenshtein distance. Instead, we can just not treat `lev` as a filter if there's already a non-sentinel value for `index`. This change gives slightly more weight to the index and path part, as search criteria, than it used to. This changes some of the test cases, but not in any obviously-"worse" way, and, in particular, substring matches are a bigger deal than levenshtein distances (we're assuming that a typo is less likely than someone just not typing the entire name). Based on https://github.com/rust-lang/rust/pull/103710#issuecomment-1296894296
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-28/+33
rustdoc: few small cleanups
2023-01-14Rollup merge of #106828 - notriddle:notriddle/notable-trait-docblock, ↵Matthias Krüger-4/+8
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-14Auto merge of #106696 - kylematsuda:early-binder, r=lcnrbors-4/+6
Switch to `EarlyBinder` for `const_param_default` and `impl_trait_ref` queries Part of the work to close #105779 and implement https://github.com/rust-lang/types-team/issues/78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This PR adds `EarlyBinder` to the return type of `const_param_default` and `impl_trait_ref`, and removes their `bound_X` variants. r? `@lcnr`
2023-01-14fix various subst_identity vs skip_binderKyle Matsuda-1/+1
2023-01-14change impl_trait_ref query to return EarlyBinder; remove ↵Kyle Matsuda-4/+4
bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata
2023-01-14change usages of impl_trait_ref to bound_impl_trait_refKyle Matsuda-4/+4
2023-01-14change const_param_default query to return EarlyBinder; remove ↵Kyle Matsuda-1/+1
bound_const_param_default query; add EarlyBinder to const_param_default in metadata
2023-01-14change usages of const_param_default query to bound_const_param_defaultKyle Matsuda-1/+3
2023-01-14Rollup merge of #106819 - notriddle:notriddle/rm-h1-fqn, r=GuillaumeGomezYuki Okushi-8/+8
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-14Rollup merge of #106766 - GuillaumeGomez:rm-stripper-dead-code, r=notriddleYuki Okushi-11/+1
Remove dead code in rustdoc stripper No changes when this code is removed. cc `@aDotInTheVoid` r? `@notriddle`
2023-01-14Rollup merge of #106693 - notriddle:notriddle/toggle-trunc, r=GuillaumeGomezYuki Okushi-56/+56
rustdoc: rename CSS rustdoc-toggle -> toggle and toggle -> settings-toggle This swaps things around so that the class that gets used more often has the shorter name.
2023-01-13rustdoc: remove `docblock` class from notable trait popoverMichael Howell-4/+8
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-56/+56
This swaps things around so that the class that gets used more often has the shorter name.
2023-01-13Rollup merge of #106813 - oli-obk:sess_cleanup, r=GuillaumeGomez,petrochenkovMatthias Krüger-14/+11
Remove redundant session field There was already a session available in the resolver, so we access that session.
2023-01-13rustdoc: remove unnecessary DOM class `h1.fqn`Michael Howell-8/+8
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-13Remove redundant session fieldOli Scherer-14/+11
2023-01-13CrateData: don't allocate String when Serialize, &str is enoughklensy-1/+1
2023-01-13Playground.crate_name String -> Symbolklensy-6/+5
2023-01-13fmt_type: don't alloc const String, use &str insteadklensy-1/+1
2023-01-13generate_macro_def_id_path: don't eagerly stringify Symbolsklensy-7/+12
2023-01-13Auto merge of #106776 - oli-obk:om_nom_nom_nom_nom, r=cjgillotbors-1/+1
Feed a bunch of queries instead of tracking fields on TyCtxt r? `@cjgillot` pulled out of https://github.com/rust-lang/rust/pull/105462