about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2025-04-05Rollup merge of #139274 - lolbinarycat:rustdoc-js-less-expect-error-part5, ↵Stuart Cook-46/+100
r=notriddle Rustdoc: typecheck settings.js This makes the file fully typechecked with no instances of ``````@ts-expect-error`````` and no type casts. r? `````@notriddle`````
2025-04-04Rollup merge of #139328 - GuillaumeGomez:fix-panic-output-137970, r=fmeaseMatthias Krüger-3/+5
Fix 2024 edition doctest panic output Fixes #137970. The problem was that the output was actually displayed by rustc itself because we're exiting with `Result<(), String>`, and the display is really not great. So instead, we get the output, we print it and then we return an `ExitCode`. r? ````@aDotInTheVoid````
2025-04-03Rollup merge of #139255 - GuillaumeGomez:unused-var-merged-doctest, r=fmeaseMatthias Krüger-1/+0
Remove unused variables generated in merged doctests The variable is unused so no need to keep it around. cc `@notriddle` r? `@camelid`
2025-04-03Rollup merge of #138610 - oli-obk:no-sort-hir-ids, r=compiler-errorsMatthias Krüger-6/+7
impl !PartialOrd for HirId revive of https://github.com/rust-lang/rust/pull/92233 Another checkbox of https://github.com/rust-lang/rust/issues/90317, another small step in making incremental less likely to die in horrible ways
2025-04-03Use `eprint!` instead of `eprintln!`Guillaume Gomez-1/+1
2025-04-03Fix 2024 edition doctest panic outputGuillaume Gomez-3/+5
2025-04-03Remove `LintExpectationId` from `Level` variantsOli Scherer-2/+2
2025-04-03Make LevelAndSource a structOli Scherer-6/+7
2025-04-03Rollup merge of #139282 - lolbinarycat:rustdoc-settings-checkbox-noshrink, ↵Matthias Krüger-0/+3
r=notriddle rustdoc: make settings checkboxes always square Previously, checkboxes would flex horizontally on small screens: ![Screenshot 2025-04-02 at 15-45-13 std - Rust](https://github.com/user-attachments/assets/405dc764-3c04-4ba4-b86c-19e9d4fc0bff) this simple css tweak fixes this.
2025-04-02rustdoc js: satisfy eslintbinarycat-4/+4
2025-04-02rustdoc: make settings checkboxes always squarebinarycat-0/+3
2025-04-02settings.js: fix whitespacebinarycat-1/+1
2025-04-02settings.js: add elemContainsTarget utility functionbinarycat-6/+15
this allows us to eliminate the last 3 @ts-expect-error in this file.
2025-04-02main.js: make hideAllModals docs clearerbinarycat-1/+1
"true" looks like a string value, `true` makes it more clear that we are talking about the actual boolean value.
2025-04-02settings.js: make top-level code typecheckbinarycat-9/+13
With this, almost the entire file is fully typechecked, the only exception being the Element.contains(EventTarget) pattern that is used several times, those are annotated with @ts-expect-error
2025-04-02settings.js: add some null checks to buildSettingsPagebinarycat-2/+8
2025-04-02settings.js: refactor settingsBlurHandlerbinarycat-5/+14
changes: * Add type signature * Add null checks * getHelpButton and getSettingsButton are only called once, which should marginally improve performance due to less queries. unfortunatly 2 @ts-expect-error was needed, as typescript is unaware the EventTarget is likely an Element.
2025-04-02settings.js: remove dead code for adding <hr> to settings pagebinarycat-5/+0
2025-04-02settings.js: add new rustdoc.Setting interfacebinarycat-17/+36
2025-04-02settings.js: begin typechecking migrationbinarycat-7/+19
this also makes `changeSetting` more robust in case it somehow gets called before `main.js` has finished loading.
2025-04-02Rollup merge of #139232 - nnethercote:remove-Map-5, r=ZalatharTakayuki Maeda-8/+4
Move methods from `Map` to `TyCtxt`, part 5. This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR. A follow-up to #137504. r? `@Zalathar`
2025-04-02Remove unused variables generated in merged doctestsGuillaume Gomez-1/+0
2025-04-02Rollup merge of #138913 - lolbinarycat:rustdoc-js-less-expect-error-part4, ↵Stuart Cook-82/+121
r=notriddle Remove even more instances of @ts-expect-error from search.js r? `@notriddle`
2025-04-02Move methods from `Map` to `TyCtxt`, part 5.Nicholas Nethercote-8/+4
This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR.
2025-04-01Move `ast::Item::ident` into `ast::ItemKind`.Nicholas Nethercote-4/+4
`ast::Item` has an `ident` field. - It's always non-empty for these item kinds: `ExternCrate`, `Static`, `Const`, `Fn`, `Mod`, `TyAlias`, `Enum`, `Struct`, `Union`, `Trait`, `TraitAlias`, `MacroDef`, `Delegation`. - It's always empty for these item kinds: `Use`, `ForeignMod`, `GlobalAsm`, `Impl`, `MacCall`, `DelegationMac`. There is a similar story for `AssocItemKind` and `ForeignItemKind`. Some sites that handle items check for an empty ident, some don't. This is a very C-like way of doing things, but this is Rust, we have sum types, we can do this properly and never forget to check for the exceptional case and never YOLO possibly empty identifiers (or possibly dummy spans) around and hope that things will work out. The commit is large but it's mostly obvious plumbing work. Some notable things. - `ast::Item` got 8 bytes bigger. This could be avoided by boxing the fields within some of the `ast::ItemKind` variants (specifically: `Struct`, `Union`, `Enum`). I might do that in a follow-up; this commit is big enough already. - For the visitors: `FnKind` no longer needs an `ident` field because the `Fn` within how has one. - In the parser, the `ItemInfo` typedef is no longer needed. It was used in various places to return an `Ident` alongside an `ItemKind`, but now the `Ident` (if present) is within the `ItemKind`. - In a few places I renamed identifier variables called `name` (or `foo_name`) as `ident` (or `foo_ident`), to better match the type, and because `name` is normally used for `Symbol`s. It's confusing to see something like `foo_name.name`.
2025-03-28Rollup merge of #138678 - durin42:rmeta-stability, r=fmeaseMatthias Krüger-1/+2
rustc_resolve: fix instability in lib.rmeta contents rust-lang/rust@23032f31c91f2 accidentally introduced some nondeterminism in the ordering of lib.rmeta files, which we caught in our bazel-based builds only recently due to being further behind than normal. In my testing, this fixes the issue.
2025-03-28Rollup merge of #138104 - GuillaumeGomez:simplify-doctest-parsing, r=fmeaseMatthias Krüger-357/+267
Greatly simplify doctest parsing and information extraction The original process was pretty terrible, as it tried to extract information such as attributes by performing matches over tokens like `#!`, which doesn't work very well considering you can have `# ! [`, which is valid. Also, it now does it in one pass: if the parser is happy, then we try to extract information, otherwise we return early. r? `@fmease`
2025-03-27search.js: revert usage of nonundef for now (not available under test)binarycat-2/+3
specifically, `storage.js` is not loaded during `rustdoc-js` and `rustdoc-js-std` tests.
2025-03-27Auto merge of #139023 - jhpratt:rollup-4ou6ei4, r=jhprattbors-8/+5
Rollup of 7 pull requests Successful merges: - #138844 (expand: Leave traces when expanding `cfg` attributes) - #138926 (Remove `kw::Empty` uses from `rustc_middle`.) - #138989 (Clean up a few things in rustc_hir_analysis::check::region) - #138999 (Report compiletest pass mode if forced) - #139014 (Improve suggest construct with literal syntax instead of calling) - #139015 (Remove unneeded LLVM CI test assertions) - #139016 (Add job duration changes to post-merge analysis report) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-27Rollup merge of #138926 - nnethercote:less-kw-Empty-rustc_middle, r=lcnrJacob Pratt-6/+3
Remove `kw::Empty` uses from `rustc_middle`. There are several places in `rustc_middle` that check for an empty lifetime name. These checks appear to be totally unnecessary, because empty lifetime names aren't produced here. (Empty lifetime names *are* possible in `hir::Lifetime`. Perhaps there was some confusion between it and the `rustc_middle` types?) This commit removes the `kw::Empty` checks. r? `@lcnr`
2025-03-27Only take outer attributes into account when generating content between ↵Guillaume Gomez-120/+19
first non-crate items and the crate items
2025-03-27librustdoc: also stabilize iteration order hereAugie Fackler-1/+2
2025-03-27Remove recursion in `check_item`Guillaume Gomez-16/+4
2025-03-27Add new regression test for doctestGuillaume Gomez-0/+131
2025-03-27Auto merge of #138927 - nnethercote:rearrange-Item-ItemInner, r=GuillaumeGomezbors-37/+46
rustdoc: Rearrange `Item`/`ItemInner`. The `Item` struct is 48 bytes and contains a `Box<ItemInner>`; `ItemInner` is 104 bytes. This is an odd arrangement. Normally you'd have one of the following. - A single large struct, which avoids the allocation for the `Box`, but can result in lots of wasted space in unused parts of a container like `Vec<Item>`, `HashSet<Item>`, etc. - Or, something like `struct Item(Box<ItemInner>)`, which requires the `Box` allocation but gives a very small Item size, which is good for containers like `Vec<Item>`. `Item`/`ItemInner` currently gets the worst of both worlds: it always requires a `Box`, but `Item` is also pretty big and so wastes space in containers. It would make sense to push it in one direction or the other. #138916 showed that the first option is a regression for rustdoc, so this commit does the second option, which improves speed and reduces memory usage. r? `@GuillaumeGomez`
2025-03-27Improve codeGuillaume Gomez-34/+29
2025-03-27Add `expect` to the list of non-crate attributes for doctest generationGuillaume Gomez-1/+1
2025-03-27Improve code commentGuillaume Gomez-2/+2
2025-03-27Improve comment and test for generated doctest with code commentsGuillaume Gomez-3/+26
2025-03-27Correctly handle line comments in attributes and generate extern cratesGuillaume Gomez-18/+62
outside of wrapping function
2025-03-27Correctly handle `fn main` in macroGuillaume Gomez-18/+35
2025-03-27Greatly simplify doctest parsing and information extractionGuillaume Gomez-323/+136
2025-03-27Remove `kw::Empty` uses from `src/librustdoc`.Nicholas Nethercote-6/+3
Much like the ones in the previous commit.
2025-03-26satisfy eslintbinarycat-3/+3
2025-03-26expand: Leave traces when expanding `cfg` attributesVadim Petrochenkov-2/+2
2025-03-25Rollup merge of #138917 - nnethercote:rustdoc-remove-useless, r=GuillaumeGomezJacob Pratt-38/+38
rustdoc: remove useless `Symbol::is_empty` checks. There are a number of `is_empty` checks that can never fail. This commit removes them, in support of #137978. r? `@GuillaumeGomez`
2025-03-25Rollup merge of #138877 - TaKO8Ki:enable-per-target-ignores-for-doctests, ↵Jacob Pratt-4/+5
r=notriddle Ignore doctests only in specified targets Quick fix for #138863 FIxes #138863 cc `@yotamofek` `@notriddle`
2025-03-26rustdoc: Rearrange `Item`/`ItemInner`.Nicholas Nethercote-37/+46
The `Item` struct is 48 bytes and contains a `Box<ItemInner>`; `ItemInner` is 104 bytes. This is an odd arrangement. Normally you'd have one of the following. - A single large struct, which avoids the allocation for the `Box`, but can result in lots of wasted space in unused parts of a container like `Vec<Item>`, `HashSet<Item>`, etc. - Or, something like `struct Item(Box<ItemInner>)`, which requires the `Box` allocation but gives a very small Item size, which is good for containers like `Vec<Item>`. `Item`/`ItemInner` currently gets the worst of both worlds: it always requires a `Box`, but `Item` is also pretty big and so wastes space in containers. It would make sense to push it in one direction or the other. #138916 showed that the first option is a regression for rustdoc, so this commit does the second option, which improves speed and reduces memory usage.
2025-03-25rustdoc: remove useless `Symbol::is_empty` checks.Nicholas Nethercote-38/+38
There are a number of `is_empty` checks that can never fail. This commit removes them.
2025-03-25ignore doctests only in specified targetsTakayuki Maeda-4/+5
add necessary lines fix ui test error