about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2025-06-21Auto merge of #142667 - yotamofek:pr/rustdoc/more-write-shared-perf, ↵bors-27/+12
r=nnethercote Avoid a few more allocations in `write_shared.rs` Inspired by rust-lang/rust#141421 , avoids a few `Vec`, `PathBuf` and `String` allocations in `write_shared.rs`. I don't think these will show up on benchmarks, but are still worthwhile IMHO. Also includes a few small cleanups. r? nnethercote - if you'd like :)
2025-06-22Rename some methods.Nicholas Nethercote-8/+12
- `convert_static` -> `from_clean_static` - `from_function` -> `from_clean_function` To match the pre-existing `from_clean_item` and `FromClean::from_clean`. I left `JsonRenderer::convert_item` unchanged because it's a bit different.
2025-06-22Use `FromClean` more.Nicholas Nethercote-121/+156
The `FromClean` trait is used a lot for converting to rustdoc-json format. But it's not used universally; there are still some ad hoc functions and methods for converting. This commit fixes this inconsistency by using `FromClean` more. The commit also introduces `FromClean` for `Box` and `Option`. This lets a lot of `as_ref` and `map` calls be removed in favour of simple `into_json` calls.
2025-06-22Remove some code.Nicholas Nethercote-32/+1
It's just replicating exactly what is done by `<Vec<GenericParamDef> as FromClean>::into_json`
2025-06-22Remove some dead code.Nicholas Nethercote-25/+0
We currently have both `FromClean<clean::Constant> for Constant` and `FromClean<clean::ConstantKind> for Constant` which are basically identical, but the former is unused.
2025-06-22Use `sym::asterisk` to avoid a `Symbol::intern` call.Nicholas Nethercote-5/+2
2025-06-21Merge pull request #20050 from ↵Chayim Refael Friedman-3/+11
LHolten/better-docs-for-exclude-imports-in-symbol-search Add better documentation for excluding imports from symbol search
2025-06-21All HIR attributes are outerDavid Tolnay-3/+10
2025-06-21or_fun_call: lint more methods (#15071)Samuel Tardieu-1/+1
Extend `or_fun_call` lint with new checks for Option::get_or_insert, Result::map_or. changelog: [`or_fun_call`]: lint more methods
2025-06-21Merge pull request #20047 from ShoyuVanilla/comp-time-depsLukas Wirth-2/+24
internal: Utilize `cargo check --compile-time-deps`
2025-06-21Rollup merge of #142804 - zachs18:rename-layouts-to-layoutdata-in-comments, ↵Matthias Krüger-1/+1
r=saethlin Rename `LayoutS` to `LayoutData` in comments `LayoutS` was renamed to `LayoutData`, but some comments in the compiler were not changed. This updates comments in the compiler (and one section of commented-out code in rust-analyzer) to refer to `LayoutData` instead of `LayoutS`. cc <https://github.com/rust-lang/rust/pull/132252>, `@workingjubilee`
2025-06-21Rollup merge of #142787 - samueltardieu:diag-items-for-clippy, ↵Matthias Krüger-24/+16
r=Manishearth,Urgau Add diagnostic items for Clippy Clippy still uses some paths to access items from the standard library. Adding the missing diagnostic items allows removing the last remaining paths. Closes rust-lang/rust-clippy#5393
2025-06-21Rollup merge of #142785 - epage:link, r=ehussMatthias Krüger-0/+1
fix(linkcheck): Build using the lockfile This is to unblock cargo from servo/html5ever#623 I ran `linkcheck.sh` locally and it now works
2025-06-21Rollup merge of #142502 - nnethercote:rustdoc-json-GenericArgs, r=aDotInTheVoidMatthias Krüger-19/+64
rustdoc_json: improve handling of generic args This PR fixes some inconsistencies and inefficiencies in how generic args are handled by rustdoc-json-types. r? `@aDotInTheVoid`
2025-06-21fix: Correct grammar in remove all unused imports assistZakaria Elkatani-1/+1
2025-06-21internal: Utilize `cargo check --compile-time-deps`Shoyu Vanilla-2/+24
2025-06-21rustdoc_json: represent generic args consistently.Nicholas Nethercote-21/+19
They show up in three places: once as `Option<Box<GenericArgs>>`, once as `Box<GenericArgs>`, and once as `GenericArgs`. The first option is best. It is more compact because generic args are often missing. This commit changes the latter two to the former. Example output, before and after, for the `AssocItemConstraint` change: ``` {"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}},"binding":{...}} {"name":"Offset","args":null,"binding":{...}} ``` Example output, before and after, for the `Type::QualifiedPath` change: ``` {"qualified_path":{"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}}, ...}} {"qualified_path":{"name":"Offset","args":null, ...}} ``` This reduces JSON output size, but not by much (e.g. 0.5%), because `AssocItemConstraint` and `Type::QualifiedPath` are uncommon.
2025-06-21Fix some comments.Nicholas Nethercote-3/+3
As per the previous commit, generic args here can only appear on the final segment. So make the comments obey that constraint.
2025-06-21rustdoc_json: Fix handling of paths with no generic args.Nicholas Nethercote-1/+18
A path without generic args, like `Reader`, currently has JSON produced like this: ``` {"path":"Reader","id":286,"args":{"angle_bracketed":{"args":[],"constraints":[]}}} ``` Even though `types::Path::args` is `Option` and allows for "no args", instead it gets represented as "empty args". (More like `Reader<>` than `Reader`.) This is due to a problem in `clean::Path::from_clean`. It only produces `None` if the path is an empty string. This commit changes it to also produce `None` if there are no generic args. The example above becomes: ``` {"path":"Reader","id":286,"args":null} ``` I looked at a few examples and saw this reduce the size of the JSON output by 3-9%. The commit also adds an assertion that non-final segments don't have any generics; something the old code was implicitly relying on. Note: the original sin here is that `clean::PathSegment::args` is not an `Option`, unlike `{ast,hir}::PathSegment::args`. I want to fix that, but it can be done separately.
2025-06-21rustdoc_json: Add static asserts for the size of important types.Nicholas Nethercote-0/+30
A lot of these are large! Lots of room for improvement in the future.
2025-06-20Rollup merge of #142677 - GuillaumeGomez:check-format-version-update, r=KobzolTrevor Gross-2/+109
Add CI check to ensure that rustdoc JSON `FORMAT_VERSION` is correctly updated Follow-up of https://github.com/rust-lang/rust/pull/142601. Tested it locally with: `BASE_COMMIT=1bb335244c311a07cee165c28c553c869e6f64a9 src/ci/docker/host-x86_64/mingw-check-1/validate-rustdoc-json-format-version-update.sh` (where `BASE_COMMIT` value was the commit before I made a wrong change with the `FORMAT_VERSION` update). This is a first version. I plan to send a follow-up to also ensure that `FORMAT_VERSION` is updated if any code change is done in `rustdoc-json-types`. For that I just need to check that a line not starting with `/` and not an empty line was updated. Fun times with `grep` ahead. :') cc `@aDotInTheVoid` r? `@nnethercote`
2025-06-20Rollup merge of #142384 - celinval:chores-rayon-mv, r=oli-obkTrevor Gross-1/+1
Bringing `rustc_rayon_core` in tree as `rustc_thread_pool` This PR moves [`rustc_rayon_core`](https://github.com/rust-lang/rustc-rayon/tree/5fadf44/rayon-core) from commit `5fadf44` as suggested in [this zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Bringing.20.60rustc_rayon_core.60.20in.20tree). I tried to split the work into separate commits so it is easy to review. The first commit is a simple copy and paste from the fork, and subsequent changes were made to use the new crate and to ensure the new crate complies with different format and lint expectations. **Call-out:** I was also wondering if I need to make any further changes to accommodate licensing requirements. r? oli-obk
2025-06-21formatjnyfah-1/+1
2025-06-21revert changesjnyfah-95/+10
2025-06-20Auto merge of #142794 - tgross35:rollup-iae7okj, r=tgross35bors-122/+80
Rollup of 9 pull requests Successful merges: - rust-lang/rust#142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.) - rust-lang/rust#142491 (Rework #[cold] attribute parser) - rust-lang/rust#142494 (Fix missing docs in `rustc_attr_parsing`) - rust-lang/rust#142495 (Better template for `#[repr]` attributes) - rust-lang/rust#142497 (Fix random failure when JS code is executed when the whole file was not read yet) - rust-lang/rust#142575 (Ensure copy* intrinsics also perform the static self-init checks) - rust-lang/rust#142650 (Refactor Translator) - rust-lang/rust#142713 (mbe: Refactor transcription) - rust-lang/rust#142755 (rustdoc: Remove `FormatRenderer::cache`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-20configure.py: fix edge casebinarycat-1/+1
2025-06-20fmtNia Espera-7/+6
2025-06-20Update src/shims/trace/parent.rsNia-4/+5
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2025-06-20error reworkNia Espera-33/+17
2025-06-20nonnullsNia Espera-22/+18
2025-06-20cfg ifNia Espera-4/+1
2025-06-20fix dumb mistakeNia Espera-1/+6
2025-06-20supervisor bits of ffi ptracingNia Espera-81/+606
2025-06-20Rollup merge of #142767 - nnethercote:symbol-cleanups, r=petrochenkovJakub Beránek-2/+2
Some symbol and PathRoot cleanups I'm looking into unifying how we join and print paths. Here are some preliminary cleanups. r? ``@petrochenkov``
2025-06-20Rollup merge of #142764 - ChaiTRex:ilog_10_to_ilog10, r=workingjubileeJakub Beránek-1/+1
Convert `ilog(10)` to `ilog10()` Except in tests, convert `integer.ilog(10)` to `integer.ilog10()` for better speed and to provide better examples of code that efficiently counts decimal digits. I couldn't find any instances of `integer.ilog(2)`.
2025-06-20Rollup merge of #142758 - jieyouxu:rustdoc-json-types, r=KobzolJakub Beránek-1/+1
Make sure to rebuild rustdoc if `src/rustdoc-json-types` is changed I think `rustdoc-json-types` was more recently split out, so this download-rustc logic became outdated as it wasn't tracked. This PR adds `src/rustdoc-json-types` to be tracked for difference versus upstream, so that we properly rebuild rustdoc if it has changes versus upstream. Fixes rust-lang/rust#142738. ### Local testing This is not so easy to test locally because it requires download-rustc. To test this, you need to: 1. Disable `download-rustc` inhibition from bootstrap changes versus upstream, by including `:!src/bootstrap` in https://github.com/rust-lang/rust/blob/255aa220821c05c3eac7605fce4ea1c9ab2cbdb4/src/bootstrap/src/core/config/config.rs#L67-L74. 2. Then, use a config like `profile = "tools"` which by default uses `download-rustc = "if-unchanged"`. 3. Run `./x test tests/rustdoc-json` one time, to "prime" initial build caches. 4. Change the `FORMAT_VERSION` in `src/rustdoc-json-types`, i.e. ```diff diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 1f93895ae07..72a3720c7b4 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs ``@@`` -38,7 +38,7 ``@@`` // are deliberately not in a doc comment, because they need not be in public docs.) // // Latest feature: Pretty printing of inline attributes changed -pub const FORMAT_VERSION: u32 = 48; +pub const FORMAT_VERSION: u32 = 666; ``` 5. Observe that without this patch, `rustdoc-json` tests fail because `FORMAT_VERSION` mismatch. Observe that with this patch, rustdoc gets properly rebuilt and `rustdoc-json` tests pass. cc ``@aDotInTheVoid`` r? Kobzol
2025-06-20Rollup merge of #142743 - tshepang:rdg-push, r=jieyouxuJakub Beránek-96/+252
rustc-dev-guide subtree update r? ``@ghost``
2025-06-20Rollup merge of #142720 - yotamofek:pr/rustdoc/ext-crate-cleanup, ↵Jakub Beránek-71/+53
r=GuillaumeGomez De-dup common code from `ExternalCrate` methods Also, return an `impl Iterator` instead of collecting into a `Vec`. Not sure if that'll have a measurable perf impact, but I think this PR still cleans up the two methods it touches quite nicely. (I'm having trouble finding a name for the common method I extracted, currently called `foobar`, would love suggestions!)
2025-06-20Rollup merge of #142715 - folkertdev:fn-align-corrections, r=jdonszelmannJakub Beránek-1/+1
correct template for `#[align]` attribute Tracking issue: https://github.com/rust-lang/rust/issues/82232 related: https://github.com/rust-lang/rust/pull/142507 I didn't fully understand what `template!` did, clearly. An empty `#[align]` attribute was still rejected later, but without this change it does get suggested in certain cases. I've also updated some outdated references to `#[repr(align)]` on functions. r? ``@jdonszelmann``
2025-06-20Rollup merge of #142629 - Kobzol:bootstrap-tests-builder, r=jieyouxuJakub Beránek-19/+114
Add config builder for bootstrap tests I started writing a bunch of snapshot tests for build/check steps, and quickly realized that the current interface for defining them won't be enough, so I created a simple builder, which can scale to pretty much any kind of configuration in the future.
2025-06-20rust-analyzer: Rename LayoutS to LayoutData in commentsZachary S-1/+1
2025-06-20Rollup merge of #142755 - aDotInTheVoid:rdj-shattrs, r=GuillaumeGomezTrevor Gross-12/+1
rustdoc: Remove `FormatRenderer::cache` We only called it it one place, which isn't generic and can be replaced with a field access.
2025-06-20Rollup merge of #142650 - camsteffen:refactor-translator, r=petrochenkovTrevor Gross-71/+36
Refactor Translator My main motivation was to simplify the usage of `SilentEmitter` for users like rustfmt. A few refactoring opportunities arose along the way. * Replace `Translate` trait with `Translator` struct * Replace `Emitter: Translate` with `Emitter::translator` * Split `SilentEmitter` into `FatalOnlyEmitter` and `SilentEmitter`
2025-06-20Rollup merge of #142497 - GuillaumeGomez:fix-random-search-failure, ↵Trevor Gross-37/+41
r=lolbinarycat Fix random failure when JS code is executed when the whole file was not read yet Very randomly (and rarely), when I arrived on a page with `?search=something` in the URL, I got this error: ![Screenshot From 2025-06-14 11-27-46](https://github.com/user-attachments/assets/4b61b067-4e80-49c1-9a45-cff1509bf86a) Moving the `initSearch` function at the bottom to ensure everything has been loaded fixes the issue. PS: Sorry for the noise. Pushed to the wrong branch and https://github.com/rust-lang/rust/pull/142496 closed. ><
2025-06-20Bump the version number to 1.90.0Josh Stone-1/+1
2025-06-20update configure.py to handle new bootstrap.example.tomlbinarycat-7/+24
2025-06-20clippy: replace path uses by diagnostic itemsSamuel Tardieu-24/+16
2025-06-20Improve error message for rustdoc_json_types tidy checkGuillaume Gomez-11/+25
Only emit git errors if we are in CI environment
2025-06-20fix(linkcheck): Build using the lockfileEd Page-0/+1
This is to unblock cargo from servo/html5ever#623
2025-06-20Pass `src_path` to rustdoc_json tidy checkGuillaume Gomez-11/+13