about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2024-05-04Add `-` (stdin) support to rustdocUrgau-24/+55
2024-05-04Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillotbors-2/+5
Some hir cleanups It seemed odd to not put `AnonConst` in the arena, compared with the other types that we did put into an arena. This way we can also give it a `Span` without growing a lot of other HIR data structures because of the extra field. r? compiler
2024-05-01Stabilize `custom_code_classes_in_docs` featureGuillaume Gomez-251/+24
2024-04-29Rollup merge of #124475 - GKFX:more-dependency-pruning, r=oli-obk许杰友 Jieyou Xu (Joe)-17/+14
Remove direct dependencies on lazy_static, once_cell and byteorder The relevant functionality of all three crates is now available and stable in the standard library, i.e. `std::sync::OnceLock` and `{integer}::to_le_bytes`. I think waiting for `LazyLock` (#109736) would give marginally more concise code, but not by much.
2024-04-28Add some missing comments to describe what the inlined SVG isGuillaume Gomez-0/+4
2024-04-28Inline `wheel.svg` into CSSGuillaume Gomez-3/+14
2024-04-28Inline `clipboard.svg` into CSSGuillaume Gomez-3/+11
2024-04-28Remove direct dependencies on lazy_static, once_cell and byteorderGeorge Bateman-17/+14
The functionality of all three crates is now available in the standard library.
2024-04-26put `hir::AnonConst` on the hir arenaOli Scherer-2/+5
2024-04-25Auto merge of #124058 - TechVest:master, r=fmeasebors-1/+1
Fix some typos in comments
2024-04-25Fix some typos in commentsTechVest-2/+2
Signed-off-by: TechVest <techdashen@qq.com>
2024-04-24chore: fix some typos in commentswhosehang-1/+1
Signed-off-by: whosehang <whosehang@outlook.com>
2024-04-23Mark @RUSTC_BUILTIN search path usage as unstableLukas Wirth-1/+10
2024-04-19rustdoc-search: add parser for `&` syntaxMichael Howell-0/+31
2024-04-19rustdoc-search: add index of borrow referencesMichael Howell-23/+39
2024-04-19Rollup merge of #124149 - notriddle:notriddle/desc-alias, r=GuillaumeGomezMatthias Krüger-10/+11
rustdoc-search: fix description on aliases in results This needs to start downloading the descriptions after aliases have been added to the result set.
2024-04-19Auto merge of #118441 - GuillaumeGomez:display-stability-version, r=rustdocbors-61/+14
Always display stability version even if it's the same as the containing item Fixes https://github.com/rust-lang/rust/issues/118439. Currently, if the containing item's version is the same as the item's version (like a method), we don't display it on the item. This was something done on purpose as you can see [here](https://github.com/rust-lang/rust/blob/e9b7bf011478aa8c19ac49afc99853a66ba04319/src/librustdoc/html/render/mod.rs#L949-L955). It was implemented in https://github.com/rust-lang/rust/pull/30686. I think we should change this because on pages with a lot of items, if someone arrives (through the search or a link) to an item far below the page, they won't know the stability version unless they scroll to the top, which isn't great. You can see the result [here](https://rustdoc.crud.net/imperio/display-stability-version/std/pin/struct.Pin.html#method.new). r? `@notriddle`
2024-04-18rustdoc-search: fix description on aliases in resultsMichael Howell-10/+11
This needs to start downloading the descriptions after aliases have been added to the result set.
2024-04-18Rollup merge of #123752 - estebank:emoji-prefix, r=wesleywiserJubilee-3/+4
Properly handle emojis as literal prefix in macros Do not accept the following ```rust macro_rules! lexes {($($_:tt)*) => {}} lexes!(🐛"foo"); ``` Before, invalid emoji identifiers were gated during parsing instead of lexing in all cases, but this didn't account for macro pre-expansion of literal prefixes. Fix #123696.
2024-04-18Auto merge of #119912 - notriddle:notriddle/reexport-dedup, r=GuillaumeGomezbors-28/+194
rustdoc-search: single result for items with multiple paths Part of #15723 Preview: https://notriddle.com/rustdoc-html-demo-9/reexport-dup/std/index.html?search=hashmap This change uses the same "exact" paths as trait implementors and type alias inlining to track items with multiple reachable paths. This way, if you search for `vec`, you get only the `std` exports of it, and not the one from `alloc`. It still includes all the items in the search index so that you can search for them by all available paths. For example, try `core::option` and `std::option`, and notice that the results page doesn't show duplicates, but still shows all the items in their respective crates.
2024-04-18Auto merge of #124008 - nnethercote:simpler-static_assert_size, r=Nilstriebbors-2/+4
Simplify `static_assert_size`s. We want to run them on all 64-bit platforms. r? `@ghost`
2024-04-18Rollup merge of #124041 - GuillaumeGomez:fix-copy-path-button, r=notriddleMatthias Krüger-25/+12
Fix copy path button Currently, on all nightly docs, clicking on the "copy path" button triggers a JS error. It's because changes in https://github.com/rust-lang/rust/pull/123706 forgot to update the JS (it contained an image before but not anymore). I had to make some small changes in the CSS to fix the display when the button was clicked as well. r? ``@notriddle``
2024-04-18Simplify `static_assert_size`s.Nicholas Nethercote-2/+4
We want to run them on all 64-bit platforms.
2024-04-17Fix copy-path buttonGuillaume Gomez-25/+12
2024-04-17Rollup merge of #122813 - nnethercote:nicer-quals, r=compiler-errorsMatthias Krüger-7/+6
Qualifier tweaking Adding and removing qualifiers in some cases that make things nicer. Details in individual commits. r? `@compiler-errors`
2024-04-16Rollup merge of #123501 - Urgau:stabilize-check-cfg, r=petrochenkovMatthias Krüger-6/+3
Stabilize checking of cfgs at compile-time: `--check-cfg` option This PR stabilize the `--check-cfg` CLI option of `rustc` (and `rustdoc`) :tada:. In particular this PR does two things: 1. it makes the `--check-cfg` option stable 2. and it moves the documentation to the stable books FCP: https://github.com/rust-lang/rust/issues/82450#issuecomment-1965328542 Resolves #82450 ``@rustbot`` labels +S-blocked +F-check-cfg r? ``@petrochenkov``
2024-04-16Rollup merge of #123355 - mu001999:rustdoc/search, r=GuillaumeGomezMatthias Krüger-2/+3
Support type '/' to search Related topic on IRLO: https://internals.rust-lang.org/t/rustdoc-use-key-to-search-instead-of-s/20559
2024-04-16Rollup merge of #124011 - fmease:rustdoc-updated-clean-docs, r=GuillaumeGomezGuillaume Gomez-2/+22
rustdoc: update the module-level docs of `rustdoc::clean` Let's update this 11-year-old documentation. This would've helped me greatly when first starting out. Please point out if I should add, clarify or correct anything. I plan on looking through the rustc dev guide later to see if anything can be expanded upon over there, too.
2024-04-16rustdoc: update module-level docs of `rustdoc::clean`León Orell Valerian Liehr-2/+22
2024-04-16Always use `ty::` qualifier for `TyKind` enum variants.Nicholas Nethercote-3/+2
Because that's the way it should be done.
2024-04-16Avoid unnecessary `rustc_span::DUMMY_SP` usage.Nicholas Nethercote-4/+4
In some cases `DUMMY_SP` is already imported. In other cases this commit adds the necessary import, in files where `DUMMY_SP` is used more than once.
2024-04-15Stabilize checking of cfgs at compile-time: --check-cfg optionUrgau-6/+3
2024-04-13rustdoc: check redundant explicit links with correct itemidMichael Howell-11/+8
Fixes a regression caused by 0a50dba50bedd24377bd1066da3b4b7066df4d28
2024-04-11Auto merge of #123823 - matthiaskrgr:rollup-8zdtggx, r=matthiaskrgrbors-2/+1
Rollup of 8 pull requests Successful merges: - #122882 (Avoid a panic in `set_output_capture` in the default panic handler) - #123523 (Account for trait/impl difference when suggesting changing argument from ref to mut ref) - #123744 (Silence `unused_imports` for redundant imports) - #123784 (Replace `document.write` with `document.head.insertAdjacent`) - #123798 (Avoid invalid socket address in length calculation) - #123804 (Stop using `HirId` for fn-like parents since closures are not `OwnerNode`s) - #123806 (Panic on overflow in `BorrowedCursor::advance`) - #123820 (Add my former address to .mailmap) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-11Rollup merge of #123459 - GuillaumeGomez:fix-123435, r=notriddleMatthias Krüger-23/+37
Correctly handle inlining of doc hidden foreign items Fixes #123435. In case a foreign item has doc(hidden) attribute, we simply merged its attributes with the re-export's, making it being removed once in the `strip_hidden` pass. The solution was to use the same as for local reexported items: merge attributes, but not some of them (like `doc(hidden)`). I originally checked if we could simply update `Item::is_doc_hidden` method to use `self.inline_stmt_id.is_some_and(|def_id| tcx.is_doc_hidden(def_id))` but unfortunately, it added (local) items that shouldn't be inlined. At least it unifies local and foreign items inlining, which I think is the best course of action here. r? `@notriddle`
2024-04-11Replace `document.write` with `document.head.insertAdjacentHTML`Guillaume Gomez-2/+1
2024-04-10Properly handle emojis as literal prefix in macrosEsteban Küber-3/+4
Do not accept the following ```rust macro_rules! lexes {($($_:tt)*) => {}} lexes!(🐛"foo"); ``` Before, invalid emoji identifiers were gated during parsing instead of lexing in all cases, but this didn't account for macro expansion of literal prefixes. Fix #123696.
2024-04-09rustdoc: remove unused 16x16 faviconMichael Howell-3/+0
According to <https://caniuse.com/?search=svg%20favicon>, SVG favicons are supported in everything but Safari. When I actually try it in Safari, it's downloading all three favicons, and nothing looks different when I disable the 16x16 one. <https://dev.to/masakudamatsu/favicon-nightmare-how-to-maintain-sanity-3al7>, which is linked from caniuse above, recommends an ico. However, the reason they recommend it is the apps that only support /favicon.ico exactly, and rustdoc can't assume it will be installed to the site root, so it's unfortunately up to the webmaster to make sure it's set up.
2024-04-09rustdoc: load icons from css instead of inlineMichael Howell-23/+26
This cuts the HTML overhead for a page by about 1KiB, significantly reducing the overall size of the docs bundle.
2024-04-09rustdoc: reduce size of `<head>` with preload loopMichael Howell-9/+6
2024-04-09rustdoc: clean up type alias codeMichael Howell-16/+12
2024-04-09Rollup merge of #123638 - ↵Guillaume Gomez-1/+1
fmease:rustdoc-synth-auto-yeet-item-param-env-clauses, r=GuillaumeGomez rustdoc: synthetic auto: filter out clauses from the implementor's ParamEnv ... not just the elaborated clauses. Fixes another regression introduced by me in #123340, oops! Fixes https://github.com/rust-lang/rust/pull/123340#issuecomment-2034195786, cc ``@tamird.`` An earlier local iteration of branch `rustdoc-simplify-auto-trait-impl-synth` (PR #123340) contained a fix for issue #111101 before I decided to limit the scope. I must've introduced this bug when manually reverting that part of the code. r? ``@GuillaumeGomez`` or rustdoc
2024-04-09Rollup merge of #123647 - fmease:rustdoc-clean-up-blanket-impls-synth, r=camelidMatthias Krüger-131/+121
rustdoc: slightly clean up the synthesis of blanket impls Small follow-up to #123340 as promised in https://github.com/rust-lang/rust/pull/123340#discussion_r1546918604. No functional changes whatsoever. * inline the over-engineered “type namespace” (struct) `BlanketImplFinder` just like I did with `AutoTraitFinder` in #123340 * use the new `synthesize_*` terminology over the old nondescript / misleading `get_*` one * inline a `use super::*;` (not super modular, lead to `clean/mod.rs` (!) accumulating cruft) * use `tracing` properly r? GuillaumeGomez or rustdoc
2024-04-08rustdoc: add re-export info to RawSearchIndex type defMichael Howell-6/+13
2024-04-08Update search_index.rsMichael Howell-1/+0
2024-04-08rustdoc: improve comments based on feedbackMichael Howell-8/+13
2024-04-08rustdoc-search: single result for items with multiple pathsMichael Howell-22/+177
This change uses the same "exact" paths as trait implementors and type alias inlining to track items with multiple reachable paths. This way, if you search for `vec`, you get only the `std` exports of it, and not the one from `alloc`. It still includes all the items in the search index so that you can search for them by all available paths. For example, try `core::option` and `std::option`, and notice that the results page doesn't show duplicates, but still shows all the items in their respective crates.
2024-04-08rustdoc: slightly clean up the synthesis of blanket implsLeón Orell Valerian Liehr-131/+121
2024-04-08rustdoc: synthetic auto: filter out clauses from the implementor's ParamEnvLeón Orell Valerian Liehr-1/+1
not just the ones from the elaborated clauses.
2024-04-08Actually create ranged int types in the type system.Oli Scherer-3/+9