Commit graph

961 commits

Author SHA1 Message Date
Daria Sukhonina
33a8dc10cf Fix wrong par_slice implementation 2026-02-16 17:49:42 +03:00
bors
4c37f6d78c Auto merge of #152375 - Zoxc:rayon-scope-loops, r=jieyouxu,lqd
Use `scope` for `par_slice` instead of `join`

This uses `scope` instead of nested `join`s in `par_slice` so that each group of items are independent and do not end up blocking on another.
2026-02-15 09:55:40 +00:00
Jonathan Brouwer
65d982abd8
Rollup merge of #152469 - mu001999-contrib:cleanup/unused-features, r=nadrieril,jdonszelmann
Remove unused features

Detected by https://github.com/rust-lang/rust/pull/152164.

~~Only allow `unused_features` if there are complex platform-specific features enabled.~~
2026-02-13 13:34:58 +01:00
Stuart Cook
09720ec3d0
Rollup merge of #152329 - Zoxc:simple-parallel-macro, r=nnethercote
Simplify parallel! macro

This replaces the `parallel!` macro with a `par_fns` function.
2026-02-13 15:19:12 +11:00
mu001999
a07f837491 Remove unused features in compiler 2026-02-13 09:25:39 +08:00
John Kåre Alsaker
8c5ce26e43 Replace parallel! macro with par_fns function and rename join to par_join 2026-02-12 12:20:18 +01:00
Lukas Bergdoll
2f3b952349 Stabilize assert_matches 2026-02-11 14:13:44 +01:00
John Kåre Alsaker
91a6126208 Use scope for par_slice instead of join 2026-02-09 07:59:18 +01:00
Zalathar
118372ed13 Replace some feature(core_intrinsics) with stable hints 2026-02-08 18:21:47 +11:00
Nicholas Nethercote
c9f827754a Make HashingControls impl Copy.
It has a single `bool` field.
2026-02-06 09:18:18 +11:00
WANG Rui
78b55fc337 Fix incorrect RSS on systems with non-4K page size
`get_resident_set_size` computed RSS by multiplying the number of pages
from `/proc/self/statm` with a hard-coded 4096-byte page size. This
produces incorrect results on systems where the runtime page size is
not 4 KiB.

Use `sysconf(_SC_PAGESIZE)` to determine the actual page size at runtime
so the RSS reported in `-Z time-passes` output is accurate across
platforms.
2026-02-04 23:32:36 +08:00
bors
0c40f5be0c Auto merge of #151929 - camsteffen:lengg, r=BoxyUwU
Use with_capacity in query_key_hash_verify and PlaceholderExpander

Addresses the first two items from https://github.com/rust-lang/rust/issues/137005#issuecomment-2687803558.
2026-02-03 22:20:57 +00:00
bors
57d2fb1366 Auto merge of #138405 - Zoxc:vec-cache-tweaks, r=Mark-Simulacrum
Tweak `VecCache` to improve performance

This has some tweaks to `VecCache` to improve performance.

- It saves a `compare_exchange` in `complete` using the new `put_unique` function.
- It removes bound checks on entries. These are instead checked in the `slot_index_exhaustive` test.
- `initialize_bucket` is outlined and tuned for that.

cc @Mark-Simulacrum
2026-02-01 18:57:12 +00:00
Cameron Steffen
f0b76d5a15 Use with_capacity in query_key_hash_verify 2026-01-31 18:57:32 -06:00
Zalathar
04e6afe20a Re-export hashbrown::hash_table from rustc_data_structures 2026-01-31 14:48:50 +11:00
Amanda Stjerna
4bdccabda5 Borrowck: Simplify SCC annotation computation, placeholder rewriting
This simplifies the `PlaceholderReachability` `enum` by
replacing the case when no placeholders were reached with
a standard `Option::None`.

It also rewrites the API for `scc::Annotations` to be update-mut
rather than a more Functional programming style. This showed some slight
performance impact in early tests of the PR and definitely makes
the implementation simpler.
2026-01-27 14:22:53 +01:00
John Kåre Alsaker
cd18a8d287 Tweak VecCache to improve performance 2026-01-26 22:36:00 +01:00
Andre Bogus
8c697128eb
refactor rustc-hash integration 2026-01-23 23:16:15 +01:00
Jonathan Brouwer
f03c1a2bd3
Rollup merge of #151423 - Voultapher:move-assert-matches, r=Amanieu
Move assert_matches to planned stable path

Another prep PR for https://github.com/rust-lang/rust/pull/137487
2026-01-22 13:35:41 +01:00
Mark Rousskov
3dc7a1f33b Bump stage0 2026-01-21 20:03:56 -05:00
Lukas Bergdoll
58be5d6620 Move assert_matches to planned stable path 2026-01-21 23:17:24 +01:00
Zalathar
7ec34defe9 Temporarily re-export assert_matches! to reduce stabilization churn 2026-01-19 18:26:53 +11:00
Esteban Küber
2766ccfd4e Make UnordSet and UnordMap const Default and use it in Resolver 2026-01-16 02:38:18 +00:00
Esteban Küber
bfd1a9a86f Use default_field_values more in Resolver
Provide `const` functions to get around lack of `const Default` for `FxHash*` types.

Use default field values in `Resolver` more.
2026-01-16 02:38:17 +00:00
bors
08de25c4ea Auto merge of #149273 - bjorn3:crate_locator_improvements, r=petrochenkov
Don't leak sysroot crates through dependencies

Previously if a dependency of the current crate depended on a sysroot crate, then `extern crate` would in the current crate would pick the first loaded version of said sysroot crate even in case of an ambiguity. This is surprising and brittle. For `-Ldependency=` we already blocked this since rust-lang/rust#110229, but the fix didn't account for sysroot crates.

Should fix https://github.com/rust-lang/rust/issues/147966
2025-12-14 09:16:11 +00:00
Andrew Zhogin
1b790cdcac Weak for Arc pointer is marked as DynSend/DynSync 2025-12-11 16:46:32 +07:00
bendn
919e46f4d4
stabilize [T]::array_windows 2025-12-02 00:37:17 +07:00
bjorn3
d10216a3a8 Fix rustc_hash ambiguity in miri
There are two rustc_hash crates in the sysroot when building miri and
there is no way to disambiguate between the two. Instead use the
re-exports of it in the rustc_data_structures crate.
2025-11-27 18:09:05 +00:00
bors
2636cb4c13 Auto merge of #148818 - Zalathar:rollup-4vujcg0, r=Zalathar
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#148694 (std: support `RwLock` and thread parking on TEEOS)
 - rust-lang/rust#148712 (Port `cfg_select!` to the new attribute parsing system)
 - rust-lang/rust#148760 (rustc_target: hide TargetOptions::vendor)
 - rust-lang/rust#148771 (IAT: Reinstate early bailout)
 - rust-lang/rust#148775 (Fix a typo in the documentation for the strict_shr function)
 - rust-lang/rust#148779 (Implement DynSend and DynSync for std::panic::Location.)
 - rust-lang/rust#148781 ([rustdoc] Remove unneeded `allow(rustc::potential_query_instability)`)
 - rust-lang/rust#148783 (add test for assoc type norm wf check)
 - rust-lang/rust#148785 (Replace `master` branch references with `main`)
 - rust-lang/rust#148791 (fix "is_closure_like" doc comment)
 - rust-lang/rust#148792 (Prefer to use file.stable_id over file.name from source map)
 - rust-lang/rust#148805 (rustc-dev-guide subtree update)
 - rust-lang/rust#148807 (Document (and test) a problem with `Clone`/`Copy` deriving.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-11 13:30:50 +00:00
Stuart Cook
01ae075dd1
Rollup merge of #148480 - Lysxia:steal-mut, r=davidtwco
Add `Steal::risky_hack_borrow_mut`

I'm working on a rustc driver (Creusot) which needs to modify the MIR read by two queries, `mir_borrowck` and `check_liveness`, in different ways for each query. Both of these queries use `mir_promoted` to read the MIR, which is immutable (until it is stolen).

This adds an escape hatch so rustc drivers can mutate MIR for specific queries. And this removes `get_mut` which is unused and also unusable now that there's no way to get a `&mut Steal` from the rustc API.

Another approach may be to override the queries to modify the MIR after having read it from `mir_promoted`. However the implementation of queries is largely hidden, so I can't just copy their code to then modify it. A solution would be to parameterize the queries with callbacks which get instantiated with `mir_promoted` by default, but that seems more involved and ad hoc. That's why I'm proposing this smaller change instead.
2025-11-11 21:09:36 +11:00
Zachary S
6bfb876b32 Implement DynSend and DynSync for std::panic::Location.
Required to allow the compiler to build with the debug_refcell stdlib cargo feature.
2025-11-10 01:40:21 -06:00
bjorn3
973c7527b4 Unify the configuration of the compiler docs
Previously it was rather inconsistent which crates got the rust logo and
which didn't and setting html_root_url was forgotten in many cases.
2025-11-05 11:25:27 +00:00
Li-yao Xia
79b396374e Add Steal::risky_hack_borrow_mut
and remove unused Steal::get_mut
2025-11-04 17:49:00 +01:00
Matthias Krüger
d7b9e66728
Rollup merge of #147716 - zhetaicheleba:master, r=jdonszelmann
Fix some comments

Fix some comments
2025-10-15 23:41:05 +02:00
Diggory Blake
c6a952159f
Restrict sysroot crate imports to those defined in this repo.
It's common to import dependencies from the sysroot via `extern crate`
rather than use an explicit cargo dependency, when it's necessary to use
the same dependency version as used by rustc itself. However, this is
dangerous for crates.io crates, since rustc may not pull in the
dependency on some targets, or may pull in multiple versions. In both
cases, the `extern crate` fails to resolve.

To address this, re-export all such dependencies from the appropriate
`rustc_*` crates, and use this alias from crates which would otherwise
need to use `extern crate`.
2025-10-15 13:17:25 +01:00
zhetaicheleba
07df2adbdf Fix some comments
Signed-off-by: zhetaicheleba <taicheleba@outlook.com>
2025-10-15 14:23:28 +08:00
Ralf Jung
7abbc9c8b2 avoid calling insert_presorted more than once 2025-09-10 08:40:12 +02:00
Ralf Jung
64ea775d27 interpret: copy_provenance: avoid large intermediate buffer for large repeat counts 2025-09-10 08:40:12 +02:00
lcnr
b8160e9f38 use defining uses of all bodies to constrain non-defining uses
support non-defining uses in closures
2025-09-01 22:08:03 +02:00
Camille Gillot
689171d38e Uplift rustc_mir_transform::coverage::counters::union_find to rustc_data_structures. 2025-08-22 02:22:51 +00:00
Jakub Beránek
4ef18ab062
Allow pretty printing paths with -Zself-profile-events=args 2025-07-25 22:24:21 +02:00
Jakub Beránek
37115f1bd6
Fix wrong cache event query key 2025-07-07 15:16:42 +02:00
Matthias Krüger
567c51d584
Rollup merge of #143406 - scottmcm:did-we-need-that-unsafe, r=compiler-errors
Remove some unnecessary `unsafe` in VecCache

I'm pretty sure, but until perf confirms,
r? ghost
2025-07-05 00:12:10 +02:00
Scott McMurray
15286f220e Remove some unnecessary unsafe in VecCache 2025-07-03 17:42:43 -07:00
Jana Dönszelmann
f6d37a25a9
Rollup merge of #134006 - klensy:typos, r=nnethercote
setup typos check in CI

This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying?

Also includes commits with actual typo fixes.

MCP: https://github.com/rust-lang/compiler-team/issues/817

typos check currently turned for:
* ./compiler
* ./library
* ./src/bootstrap
* ./src/librustdoc

After merging, PRs which enables checks for other crates (tools) can be implemented too.

Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr.

Check typos: `python x.py test tidy --extra-checks=spellcheck`
Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo)

Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03 13:29:35 +02:00
klensy
c76d032f01 setup CI and tidy to use typos for spellchecking and fix few typos 2025-07-03 10:51:06 +03:00
bors
b94bd12401 Auto merge of #142978 - Kobzol:query-hit, r=oli-obk
Add new self-profiling event to cheaply aggregate query cache hit counts

Self-profile can record various types of things, some of them are not enabled, like query cache hits. Rustc currently records cache hits as "instant" measureme events, which records the thread ID, current timestamp, and constructs an individual event for each such cache hit. This is incredibly expensive, in a small hello world benchmark that just depends on serde, it makes compilation with nightly go from ~3s (with `-Zself-profile`) to ~15s (with `-Zself-profile -Zself-profile-events=default,query-cache-hit`).

We'd like to add query cache hits to rustc-perf (https://github.com/rust-lang/rustc-perf/pull/2168), but there we only need the actualy cache hit counts, not the timestamp/thread ID metadata associated with it.

This PR adds a new `query-cache-hit-count` event. Instead of generating individual instant events, it simply aggregates cache hit counts per *query invocation* (so a combination of a query and its arguments, if I understand it correctly) using an atomic counter. At the end of the compilation session, these counts are then dumped to the self-profile log using integer events (in a similar fashion as how we record artifact sizes). I suppose that we could dedup the query invocations in rustc directly, but I don't think it's really required. In local experiments with the hello world + serde case, the query invocation records generated ~30 KiB more data in the self-profile, which was ~10% increase in this case.

With this PR, the overhead of `-Zself-profile` seems to be the same as before, at least on my machine, so I also enabled query cache hit counts by default when self profiling is enabled.

We should also modify `analyzeme`, specifically [this](https://github.com/rust-lang/measureme/blob/master/analyzeme/src/analysis.rs#L139), and make it load the integer events with query cache hit counts. I can do that as a follow-up, it's not required to be done in sync with this PR, and it doesn't require changes in rustc.

CC `@cjgillot`

r? `@oli-obk`
2025-07-02 11:41:14 +00:00
Jakub Beránek
b49ca021e1
Use portable AtomicU64 2025-07-02 10:04:35 +02:00
Josh Stone
e851e3e16e Update cfg(bootstrap) 2025-07-01 10:55:49 -07:00
Jakub Beránek
e8fc30ee05
Do not store empty cache hit counts 2025-06-26 08:14:34 +02:00