about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2023-04-16Auto merge of #110405 - fee1-dead-contrib:rollup-9rkree6, r=fee1-deadbors-1/+1
Rollup of 4 pull requests Successful merges: - #110397 (Move some utils out of `rustc_const_eval`) - #110398 (use matches! macro in more places) - #110400 (more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_defau…) - #110402 (Remove the loop in `Align::from_bytes`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-16fix clippy::toplevel_ref_arg and ::manual_mapMatthias Krüger-4/+3
2023-04-16Rollup merge of #110345 - nnethercote:rm-Super-impls-for-Region, ↵fee1-dead-6/+5
r=compiler-errors Remove `TypeSuper{Foldable,Visitable}` impls for `Region`. These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial. This commit inlines and removes those trivial methods. r? `@compiler-errors`
2023-04-16more clippy fixes: clippy::{iter_cloned_collect, unwarp_or_else_default, ↵Matthias Krüger-1/+1
option_map_or_none}
2023-04-16Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.Nicholas Nethercote-6/+5
These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial. This commit inlines and removes those trivial methods.
2023-04-15rustdoc: stop passing a title to `replaceState` second argumentMichael Howell-4/+2
As described on [MDN's replaceState page], this parameter is not currently used, and the empty string is "safe against future changes to the method." [MDN's replaceState page]: https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
2023-04-15fix clippy::{filter_map_identiy, map_identity, manual_flatten}Matthias Krüger-1/+1
2023-04-15Auto merge of #109802 - notriddle:notriddle/rustdoc-search-generics-nested, ↵bors-11/+10
r=GuillaumeGomez rustdoc-search: add support for nested generics This change allows `search.js` to parse nested generics (which look `Like<This<Example>>`) and match them. It maintains the existing "bag semantics", so that the order of type parameters is ignored but the number is required to be greater than or equal to what's in the query. For example, a function with the signature `fn read_all(&mut self: impl Read) -> Result<Vec<u8>, Error>` will match these queries: * `Read -> Result<Vec<u8>, Error>` * `Read -> Result<Error, Vec>` * `Read -> Result<Vec<u8>>` But it *does not* match `Result<Vec, u8>` or `Result<u8<Vec>>`.
2023-04-14rustdoc-search: add support for nested genericsMichael Howell-11/+10
2023-04-14Rollup merge of #110244 - kadiwa4:unnecessary_imports, r=JohnTitorMatthias Krüger-9/+2
Remove some unneeded imports / qualified paths Continuation of #105537.
2023-04-14Rollup merge of #110305 - notriddle:notriddle/es6-map-set, r=GuillaumeGomezYuki Okushi-58/+73
rustdoc-search: use ES6 `Map` and `Set` where they make sense Since all supported browsers now support these classes, and rustdoc has started using them in some places, it might as well use them everywhere it makes sense (because, as [MDN's Map page] says, it "performs better in scenarios involving frequent additions and removals of key-value pairs."). [MDN's Map page]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
2023-04-14Rollup merge of #103682 - Swatinem:stable-run-directory, r=GuillaumeGomezYuki Okushi-1/+1
Stabilize rustdoc `--test-run-directory` This should resolve https://github.com/rust-lang/rust/issues/84674
2023-04-14Rollup merge of #110279 - GuillaumeGomez:compiler-macro-derive, r=notriddleMatthias Krüger-40/+55
rustdoc: Correctly handle built-in compiler proc-macros as proc-macro and not macro Part of https://github.com/rust-lang/rust/issues/110111. There were actually one issue split in two parts: * Compiler built-in proc-macro were incorrectly considered as macros and not proc-macros. * Re-exports of compiler built-in proc-macros were considering them as macros. Both issues can be fixed by looking at the `MacroKind` variant instead of just relying on information extracted later on. r? ``@fmease``
2023-04-14Auto merge of #110160 - petrochenkov:notagain2, r=cjgillotbors-3/+3
resolve: Pre-compute non-reexport module children Instead of repeating the same logic by walking HIR during metadata encoding. The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises. `module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead.
2023-04-13rustdoc-search: use ES6 Map for `Result` instead of ObjectMichael Howell-21/+40
2023-04-13rustdoc-search: use ES6 `Set` for deduplication instead of `Object`Michael Howell-3/+3
2023-04-13rustdoc-search: use ES6 `Map` for generic matching instead of `Object`Michael Howell-23/+14
2023-04-13rustdoc-search: use ES6 `Map` for aliases instead of `Object`Michael Howell-11/+16
2023-04-13Correctly handle built-in compiler proc-macros as proc-macro and not macroGuillaume Gomez-40/+55
2023-04-13Rollup merge of #110072 - joshtriplett:stabilize-is-terminal, r=Mark-SimulacrumMatthias Krüger-1/+0
Stabilize IsTerminal FCP completed in https://github.com/rust-lang/rust/issues/98070 . closes: https://github.com/rust-lang/rust/issues/98070
2023-04-12Auto merge of #110252 - matthiaskrgr:rollup-ovaixra, r=matthiaskrgrbors-10/+4
Rollup of 8 pull requests Successful merges: - #109810 (Replace rustdoc-ui/{c,z}-help tests with a stable run-make test ) - #110035 (fix: ensure bad `#[test]` invocs retain correct AST) - #110089 (sync::mpsc: synchronize receiver disconnect with initialization) - #110103 (Report overflows gracefully with new solver) - #110122 (Fix x check --stage 1 when download-ci-llvm=false) - #110133 (Do not use ImplDerivedObligationCause for inherent impl method error reporting) - #110135 (Revert "Don't recover lifetimes/labels containing emojis as character literals") - #110235 (Fix `--extend-css` option) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-12Rollup merge of #110235 - GuillaumeGomez:fix-extend-css, r=notriddleMatthias Krüger-1/+1
Fix `--extend-css` option Fixes #110002. The file was generated in the wrong folder so I moved it into `static.files` as it made more sense to have there instead of changing the path in the templates. I also added a GUI test to ensure that this option won't break unexpectedly again.
2023-04-12Rollup merge of #109810 - jyn514:rustdoc-opt-tests, r=TaKO8KiMatthias Krüger-9/+3
Replace rustdoc-ui/{c,z}-help tests with a stable run-make test This make rustdoc resilient to changes in the debugging options while still testing that it matches rustc. Fixes https://github.com/rust-lang/rust/issues/109391.
2023-04-12Rollup merge of #110237 - oli-obk:impl_trait_in_assoc_tys, r=jackh726Matthias Krüger-0/+1
Split out a separate feature gate for impl trait in associated types in https://github.com/rust-lang/rust/issues/107645 it was decided that we'll take a new route for type alias impl trait. The exact route isn't clear yet, so while I'm working on implementing some of these proposed changes (e.g. in https://github.com/rust-lang/rust/pull/110010) to be able to experiment with them, I will also work on stabilizing another sugar version first: impl trait in associated types. Similarly I'll look into creating feature gates for impl trait in const/static types. This PR does nothing but split the feature gate, so that you need to enable a different feature gate for ```rust impl Trait for Type { type Assoc = impl SomeTrait; } ``` than what you need for `type Foo = impl SomeTrait;`
2023-04-12Rollup merge of #110205 - notriddle:notriddle/pixelated-border, r=GuillaumeGomezMatthias Krüger-1/+5
rustdoc: make settings radio and checks thicker, less contrast This is very dependent on subjectivity and what screen you use, but this change makes the radio buttons' outer circle less ugly. This is because I could see the pixels very clearly, thanks to the very thin line and high contrast. This change makes both less severe, giving your browser's antialiasing algorithm more to work with. Since it's thicker, lowering the contrast shouldn't impact visibility. ## Preview https://notriddle.com/rustdoc-demo-html-3/pixelated-border/settings.html ## Before ![image](https://user-images.githubusercontent.com/1593513/231274191-143acbea-c433-4fb1-b46d-e5e4fe328d60.png) ## After ![image](https://user-images.githubusercontent.com/1593513/231287415-c1e59fe8-8bf8-489d-b607-95ebb71e4ac5.png) <details><summary>Original "after" image with 2px border around checked box</summary> ![image](https://user-images.githubusercontent.com/1593513/231274253-8b5011c6-82fb-4396-84d0-47b6bdff2260.png) </details>
2023-04-12Move creation of `theme.css` file from `--extend-css` command into the ↵Guillaume Gomez-1/+1
`static.files` folder
2023-04-12rustdoc: use CSS `overscroll-behavior` instead of JavaScriptMichael Howell-56/+8
Fixes the desktop scrolling weirdness mentioned in https://github.com/rust-lang/rust/pull/98775#issuecomment-1182575603 As described in the MDN page for this property: * The current Firefox ESR is 102, and the first Firefox version to support this feature is 59. * The current Chrome version 112, and the first version to support this is 63. * Edge is described as having a minor bug in `none` mode, but we use `contain` mode anyway, so it doesn't matter. * Safari 16, released September 2022, is the last browser to add this feature, and is also the oldest version we officially support.
2023-04-12remove some unneeded importsKaDiWa-9/+2
2023-04-12Split out a separate feature gate for impl trait in associated typesOli Scherer-0/+1
2023-04-12rustdoc: make settings radio and checks thicker, less contrastMichael Howell-1/+5
This is very dependent on subjectivity and what screen you use, but this change makes the radio buttons' outer circle less ugly. This is because I could see the pixels very clearly, thanks to the very thin line and high contrast. This change makes both less severe, giving your browser's antialiasing algorithm more to work with. Since it's thicker, lowering the contrast shouldn't impact visibility.
2023-04-12resolve: Pre-compute non-reexport module childrenVadim Petrochenkov-3/+3
Instead of repeating the same logic by walking HIR during metadata encoding. The only difference is that we are no longer encoding `macro_rules` items, but we never currently need them as a part of this list. They can be encoded separately if this need ever arises. `module_reexports` is also un-querified, because I don't see any reasons to make it a query, only overhead.
2023-04-12Make rustdoc and rustc's help match exactlyJynn Nelson-9/+3
Before, rustdoc was missing `-C passes=list` and the "Available options" header. Making these match allows testing that they match exactly.
2023-04-11Rollup merge of #110162 - notriddle:notriddle/main-js-expand, r=GuillaumeGomezMichael Goulet-14/+5
rustdoc: remove redundant expandSection code from main.js This functionality is already tested in `hash-item-expansion.goml`, and was implemented twice: * First, in code that ran at load time and at hash change: 917cdd295d2eed213c135d6f984c650f016ee3d6 * Later, the hash change event handler was itself run at load time, and the code handling both cases diverged in implementation, though their behavior still matches pretty well: f66a331335f3ac931afabca6f927a9d7dc17db3e
2023-04-11Rollup merge of #110155 - DaniPopes:rest-typos, r=jyn514Michael Goulet-5/+6
Fix typos in librustdoc, tools and config files I used [`typos`](https://github.com/crate-ci/typos) to fix all typos, minus the ones present in #110153 and in #110154. Refs #110150
2023-04-11Rollup merge of #96971 - zhaixiaojuan:master, r=wesleywiserMichael Goulet-0/+1
Initial support for loongarch64-unknown-linux-gnu Hi, We hope to add a new port in rust for LoongArch. LoongArch intro LoongArch is a RISC style ISA which is independently designed by Loongson Technology in China. It is divided into two versions, the 32-bit version (LA32) and the 64-bit version (LA64). LA64 applications have application-level backward binary compatibility with LA32 applications. LoongArch is composed of a basic part (Loongson Base) and an expanded part. The expansion part includes Loongson Binary Translation (LBT), Loongson VirtualiZation (LVZ), Loongson SIMD EXtension (LSX) and Loongson Advanced SIMD EXtension(LASX). Currently the LA464 processor core supports LoongArch ISA and the Loongson 3A5000 processor integrates 4 64-bit LA464 cores. LA464 is a four-issue 64-bit high-performance processor core. It can be used as a single core for high-end embedded and desktop applications, or as a basic processor core to form an on-chip multi-core system for server and high-performance machine applications. Documentations: ISA: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html ABI: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html More docs can be found at: https://loongson.github.io/LoongArch-Documentation/README-EN.html Since last year, we have locally adapted two versions of rust, rust1.41 and rust1.57, and completed the test locally. I'm not sure if I'm submitting all the patches at once, so I split up the patches and here's one of the commits
2023-04-11Auto merge of #109765 - petrochenkov:encodeless, r=cjgillotbors-1/+1
rustc_metadata: Filter encoded data more aggressively using `DefKind` I focused on data that contains spans, because spans are expensive to encode/decode/hash, but also touched `should_encode_visibility` too. One incorrect use of impl visibility in diagnostics is also replaced with trait visibility.
2023-04-10rustdoc: remove redundant expandSection code from main.jsMichael Howell-14/+5
This functionality is already tested in `hash-item-expansion.goml`, and was implemented twice: * First, in code that ran at load time and at hash change: 917cdd295d2eed213c135d6f984c650f016ee3d6 * Later, the hash change event handler was itself run at load time, and the code handling both cases diverged in implementation, though their behavior still matches pretty well: f66a331335f3ac931afabca6f927a9d7dc17db3e
2023-04-10Fix typos in librustdocDaniPopes-6/+7
2023-04-10fix(doc): do not parse inline when output is json for external cratebohan-2/+3
2023-04-10rustc_metadata: Filter encoded data more aggressively using `DefKind`Vadim Petrochenkov-1/+1
2023-04-10Stabilize IsTerminalJosh Triplett-1/+0
closes: https://github.com/rust-lang/rust/issues/98070
2023-04-09Auto merge of #109500 - petrochenkov:modchainld, r=oli-obkbors-150/+36
resolve: Preserve reexport chains in `ModChild`ren This may be potentially useful for - avoiding uses of `hir::ItemKind::Use` (which usually lead to correctness issues) - preserving documentation comments on all reexports, including those from other crates - preserving and checking stability/deprecation info on reexports - all kinds of diagnostics The second commit then migrates some hacky logic from rustdoc to `module_reexports` to make it simpler and more correct. Ideally rustdoc should use `module_reexports` immediately at the top level, so `hir::ItemKind::Use`s are never used. The second commit also fixes issues with https://github.com/rust-lang/rust/pull/109330 and therefore Fixes https://github.com/rust-lang/rust/issues/109631 Fixes https://github.com/rust-lang/rust/issues/109614 Fixes https://github.com/rust-lang/rust/issues/109424
2023-04-08rustdoc: migrate `document_type_layout` to askamaMichael Howell-99/+112
2023-04-08Auto merge of #109925 - notriddle:notriddle/item-union, r=GuillaumeGomezbors-476/+595
rustdoc: migrate item_union to an Askama template
2023-04-08rustc_middle: Remove `Option` from `module_reexports` queryVadim Petrochenkov-3/+2
2023-04-08rustdoc: Migrate some logic to `module_reexports`Vadim Petrochenkov-147/+34
2023-04-08resolve: Preserve reexport chains in `ModChild`renVadim Petrochenkov-1/+1
This may be potentially useful for - avoiding uses of `hir::ItemKind::Use` - preserving documentation comments on all reexports - preserving and checking stability/deprecation info on reexports - all kinds of diagnostics
2023-04-08Rollup merge of #110037 - notriddle:notriddle/theme-default, r=GuillaumeGomezNilstrieb-0/+1
rustdoc: add test and bug fix for theme defaults Part of https://github.com/rust-lang/rust/issues/66181
2023-04-06rustdoc: add test and bug fix for theme defaultsMichael Howell-0/+1
2023-04-06rustdoc: clean up JSMichael Howell-28/+9
* Stop checking `func` in `onEach`. It's always hard-coded right at the call site, so there's no point. * Use the ternary operator in a few spots where it makes sense. * No point in making `onEach` store `arr.length` in a variable if it's only used once anyway.