Commit graph

3517 commits

Author SHA1 Message Date
Felix Rath
8fa2f693bb
Implement incremental caching for derive macro expansions 2026-01-16 07:36:36 +01:00
Zalathar
539e855008 Use a hook to decouple rustc_mir_transform from rustc_mir_build 2026-01-10 22:14:35 +11:00
Philipp Krones
d28379895b
Update Cargo.lock 2026-01-09 10:39:33 +01:00
Matthias Krüger
74ab9a4784
Rollup merge of #150809 - update-literal-escaper, r=Urgau
Update `literal-escaper` version to `0.0.7`

It removes the `std` dependency for this crate (which doesn't change anything for rustc 😄 ).

cc @bjorn3
r? @Urgau
2026-01-08 22:21:21 +01:00
Matthias Krüger
3481c0d3cb
Rollup merge of #150569 - check_static_initializer_acyclic, r=workingjubilee
Ensure that static initializers are acyclic for NVPTX

NVPTX does not support cycles in static initializers (see rust-lang/rust#146787). LLVM produces an error when attempting to generate code for such constructs, like self-referential structs.

To avoid LLVM UB, we emit a post-monomorphization error on the Rust side before reaching codegen.

This is achieved by analyzing a subgraph of the "mono item graph" that only contains statics.
1. Calculate the strongly connected components (SCCs) of the graph.
2. Check for cycles (more than one node in an SCC or one node that references itself).
2026-01-08 16:25:30 +01:00
Guillaume Gomez
27b1083a96 Update literal-escaper version to 0.0.7 2026-01-08 14:10:33 +01:00
Urgau
bbdba48aeb Update tidy check for triagebot path mentions with glob support 2026-01-07 18:28:22 +01:00
kulst
630c7596e9 Ensure that static initializers are acyclic for NVPTX
NVPTX does not support cycles in static initializers. LLVM produces an error when attempting to codegen such constructs (like self referential structs).

To not produce LLVM UB we instead emit a post-monomorphization error on
Rust side before reaching codegen.

This is achieved by analysing a subgraph of the "mono item graph" that
only contains statics:
1. Calculate the strongly connected components (SCCs) of the graph
2. Check for cycles (more than one node in a SCC or exactly one node
   which references itself)
2026-01-06 17:00:21 +01:00
Alex Crichton
ba13bb44ed Update wasm-component-ld
Same as 147495, just keeping it up-to-date.
2026-01-05 08:07:07 -08:00
Ralf Jung
ff2acf0eca update lockfile 2026-01-04 12:44:38 +01:00
Jacob Pratt
97050d4174
Rollup merge of #150445 - petrochenkov:keepscope, r=nnethercote
resolve: Preserve binding scopes in ambiguity errors

It allows to get rid of `AmbiguityErrorMisc`, `Flags` and `extern_prelude_flag_binding`.

Also keep all encountered bindings in `resolve_ident_in_scope_set`, it allows to get rid of `extern_prelude_item_binding`.

This also unblocks https://github.com/rust-lang/rust/pull/149681 because the newly preserved data will help to fix the regressions in https://github.com/rust-lang/rust/pull/149681#issuecomment-3679059703 in a reasonable way.
2026-01-01 23:27:55 -05:00
bors
112a274275 Auto merge of #150348 - GuillaumeGomez:update-askama, r=kobzol,jieyouxu
Update askama version to `0.15`

New release comes with lots of improvements like improved compile-time. More information here: https://github.com/askama-rs/askama/releases/tag/v0.15.0

r? `@yotamofek`
2025-12-29 05:34:33 +00:00
Jonathan Brouwer
30618bb89c
Rollup merge of #148321 - Marcondiro:master, r=Mark-Simulacrum
parser/lexer: bump to Unicode 17, use faster unicode-ident

Hello,

Bump the unicode version used by lexer/parser to 17.0.0 by updating:
- `unicode-normalization` to 0.1.25
- `unicode-properties` to 0.1.4
- `unicode-width` to 0.2.2

and by replacing `unicode-xid` with `unicode-ident` which is also 6 times faster.
I think it might be worth to run the benchmarks to double check.
(`unicode-ident` is already in `src/tools/tidy/src/deps.rs`)

Thanks!
2025-12-28 22:52:29 +01:00
Guillaume Gomez
45592688cf Update askama version to 0.15 in generate-copyright 2025-12-28 20:49:17 +01:00
Guillaume Gomez
ac5a9d8815 Update askama version to 0.15 in librustdoc 2025-12-28 20:45:28 +01:00
dianqk
fe075ad212
Removes the serde dependency in rustc_codegen_llvm 2025-12-28 15:52:20 +08:00
Vadim Petrochenkov
1c7d3f0ff6 resolve: Preserve binding scopes in ambiguity errors
It allows to get rid of `AmbiguityErrorMisc` and `Flags`.
2025-12-27 22:50:02 +03:00
Marco Cavenati
ca64688b37
parser/lexer: bump to Unicode 17, use faster unicode-ident
Replace unicode-xid with unicode-ident which is 6 times faster
2025-12-27 11:20:24 +01:00
Philipp Krones
b04a3dce20
Update Cargo.lock 2025-12-25 23:25:04 +01:00
Michael Howell
69f987dbe8 Bump stringdex, fix compiler-docs
Fixes https://github.com/rust-lang/rust/issues/150346
2025-12-24 19:53:06 -07:00
Michael Howell
08c396b91e rustdoc: upgrade to stringdex 0.0.4
- code cleanup
- smaller encoding for runs
- fast path for the common encoding case
2025-12-20 23:44:06 -07:00
sgasho
ddd5aad8a3 feat: dlopen Enzyme 2025-12-16 00:31:32 +09:00
bors
8188f6c808 Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco
Overhaul filename handling for cross-compiler consistency

This PR overhauls the way we handle filenames in the compiler and `rmeta` in order to achieve achieve cross-compiler consistency (ie. having the same path no matter if the filename was created in the current compiler session or is coming from `rmeta`).

This is required as some parts of the compiler rely on consistent paths for the soundness of generated code (see rust-lang/rust#148328).

In order to achieved consistency multiple steps are being taken by this PR:
 - by making `RealFileName` immutable
 - by only having `SourceMap::to_real_filename` create `RealFileName`
   - currently `RealFileName` can be created from any `Path` and are remapped afterwards, which creates consistency issue
 - by also making `RealFileName` holds it's working directory, embeddable name and the remapped scopes
   - this removes the need for a `Session`, to know the current(!) scopes and cwd, which is invalid as they may not be equal to the scopes used when creating the filename

In order for `SourceMap::to_real_filename` to know which scopes to apply `FilePathMapping` now takes the current remapping scopes to apply, which makes `FileNameDisplayPreference` and company useless and are removed.

This PR is split-up in multiple commits (unfortunately not atomic), but should help review the changes.

Unblocks https://github.com/rust-lang/rust/pull/147611
Fixes https://github.com/rust-lang/rust/issues/148328
2025-12-13 14:32:09 +00:00
Matthias Krüger
e0e575cfa9
Rollup merge of #149884 - flip1995:clippy-subtree-update, r=matthiaskrgr
Clippy subtree update

r? ``````@Manishearth``````

Cargo.lock update due to Clippy version bump.
2025-12-12 12:19:11 +01:00
Urgau
8cbfb26383 Overhaul filename handling for cross-compiler consistency
This commit refactors `SourceMap` and most importantly `RealFileName` to
make it self-contained in order to achieve cross-compiler consistency.

This is achieved:
 - by making `RealFileName` immutable
 - by only having `SourceMap::to_real_filename` create `RealFileName`
 - by also making `RealFileName` holds it's working directory,
   it's embeddable name and the remapped scopes
 - by making most `FileName` and `RealFileName` methods take a scope as
   an argument

In order for `SourceMap::to_real_filename` to know which scopes to apply
`FilePathMapping` now takes the current remapping scopes to apply, which
makes `FileNameDisplayPreference` and company useless and are removed.

The scopes type `RemapPathScopeComponents` was moved from
`rustc_session::config` to `rustc_span`.

The previous system for scoping the local/remapped filenames
`RemapFileNameExt::for_scope` is no longer useful as it's replaced by
methods on `FileName` and `RealFileName`.
2025-12-12 07:33:09 +01:00
Philipp Krones
26c164f60c
Update Cargo.lock 2025-12-11 19:16:53 +01:00
Guillaume Gomez
5c47240ad1 Correctly handle doc(test(attr(...))) 2025-12-10 12:27:34 +01:00
Guillaume Gomez
131323f910 Migrate doc(cfg) to new Attribute API 2025-12-10 12:27:33 +01:00
Guillaume Gomez
acb32df7b1 Continue migration to new Attribute API for doc attribute 2025-12-10 12:27:33 +01:00
bors
ba2142a19c Auto merge of #149517 - WaffleLapkin:alphabet-blessing, r=jdonszelmann
Implement blessing for tidy alphabetical check

r? `@jdonszelmann`
2025-12-07 20:08:33 +00:00
Jonathan Brouwer
8f59eb0177
Move attribute lints to rustc_lint 2025-12-05 14:22:52 +01:00
Waffle Lapkin
4e9c504cbf
implement tidy bless for alphabetical blocks 2025-12-03 20:57:26 +01:00
Scott Schafer
b2b059c20b
chore: Update annotate-snippets to 0.12.10 2025-12-01 18:12:35 -07:00
Mads Marquart
522e47fd60 miri: use tikv-jemalloc-sys from sysroot
This allows LTO to work when compiling jemalloc, which should yield a
small performance boost, and makes miri's behaviour here match clippy
and rustdoc.
2025-11-24 10:00:23 +01:00
Matthias Krüger
d48305fa5b
Rollup merge of #149077 - Muscraft:annotate-snippets-simd, r=davidtwco
feat: Enable annotate-snippets' simd feature

`annotate-snippets` `simd` feature enables the use of `memchr` when searching for `char`/`str`. This should hopefully improve performance when [`annotate-snippets` is passed large `source`](https://github.com/rust-lang/rust/pull/148188#issuecomment-3550280300).
2025-11-22 18:41:22 +01:00
bors
5934b06557 Auto merge of #148831 - clubby789:cargo-update-11-11-25, r=jieyouxu
Bump compiler dependencies

https://github.com/rust-lang/rust/pull/145849#issuecomment-3394832713
This manually downgrades the `wasip`/`wit-bindgen`/`getrandom` deps to avoid pulling in a binary blob, but it would be good to pin this automatically in a way which doesn't cause these blobs to be pulled in.
2025-11-22 00:00:06 +00:00
Guillaume Gomez
629a283b98
Rollup merge of #149043 - aDotInTheVoid:is-this-real-is-this-out-of-spite-does-it-matter, r=GuillaumeGomez
rustdoc-json: add rlib path to ExternalCrate to enable robust crate resolution

Historically, it's not been possible to robustly resolve a cross-crate item in rustdoc-json. If you had a `Id` that wasn't in `Crate::index` (because it was defined in a different crate), you could only look it up it `Crate::paths`. But there, you don't get the full information, only an `ItemSummary`. This tells you the `path` and the `crate_id`.

But knowing the `crate_id` isn't enough to be able to build/find the rustdoc-json output with this item. It's only use is to get a `ExternalCrate` (via `Crate::external_crates`). But that only tells you the `name` (as a string). This isn't enough to uniquely identify a crate, as there could be multiple versions/features [^1] [^2].

This was originally proposed to be solved via `@LukeMathWalker's` `--orchestrator-id` proposal (https://github.com/rust-lang/compiler-team/issues/635). But that requires invasive changes to cargo/rustc. This PR instead implements `@Urgau's` proposal to re-use the path to a crate's rmeta/rlib as a unique identifer. Callers can use that to determine which package it corresponds to in the language of the build-system above rustc. E.g. for cargo, `cargo rustdoc --message-format=json --output-format=json -Zunstable-options`).

(Once you've found the right external crate's rustdoc-json output, you still need to resolve the path->id in that crate. But that's """just""" a matter of walking the module tree. We should probably still make that nicer (by, for example, allowing sharing `Id`s between rustdoc-json document), but that's a future concern)

For some notes from RustWeek 2025, where this was designed, see https://hackmd.io/0jkdguobTnW7nXoGKAxfEQ

CC `@obi1kenobi` (who wants this for cargo-semver-checks [^3]), `@epage` (who's conversations on what and wasn't possible with cargo informed taking this approach to solve this problem)

r? `@GuillaumeGomez`

## TODO:

- [x] Docs: [Done](e4cdd0c24a..457ed4edb1)
- [x] Tests: [Done](2e1b954dc5..4d00c1a7ee)

[^1]: https://github.com/rust-lang/compiler-team/issues/635#issue-1714254865 § Problem
[^2]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Identifying.20external.20crates.20in.20Rustdoc.20JSON/with/352701211
[^3]: https://github.com/obi1kenobi/cargo-semver-checks/issues/638
2025-11-21 21:34:26 +01:00
Jamie Hill-Daniel
36bdffea59 Bump compiler dependencies 2025-11-21 16:11:00 +00:00
Matthias Krüger
37dc26c816
Rollup merge of #149071 - ferrocene:pvdrz/remote-test-client-timeout-tests, r=jieyouxu
Add test scaffolding for the `remote-test-client`

r? ``@jieyouxu``
2025-11-20 11:15:55 +01:00
Matthias Krüger
34b3c9dd4d
Rollup merge of #148261 - aDotInTheVoid:no-sync-for-smir, r=celinval
rustc_public: Make Id types !Send / !Sync

These types are Id's to a table stored in TLS, so using them from another tread will either panic, or give wrong results.

Therefor, I've added a ~~`ReferencesTls`~~`ThreadLocalIndex`  marker type, which ensures types arn't `Send`/`Sync`.

This is a breaking change for users of the `rustc_public` crate.

~~It also changes how `DefId` and similar are `Serialize`d. It would be possible to preserve the old behavior if that's needed, but I couldn't see any tests for these.~~ EDIT: Not anymore: https://github.com/rust-lang/rust/pull/148261#discussion_r2476111612

Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/channel/320896-project-stable-mir/topic/WDYM.20.22should.20not.20.20be.20shared.20across.20threads.22/with/547374171
2025-11-20 11:15:52 +01:00
Alona Enraght-Moony
e7b84604cb rustc_public: Make Id types !Send / !Sync
These types are Id's to a table stored in TLS, so using them from
another tread will either panic, or give wrong results.

Therefor, I've added a `ThreadLocalIndex` marker type, which ensures types
arn't `Send`/`Sync`.

This is a breaking change for users of the `rustc_public` crate.

Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/channel/320896-project-stable-mir/topic/WDYM.20.22should.20not.20.20be.20shared.20across.20threads.22/with/547374171
2025-11-19 19:46:18 +00:00
Alona Enraght-Moony
8c569c1416 run-make-support: re-export rustdoc_json_types
This is useful for allowing writing run-make tests that test
rustdoc-json.
2025-11-19 19:36:43 +00:00
Christian Poveda
cdd88963c8
Add test scaffolding for the remote-test-client 2025-11-19 12:14:34 -05:00
Scott Schafer
60427ac5be
feat: Enable annotate-snippets' simd feature 2025-11-18 19:07:18 -07:00
Ralf Jung
eafd125d1f update lockfile 2025-11-17 13:34:27 +01:00
Scott Schafer
463c6cea68
chore: Update annotate-snippets to 0.12.9 2025-11-15 14:45:21 -07:00
Alex Crichton
8043cf3a82 Update wasm-component-ld to 0.5.19
Same as 147495, just keeping it up-to-date.
2025-11-14 12:57:00 -08:00
bors
7a72c5459d Auto merge of #148896 - Kobzol:revert-146627, r=madsmtm
Revert "Rollup merge of #146627 - madsmtm:jemalloc-simplify, r=jdonszelmann"

This reverts commit 5dc3c19417, reversing
changes made to 11339a0ef5.

Reverts https://github.com/rust-lang/rust/pull/146627 due to a [perf regression](https://github.com/rust-lang/rust/pull/148851#issuecomment-3525797560).

r? `@Zalathar`
2025-11-13 21:15:20 +00:00
Jakub Beránek
ccd87959ed
Revert "Rollup merge of #146627 - madsmtm:jemalloc-simplify, r=jdonszelmann"
This reverts commit 5dc3c19417, reversing
changes made to 11339a0ef5.
2025-11-13 10:29:26 +01:00
Yotam Ofek
e921e28c7a Upgrade stringdex to 0.0.3 2025-11-13 10:15:30 +02:00