about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2025-04-18Rollup merge of #139393 - ↵Matthias Krüger-0/+60
willglynn:rustdoc_output_target_feature_information, r=aDotInTheVoid rustdoc-json: Output target feature information `#[target_feature]` attributes refer to a target-specific list of features. Enabling certain features can imply enabling other features. Certain features are always enabled on certain targets, since they are required by the target's ABI. Features can also be enabled indirectly based on other compiler flags. Feature information is ultimately known to `rustc`. Rather than force external tools to track it – which may be wildly impractical due to `-C target-cpu` – have `rustdoc` output `rustc`'s feature data. This change is motivated by https://github.com/obi1kenobi/cargo-semver-checks/issues/1246, which intends to detect semver hazards caused by `#[target_feature]`. try-job: aarch64-gnu try-job: armhf-gnu try-job: test-various try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1 try-job: aarch64-apple
2025-04-17Rollup merge of #139943 - fmease:rustdoc-ixcre-trait-aliases, r=GuillaumeGomezMatthias Krüger-25/+27
rustdoc: Support inlined cross-crate re-exported trait aliases Previously we'd just drop them. As a result of this PR, [`core::ptr::Thin`](https://doc.rust-lang.org/nightly/core/ptr/traitalias.Thin.html) will be admitted into the `std` façade! Also, render the where clause *after* the bounds / the `=`, not before them, as it should be. r? rustdoc
2025-04-17rustdoc: Properly clean fn params in all contextsLeón Orell Valerian Liehr-35/+32
2025-04-17rustdoc/clean: Change terminology of items pertaining to (formal) fn params ↵León Orell Valerian Liehr-134/+107
from "argument" to "parameter"
2025-04-17Support inlined cross-crate re-exported trait aliasesLeón Orell Valerian Liehr-25/+27
2025-04-17Replace infallible `name_or_empty` methods with fallible `name` methods.Nicholas Nethercote-19/+13
I'm removing empty identifiers everywhere, because in practice they always mean "no identifier" rather than "empty identifier". (An empty identifier is impossible.) It's better to use `Option` to mean "no identifier" because you then can't forget about the "no identifier" possibility. Some specifics: - When testing an attribute for a single name, the commit uses the `has_name` method. - When testing an attribute for multiple names, the commit uses the new `has_any_name` method. - When using `match` on an attribute, the match arms now have `Some` on them. In the tests, we now avoid printing empty identifiers by not printing the identifier in the `error:` line at all, instead letting the carets point out the problem.
2025-04-17Rollup merge of #139846 - nnethercote:kw-Empty-rustdoc, r=GuillaumeGomezMatthias Krüger-46/+63
Remove `kw::Empty` uses in rustdoc Helps with #137978. r? ``@GuillaumeGomez``
2025-04-15rustdoc: Output target feature informationWill Glynn-0/+60
`#[target_feature]` attributes refer to a target-specific list of features. Enabling certain features can imply enabling other features. Certain features are always enabled on certain targets, since they are required by the target's ABI. Features can also be enabled indirectly based on other compiler flags. Feature information is ultimately known to `rustc`. Rather than force external tools to track it -- which may be wildly impractical due to `-C target-cpu` -- have `rustdoc` output `rustc`'s feature data.
2025-04-15Rollup merge of #138455 - yotamofek:pr/rustdoc/more-impl-display, ↵Matthias Krüger-230/+228
r=GuillaumeGomez `librustdoc`: more `impl fmt::Display` Continuation of #137425 and #136828 and #136784 Working towards getting rid of the `write_str` helper r? `@GuillaumeGomez` (if you want!)
2025-04-15Replace flag `--doctest-compilation-args` with a simpler one: ↵León Orell Valerian Liehr-71/+7
`--doctest-build-arg` More notably, the value of the new flag does *not* get lexed shell-like and ad hoc.
2025-04-15Avoid using `kw::Empty` for param names in rustdoc.Nicholas Nethercote-8/+11
2025-04-15Avoid using `kw::Empty` when comparing names.Nicholas Nethercote-4/+7
2025-04-15Avoid another `kw::Empty` use.Nicholas Nethercote-1/+1
`sym::dummy` also appears to work.
2025-04-15Remove another `kw::Empty` use in rustdoc.Nicholas Nethercote-23/+31
Again by using `Option<Symbol>` to represent "no name".
2025-04-15Remove some `kw::Empty` uses in rustdoc.Nicholas Nethercote-16/+19
Some `unwrap` uses here, but they are on paths involving item kinds that are known to have an identifier.
2025-04-15Move `name` field from `AssocItem` to `AssocKind` variants.Nicholas Nethercote-7/+7
To accurately reflect that RPITIT assoc items don't have a name. This avoids the use of `kw::Empty` to mean "no name", which is error prone. Helps with #137978.
2025-04-15Move two methods from `AssocKind` to `AssocItem`.Nicholas Nethercote-2/+2
Because all the other similar methods are on `AssocItem`.
2025-04-15Move `opt_rpitit_info` field to `hir::AssocKind::Type`.Nicholas Nethercote-1/+1
From `hir::AssocItem`.
2025-04-14Fix grammar of --test-runtool-arg help textEric Huss-1/+1
2025-04-14Move `has_self` field to `hir::AssocKind::Fn`.Nicholas Nethercote-8/+8
`hir::AssocItem` currently has a boolean `fn_has_self_parameter` field, which is misplaced, because it's only relevant for associated fns, not for associated consts or types. This commit moves it (and renames it) to the `AssocKind::Fn` variant, where it belongs. This requires introducing a new C-style enum, `AssocTag`, which is like `AssocKind` but without the fields. This is because `AssocKind` values are passed to various functions like `find_by_ident_and_kind` to indicate what kind of associated item should be searched for, and having to specify `has_self` isn't relevant there. New methods: - Predicates `AssocItem::is_fn` and `AssocItem::is_method`. - `AssocItem::as_tag` which converts `AssocItem::kind` to `AssocTag`. Removed `find_by_name_and_kinds`, which is unused. `AssocItem::descr` can now distinguish between methods and associated functions, which slightly improves some error messages.
2025-04-11Rollup merge of #138682 - Alexendoo:extra-symbols, r=fee1-deadStuart Cook-0/+2
Allow drivers to supply a list of extra symbols to intern Allows adding new symbols as `const`s in external drivers, desirable in Clippy so we can use them in patterns to replace code like https://github.com/rust-lang/rust/blob/75530e9f72a1990ed2305e16fd51d02f47048f12/src/tools/clippy/clippy_lints/src/casts/cast_ptr_alignment.rs#L66 The Clippy change adds a couple symbols as a demo, the exact `clippy_utils` API and replacing other usages can be done on the Clippy side to minimise sync conflicts --- try-job: aarch64-gnu
2025-04-10lazify `render_assoc_items_inner`Yotam Ofek-37/+54
2025-04-10make `doc_impl_item` and `render_default_items` receive `impl fmt::Write`Yotam Ofek-126/+108
2025-04-10make `link_tooltip` return `impl fmt::Display`Yotam Ofek-27/+30
2025-04-10make `AllTypes::print` return `impl fmt::Display`Yotam Ofek-40/+36
2025-04-10Rollup merge of #139510 - nnethercote:name-to-ident, r=fee1-deadMatthias Krüger-14/+14
Rename some `name` variables as `ident`. It bugs me when variables of type `Ident` are called `name`. It leads to silly things like `name.name`. `Ident` variables should be called `ident`, and `name` should be used for variables of type `Symbol`. This commit improves things by by doing `s/name/ident/` on a bunch of `Ident` variables. Not all of them, but a decent chunk. r? `@fee1-dead`
2025-04-10Allow drivers to supply a list of extra symbols to internAlex Macleod-0/+2
2025-04-10Rollup merge of #139592 - camelid:doctest-md-opts, r=notriddleMatthias Krüger-1/+1
rustdoc: Enable Markdown extensions when looking for doctests Fixes #139064. We should enable these to avoid misinterpreting uses of the extended syntax as code blocks. This happens in practice with multi-paragraph footnotes, as discovered in #139064.
2025-04-10Rollup merge of #138605 - xizheyin:issue-138567, r=GuillaumeGomezMatthias Krüger-20/+17
Clean up librustdoc::html::render to be better encapsulated Closes #138567
2025-04-10Rollup merge of #138167 - ↵Matthias Krüger-10/+12
GuillaumeGomez:rustdoc-hidden-stripper-improvement, r=camelid Small code improvement in rustdoc hidden stripper This is a very minor code improvement following https://github.com/rust-lang/rust/pull/137534. It doesn't change anything about the performance issue. r? ```@notriddle```
2025-04-10Rename some `name` variables as `ident`.Nicholas Nethercote-14/+14
It bugs me when variables of type `Ident` are called `name`. It leads to silly things like `name.name`. `Ident` variables should be called `ident`, and `name` should be used for variables of type `Symbol`. This commit improves things by by doing `s/name/ident/` on a bunch of `Ident` variables. Not all of them, but a decent chunk.
2025-04-09Rollup merge of #139488 - GuillaumeGomez:add-missing-gui-test, r=camelidMatthias Krüger-1/+1
Add missing regression GUI test Add missing GUI test for #139282 (and also fixes the invalid CSS). cc `@lolbinarycat` r? `@notriddle`
2025-04-09rustdoc: Enable Markdown extensions when looking for doctestsNoah Lev-1/+1
We should enable these to avoid misinterpreting uses of the extended syntax as code blocks. This happens in practice with multi-paragraph footnotes, as discovered in #139064.
2025-04-09librustdoc: remove IndexItem::new, use previous fields constructorxizheyin-51/+19
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-08Rollup merge of #139509 - xizheyin:issue-139359, r=lcnrMatthias Krüger-6/+6
clean: remove Deref<Target=RegionKind> impl for Region and use `.kind()` Closes #139359 r? `@lcnr`
2025-04-08Rollup merge of #139321 - GuillaumeGomez:update-rinja, ↵Stuart Cook-22/+22
r=notriddle,lolbinarycat,yotamofek Update to new rinja version (askama) Askama maintenance was handed over to rinja maintainers so new `rinja` release is actually `askama`. More information [here](https://blog.guillaume-gomez.fr/articles/2025-03-19+Askama+and+Rinja+merge). r? ``@notriddle``
2025-04-08clean code: remove Deref<Target=RegionKind> impl for Region and use `.kind()`xizheyin-6/+6
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-07Fix CSSGuillaume Gomez-1/+1
2025-04-07Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obkStuart Cook-3/+0
Remove support for `extern "rust-intrinsic"` blocks Part of rust-lang/rust#132735 Looked manageable and there didn't appear to have been progress in the last two weeks, so decided to give it a try.
2025-04-07Rollup merge of #139035 - nnethercote:PatKind-Missing, r=oli-obkStuart Cook-0/+1
Add new `PatKind::Missing` variants To avoid some ugly uses of `kw::Empty` when handling "missing" patterns, e.g. in bare fn tys. Helps with #137978. Details in the individual commits. r? ``@oli-obk``
2025-04-06remove compiler support for `extern "rust-intrinsic"` blocksSkgland-3/+0
2025-04-06Update rinja version in `generate-copyright`Guillaume Gomez-2/+2
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-03Update to new rinja version (askama)Guillaume Gomez-22/+22
2025-04-03Remove `LintExpectationId` from `Level` variantsOli Scherer-2/+2