3909 Commits

Author SHA1 Message Date
mejrs
e547f10ccc misc perf stuff 2026-10-13 14:18:17 +02:00
bors
ae0fe511b1 Auto merge of #163959 - joshtriplett:upgrade-thin-vec, r=nnethercote
Upgrade `thin-vec` to 0.2.21, including fix for `.collect()` capacity

This includes https://github.com/mozilla/thin-vec/pull/99 , which makes thin-vec respect size_hint when collecting.

In particular, this causes collections of 1-3 items to not be grown to a capacity of 4. The compiler has a lot of `TinyVec`s in the 1-3 range, so this substantially helps memory, and seems neutral on instructions.

For aws-sdk-ec2 full check, this saves 30.69 MiB max-rss (0.55% of peak RSS).

---

Merging this avoids the need to work around it in other work (e.g. by replacing `.collect()` with something calling `ThinVec::with_capacity(...)` first).
2026-10-08 17:29:08 +00:00
Josh Triplett
611e0fdb82 Upgrade thin-vec to 0.2.21, including fix for .collect() capacity
This includes https://github.com/mozilla/thin-vec/pull/99 , which makes
thin-vec respect size_hint when collecting.

In particular, this causes collections of 1-3 items to not be grown to a
capacity of 4. The compiler has a lot of `TinyVec`s in the 1-3 range, so
this substantially helps memory, and seems neutral on instructions.

For aws-sdk-ec2 full check, this saves 30.69 MiB max-rss (0.55% of peak
RSS).
2026-10-07 17:25:36 -07:00
Jonathan Brouwer
dfa9cf1386 Rollup merge of #163348 - xonx4l:improper_ctypes-lint-cache, r=nnethercote
perf:cache FFI safety results in improper_ctypes lint

This PR cache FFI safety results in improper_ctypes lint .

ImproperCTypesVisitor's cache field is recreated empty at every call site, so a struct type gets fully re-walked from scratch each time instead of once .

The implementation here moves the cache onto ImproperCtypesLint, so it remembers types we already checked and found FFI-safe, so we don't check the same type again every time it shows up in another function. We only remember "safe" types, never "unsafe" ones. That way we never need to keep the actual type around, just a fingerprint of it.Thus it persists across a whole module worth of foreign items.
2026-10-07 22:53:01 +02:00
tmiasko
3b3e0980a6 Annotate MIR with dataflow results for testing purposes
When requested through an internal rustc attribute, include dataflow
results in MIR output, i.e., `-Zunpretty=mir` or `--emit mir`.

For now, supported dataflows are:
* `#[rustc_mir(rustc_pretty_live_locals)]`
* `#[rustc_mir(rustc_pretty_transitive_live_locals)]`

The mechanism is intended to supersede existing `rustc_peek` intrinsic.
For demonstration also migrates one of tests based on `rustc_peek`:
tests/ui/mir-dataflow/liveness-projection.rs.
2026-10-04 15:12:57 +00:00
Ralf Jung
6d70bb1e20 bump rustc-build-sysroot 2026-10-02 08:47:06 +02:00
xonx4l
fa3bfde261 fix build errors 2026-10-01 16:44:49 +05:30
Philipp Krones
7d0683fd2f Update Cargo.lock 2026-10-01 11:30:40 +02:00
Ralf Jung
5658d6b808 update lockfile 2026-09-30 12:12:21 +02:00
Trevor Gross
e7ac0de1e2 Rollup merge of #163427 - khyperia:gca-adts, r=BoxyUwU
implement #![feature(gca_adts)]

Tracking issue: https://github.com/rust-lang/rust/issues/163420

r? @BoxyUwU
2026-09-28 23:20:41 -05:00
bors
c1070d6938 Auto merge of #163449 - JonathanBrouwer:rollup-RD7XqTw, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#163327 (remove `MutTy`)
 - rust-lang/rust#162910 (Deterministic encoding of `DefPathHashMap`)
 - rust-lang/rust#163009 (dont store arbitrary parsed attributes in thir)
 - rust-lang/rust#162683 (Use attribute parser for `#[inline()]` attribute check)
 - rust-lang/rust#163429 (lint on `Ident::from_str_and_span` taking a string literal)
 - rust-lang/rust#163431 (Allow `#[repr(simd)]` with `f16b`)
 - rust-lang/rust#163433 (Support also `try-jobs:` to specify custom try jobs)
2026-09-28 15:28:49 +00:00
Jonathan Brouwer
2cc3eebcd2 Rollup merge of #162910 - aerooneqq:det-def-path-hash-map-encoding, r=petrochenkov
Deterministic encoding of `DefPathHashMap`

This PR splits DefPathHashMap into two parts: deterministic (`det_part`) and non-deterministic (`non_det_part`). `det_part` is used while we sure that allocation and insertion order of def ids is deterministic, at the moment of writing it happens before we start parallel checks after prefetch of `hir_crate_items` in `run_required_analysis`. Up until this point of compilation the allocation of def ids and their insertion order into `det_part` should be the same between different compilations.

Next, when non-determinism starts due to parallel compilation we put all mapping between local hash and def ids into a `SortedMap` which gives us ready-to-use sorted by local hash slice of pairs to encode while encoding metadata.

Note, that this PR does not solve the problem of allocation of different def indices to same code entities (meaning same local hash), this problem is solved in rust-lang/rust#162809 by remapping needed local def indices.
Also note that we serialize `det_part` as a raw bytes sequence, so during remapping if we do not place all def indices that are needed to be remapped into separate container we will end up with copying `det_part`, changing some entries in it and then serialize it as a bytes sequence. With the approach in this PR we do not copy and modify `det_part`, instead we do all modifications in `non_det_part`.

r? @petrochenkov
2026-09-28 16:45:09 +02:00
khyperia
9e8ca583f8 implement #![feature(gca_adts)] 2026-09-28 15:50:47 +02:00
Jonathan Brouwer
773bab3921 Rollup merge of #163303 - nnethercote:fix-Span-eq-ord, r=oli-obk
Remove `PartialOrd`/`Ord` impls for `Span`/`SpanData`

Because they are inconsistent with the `PartialEq`/`Eq` impls, and span ordering is inherently dubious. Details in individual commits.

r? @oli-obk
2026-09-28 14:19:39 +02:00
Jonathan Brouwer
1c87a25d83 Rollup merge of #163250 - mejrs:hir_imports3, r=JonathanBrouwer
Remove rustc_hir's attribute re-exports

Followup to https://github.com/rust-lang/rust/pull/160336, see also rust-lang/rust#163170, rust-lang/rust#163207 and rust-lang/rust-clippy/pull/17714

Very minor touchups here and there, nothing involving code changes.

r? @JonathanBrouwer
2026-09-27 18:58:12 +02:00
Nicholas Nethercote
4326cf73a3 Remove PartialOrd/Ord impls for Span/SpanData
`Span` and `SpanData` encode four fields: `lo`/`hi`, `ctxt`, and
`parent`. `ctxt` and `parent` have unorderable types.

Both types ignore `ctxt` and `parent` for `PartialOrd`/`Ord`. But their
`PartialEq`/`Eq` impls do *not* ignore those fields. This eq/ord
inconsistency is a bug. It was introduced in #123165.

The idea of ordering spans in general is dubious, because of `ctxt` and
`parent`. But the idea of ordering spans just with `lo`/`hi` is fine.
Therefore, this commit does the following.

- Removes the `PartialOrd`/`Ord` impls for `Span`/`SpanData`

- Adds a `Span::lo_hi` method which can be used in lots of places where
  span locations are involved in sorting. E.g.
  `xs.sort_by_key(|span| span.lo_hi())`

- Adds `OrdSpan`, a newtype around `Span` that impls
  `PartialEq`/`Eq`/`PartialOrd`/`Ord` using `lo_hi`. This is for storing
  spans in ordered types like `BTreeMap<OrdSpan, T>`.

Note also that some `sort`+`dedup` combinations might not remove all
duplicates with the old eq/ord inconsistency. These now all do the right
thing, which could affect some error messages, though in practice
nothing in the test suite is affected.
2026-09-26 09:05:21 +10:00
Daniel Smith
79ee8dc080 Hash metadata with XXH3-128 instead of SipHash-128 for the crate SVH
The SVH is computed by hashing the entire encoded metadata blob, and
SipHash-128 (~2.5 Ir/byte) dominated the cost — it accounted for the whole
of the measured regression on metadata-heavy crates. Switch the byte pass to
XXH3-128, which is ~10x cheaper per byte on its runtime-detected AVX2 path.

XXH3 is non-cryptographic, which is fine here: the SVH is only a change
detector, must be reproducible (so it is never keyed secretly, meaning even
the previous SipHash use was not collision-resistant), and compiling a crate
already executes its build scripts and proc-macros, so the crate author is
trusted regardless. The untracked supplements (dep-tracking hash and the HIR
hash for e.g. DefKind::GlobalAsm) are still folded in via a StableHasher
fingerprint, so coverage is unchanged.

twox-hash 2.x is already in the dependency graph via ruzstd; this only adds a
direct edge (xxhash3_128 + std features for the runtime SIMD dispatch).
2026-09-25 14:56:29 -04:00
mejrs
564f208ba9 compiler: remove rustc_hir attr re-exports 2026-09-25 18:39:43 +02:00
Augie Fackler
db4d334408 cleanup: clean up more dependencies that are unused
Some were wholly unused, others were unused other than as dev-deps but
specified as regular dependencies. This cleans things up a little bit.

I used an LLM to smoke out the candidates for this cleanup, but the rest
was done by hand.
2026-09-24 14:01:17 -04:00
mejrs
693bf504c7 Update deprecated rustc_hir imports 2026-09-23 14:27:49 +02:00
Roland Xu
af2ca5267d Rollup merge of #163170 - mejrs:hir_imports, r=oli-obk
Update deprecated rustc_hir imports

Followup to https://github.com/rust-lang/rust/pull/160336

That's ~half of them, I'm not doing it all in one go to reduce conflicts.
2026-09-23 09:55:44 +08:00
mejrs
78d478a7e4 Update deprecated rustc_hir imports 2026-09-22 23:31:09 +02:00
Jonathan Brouwer
5586b8f14d Rollup merge of #163135 - durin42:base64-upgrade, r=Urgau
librustdoc: remove stale dep on base64

This appears to have become unused in August 2025. I noticed today because of trying to consolidate versions of things in the toolchain.
2026-09-22 22:50:36 +02:00
Yacin Tmimi
51aa65eabb chore: bump rustfmt version to v1.11.0 2026-09-21 22:25:57 -04:00
Augie Fackler
240e41a85e librustdoc: remove stale dep on base64
This appears to have become unused in August 2025. I noticed today
because of trying to consolidate versions of things in the toolchain.
2026-09-21 16:26:16 -04:00
aerooneqq
0dde918649 Deterministic def path hash map encoding 2026-09-21 14:48:10 +03:00
bors
50d54098ec Auto merge of #162920 - JonathanBrouwer:rollup-rnSnu16, r=JonathanBrouwer
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#161987 (fix `is_single_fp_element` for `s390x` and `x86`)
 - rust-lang/rust#162366 (Replace hard linked `metadata.rmeta` with a copy when finalizing the incremental compilation session dir fails)
 - rust-lang/rust#162552 (RISC-V: Add Zmmul target feature)
 - rust-lang/rust#162602 (Ensure concurrent rustc instances in the same process correctly lock the session dir)
 - rust-lang/rust#162885 (Remove one remaining use of `Level::Help`)
 - rust-lang/rust#162606 (c-b: Export `fmaf16` now that we have an implementation)
 - rust-lang/rust#162817 (rustc_{codegen_,}llvm: adapt to new ThreadModel API)
 - rust-lang/rust#162860 (offload: add libLLVM rpath for libomptarget)
 - rust-lang/rust#162895 (Avoid derive edits on macro-generated types)
 - rust-lang/rust#162899 (Error on invalid placements of the `cfi_encoding` attribute.)
2026-09-18 01:17:44 +00:00
Jonathan Brouwer
ed96d94d78 Rollup merge of #162602 - bjorn3:safer_fcntl_fallback, r=oli-obk
Ensure concurrent rustc instances in the same process correctly lock the session dir

This introduces a global lock registry for the `fcntl` lock fallback to allow emulating fd based locks (like `flock()`) on top of the `fcntl(F_SETLK)` process based locks, thereby ensuring that concurrent rustc instances inside the same process don't break the incr comp locking scheme.

Based on https://github.com/rust-lang/rust/pull/162584
2026-09-17 21:00:10 +02:00
bors
330d317121 Auto merge of #162898 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? Manishearth

`Cargo.lock` update due to dep cleanup in Clippy.
2026-09-17 18:48:19 +00:00
Philipp Krones
13a3610079 Update Cargo.lock 2026-09-17 14:12:09 +02:00
Nicholas Nethercote
79d24a0679 Move operations out of rustc_middle::query::job
Generally `rustc_middle::query` has types while `rustc_query_impl` has
operations. So this commit moves some operations from the former to the
latter. Some of them are just moved, while others are inlined and
removed.
2026-09-17 10:52:30 +10:00
bjorn3
0143ce1a52 Have a separate copy of the flock code for rustdoc
This copy will retain and is specialized for blocking operations.
2026-09-16 12:18:56 +02:00
bors
3fcfc54fbc Auto merge of #161200 - mejrs:fake_item_queries, r=camelid
querify getting fake doc items
2026-09-12 21:05:12 +00:00
mejrs
8123f4ab2d querify getting fake doc items 2026-09-12 19:24:44 +02:00
Zalathar
df15f022ef Disconnect rustc_codegen_ssa from rustc_mir_transform
The direct dependency from `rustc_codegen_ssa` to `rustc_mir_transform` allowed
codegen to reuse some MIR-transform code for identifying unnecessary landing
pads.

However, we can achieve the same result by calling through a hook on `TyCtxt`,
eliminating the crate dependency.
2026-09-12 21:59:29 +10:00
Jacob Pratt
4e1c7f9f55 Rollup merge of #162270 - ChrisDenton:winagain, r=clarfonthey
Update `windows-bindgen` to 0.100.0

This release represents a major change in the way bindings are generated. See https://github.com/microsoft/windows-rs/issues/4867 for details.

In short, it now more directly follows the C headers. For the standard library's purposes this is mostly reflected in relatively minor type changes or with some `const` pointers becoming `mut`.

There is however one big change that affects a lot of types. In the headers there are a lot of `#define`s like this:

```c
#define GENERIC_READ                     (0x80000000L)
#define GENERIC_WRITE                    (0x40000000L)
```

These are constants for the access mode. In this case they're explicitly declared as `L` (aka signed long) integer types (in other cases there's no type at all). However, this conflicts with how access mode constants are actually used. E.g., see `CreateFileW`:

```c
WINBASEAPI
HANDLE
WINAPI
CreateFileW(
    _In_ LPCWSTR lpFileName,
    _In_ DWORD dwDesiredAccess,
    _In_ DWORD dwShareMode,
    _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
    _In_ DWORD dwCreationDisposition,
    _In_ DWORD dwFlagsAndAttributes,
    _In_opt_ HANDLE hTemplateFile
    );
```

Here `dwDesiredAccess` is a `DWORD`, which in rust equates to `u32`. The constant being signed but the usage being unsigned is not a problem for C/C++. They will happily convert between types at the drop of a hat. Rust however is stricter, as you know.

The old metadata used by `windows-bindgen` tried to try to fixup this mismatch but the new one goes strictly by what can be inferred from the headers.  The hope in the future is that the headers themselves will be updated so better bindings can be directly derived from them.
2026-09-11 00:03:06 -04:00
bors
f207aa3913 Auto merge of #162333 - Zalathar:rollup-DdpfsFl, r=Zalathar
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#162324 (miri subtree update)
 - rust-lang/rust#162170 (bootstrap: use target's LLVM libdir when cross-compiling)
 - rust-lang/rust#158312 (Adds support for AArch64 SVE to inline assembly)
 - rust-lang/rust#159792 (A more readable debug map for IndexMaps)
 - rust-lang/rust#160745 (make closures act like MaybeDangling)
 - rust-lang/rust#161263 (break rustc_expand-rustc_middle dependency)
 - rust-lang/rust#161895 (std::sys::pal::sgx: fix mismatched alloc/free alignment)
 - rust-lang/rust#161940 (Promote `wasm32-wasip3` to a tier 2 target)
 - rust-lang/rust#161397 (coverage: Tidy tests and add some new ones)
 - rust-lang/rust#161616 (Report precondition violation for `<usize as SliceIndex>::get_unchecked` in const-eval)
 - rust-lang/rust#162248 (Add regression test for unsized const parameter default ICE)
 - rust-lang/rust#162250 (Fix hashing of span end columns in incremental compilation)
 - rust-lang/rust#162265 (cargotest: add lockfiles)
 - rust-lang/rust#162318 (bootstrap: Fix broken path for `./x doc compiler/rustc --open`)
2026-09-05 17:04:57 +00:00
mejrs
297c72a614 break rustc_expand-rustc_middle dependency 2026-09-05 02:17:36 +02:00
Jonathan Brouwer
9af53e9b6d Rollup merge of #160936 - Dnreikronos:traits/live_args_bitset, r=lcnr,jackh726,adwinwhite
traits: Represent live alias arguments as bitsets

Split out of rust-lang/rust#160212 per review / Zulip: https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/rigid.20aliases.20in.20region.20handling/near/615557841

`live_args_for_alias_from_outlives_bounds` and `args_known_to_outlive_alias_params` now return identity arg indices (`DenseBitSet`) instead of `EarlyBinder<GenericArg>`. Callers just do `args[idx].visit_with(...)`, so we stop laundering rigidness through binder instantiate. Also drops the old BitSet FIXME.

imo this is worth doing on its own even without the ICE fix. every time we shoved identity params through `EarlyBinder` we were writing down something we don't actually know, and this module is only going to grow. better to make the invariant explicit now than keep paying for it later.

No behavioral change intended. the rigid-alias ICE / `extract_verify_if_eq` bits stay on rust-lang/rust#160212. btw if that one should stack on this instead of staying independent, lmk and I'll rebase it asap.
2026-09-04 22:29:07 +02:00
Chris Denton
9bce023c1f Upgrade windows-bindgen in generate-windows-sys 2026-09-04 14:30:51 +00:00
Guillaume Gomez
3d6b9b4dee Update askama version to 0.16.1 2026-09-04 14:48:32 +02:00
Jonathan Brouwer
f0fd2caeeb Rollup merge of #157808 - 1c3t3a:sanitizer-ignorelist, r=rcvalle
sanitizers: Implement support for the sanitize ignorelist

The sanitize ignorelist gives central controls over which functions, files, etc. should be ignored and not sanitized. It is a common file format for clang and explained here:
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change adds support for this list in Rust as well.

r? @rcvalle
2026-09-04 09:44:44 +02:00
Bastian Kersting
c0e55d66cc sanitizers: Implement support for the sanitize ignorelist
The sanitize ignorelist gives central controls over which functions,
files, etc. should be ignored and not sanitized. It is a common file
format for clang and explained here:
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change
adds support for this list in Rust as well.
2026-09-03 15:53:04 +00:00
bors
59dabe56f7 Auto merge of #162135 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? Manishearth 

2 days early, as cargo needs a fix that landed in Clippy last week and @weihanglo pointed out to me that I might run into bors queue stalls on Thursday with the 1.98.1 release.
2026-09-02 10:44:38 +00:00
Jonathan Brouwer
fdfd0e0ac9 Rollup merge of #161287 - robertbastian:23, r=Manishearth
Update `icu_list` dependency to 2.3

This removes the `icu_collections` transitive dependency, and uses the smaller `icu_locale_fallback` instead of `icu_locale`.

r? manishearth
2026-09-01 21:26:11 +02:00
Philipp Krones
c82e1d80a5 Update Cargo.lock 2026-09-01 18:39:31 +02:00
Robert Bastian
80dc5df240 Update icu_list to 2.3 2026-09-01 13:45:58 +02:00
Jonathan Brouwer
bcaa514284 Rollup merge of #162097 - mejrs:instrumentfnattr, r=JonathanBrouwer
Deduplicate `InstrumentFnAttr`

cc @pmur

Instead of having a `Default` variant (which can't be specified in the attribute, it only does on/off), use an Option to model "no attribute used".
2026-09-01 13:27:46 +02:00
Jonathan Brouwer
dbfa398db0 Rollup merge of #162075 - mejrs:track_caller_closure_gating, r=JonathanBrouwer
Move track_caller on closures gating to attribute parsing

I noticed this while reviewing rust-lang/rust#161958
2026-09-01 13:27:45 +02:00
Jonathan Brouwer
8536b9e91a Rollup merge of #162051 - nnethercote:rustc_feature-cleanups, r=JonathanBrouwer
`rustc_feature` cleanups

Various cleanups. Details in individual commits.

r? @JonathanBrouwer
2026-09-01 13:27:43 +02:00