Commit Graph

3680 Commits

Author SHA1 Message Date
malezjaa 39f7cdb8e6 update thin-vec 2026-04-08 21:09:07 +02:00
bors e26dedca9d Auto merge of #154914 - Muscraft:update-annotate-snippets, r=jieyouxu
chore: Update annotate-snippets to 0.12.15

This PR updates `annotate-snippets` to [`0.12.15`](https://github.com/rust-lang/annotate-snippets-rs/blob/main/CHANGELOG.md#01215---2026-04-06), which includes a fix for rust-lang/rust#154258, as well as a number of other fixes over [`0.12.10`](https://github.com/rust-lang/annotate-snippets-rs/blob/main/CHANGELOG.md#01210---2025-12-01).

fixes rust-lang/rust#154258
2026-04-08 10:15:57 +00:00
Scott Schafer 63ed113d84 chore: Update annotate-snippets to 0.12.15 2026-04-06 14:48:52 -06:00
Alex Crichton 262d35bda5 Update wasm-component-ld to 0.5.22
Same as 147495, just keeping it up-to-date.
2026-04-06 07:17:00 -07:00
Jonathan Brouwer f359441c73 Rollup merge of #154830 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/ce20bd38b1a5361dee26cac090e7f74fc0530d4b.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-04-05 00:18:46 +02:00
Ralf Jung 21256d86e4 update lockfile 2026-04-04 22:52:56 +02:00
Edvin Bryntesson 58168028f9 add field attr_id to attr parser's AcceptContext 2026-04-03 11:08:10 +02:00
bors 009a6c1e8b Auto merge of #154308 - ShoyuVanilla:undo-fudge-iv, r=jieyouxu
Revert #151380 and #153869

cc https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports/topic/.23153869.3A.20beta-nominated/with/581306395

r? ghost
2026-04-02 00:09:59 +00:00
bors 0e95a0f4c6 Auto merge of #154637 - JonathanBrouwer:rollup-fGsU36o, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#154419 (Take first task group for further execution)
 - rust-lang/rust#154569 (Fix  type alias where clause suggestion spacing issue)
 - rust-lang/rust#154617 (Update flate2 users to use zlib-rs)
 - rust-lang/rust#154618 (Fix AtomicPtr::update's cfg gate)
 - rust-lang/rust#154620 (stabilize new Range type and iterator)
 - rust-lang/rust#151932 (refactor: remove `Adjust::ReborrowPin`)
 - rust-lang/rust#153980 (refactor: move doc(rust_logo) check to parser)
 - rust-lang/rust#154134 (fix: guard paren-sugar pretty-printing on short trait args)
 - rust-lang/rust#154270 (Create `Ty` type alias in `rustc_type_ir`)
 - rust-lang/rust#154580 (Split AttributeParserError Diagnostic implementation into subfunctions)
 - rust-lang/rust#154606 (misc test cleanups)
 - rust-lang/rust#154612 (Add a test for a now fixed ICE with `offset_of!()`)
2026-03-31 16:44:16 +00:00
Josh Triplett 722b2d3626 Cargo.lock: Update for zlib-rs 2026-03-30 18:43:16 -07:00
Ralf Jung 79d00dbf25 update lockfile 2026-03-30 14:48:37 +02:00
Stuart Cook e0a0ad188d Rollup merge of #154488 - Zalathar:unstable, r=jieyouxu
Revert "Unstable book options parser"

- Reverts https://github.com/rust-lang/rust/pull/154070

This reverts commit 6fd8466768, reversing changes made to fda6d37bb8.

---

The changes in https://github.com/rust-lang/rust/pull/154070 are well-intentioned, but in their current form they place an unreasonable maintenance burden on the affected part of the compiler, out of proportion to the benefit gained.

- Moving the unstable options to a separate `include!` file is marginally more convenient for the unstable-book-gen tool, but a big hassle for compiler contributors looking to read or modify the list of unstable options. It breaks normal file layout conventions, interferes with navigation, and interferes with IDE features, all without ever being truly necessary.

- The extra `syn`-based parser in unstable-book-gen is quite complicated, almost entirely undocumented, and seemingly buggy. That makes it extremely difficult to understand or modify, which in turn makes it effectively impossible to ever change the `options!` macro on the compiler side.

- The new tests in unstable-book-gen don't appear to be hooked up to run in CI.

- The compiler changes don't appear to have been approved by a T-compiler reviewer.

Before contemplating a revert, I tried to put together a fix-forward to resolve or mitigate some of these issues. But unstable-book-gen in its current state makes that impractical, so unfortunately I believe that the only way forward is to revert the original changes.

---

I do think the reverted functionality is potentially useful, and I'm not fundamentally opposed to a revised version of it landing in the future, if the relevant concerns are addressed.

But I feel strongly that the current version does not justify the real and troublesome maintenance burden that it imposes on compiler contributors.
2026-03-28 15:01:40 +11:00
Stuart Cook 624c3c010e Rollup merge of #154396 - xtqqczze:deps/tar, r=clubby789
chore(deps): update rust crate tar to v0.4.45

Fix [RUSTSEC-2026-0068](https://rustsec.org/advisories/RUSTSEC-2026-0068.html): tar-rs incorrectly ignores PAX size headers if header size is nonzero
Fix [RUSTSEC-2026-0067](https://rustsec.org/advisories/RUSTSEC-2026-0067.html): `unpack_in` can chmod arbitrary directories by following symlinks
2026-03-28 15:01:40 +11:00
Zalathar d470684a43 Revert "Unstable book options parser"
This reverts commit 6fd8466768, reversing
changes made to fda6d37bb8.
2026-03-28 14:18:26 +11:00
León Orell Valerian Liehr 6fd8466768 Rollup merge of #154070 - mehdiakiki:unstable-book-options-parser, r=clubby789
Unstable book options parser

Parses the `options!` macro in `compiler/rustc_session/src/options.rs` directly to extract the unstable (-Z) compiler flag names and descriptions to generate documentation for the unstable book.

I took notice from the previous attempt which ran `rustc -Zhelp` and parsed the output and used this approach that reads the source directly.

Used claude for the tedious char by char parsing parts but verified the code, I hope that's ok!
2026-03-27 15:11:53 +01:00
xtqqczze afe3ab6ac5 chore(deps): update rust crate tar to v0.4.45 2026-03-27 13:36:27 +00:00
Nicholas Nethercote a733192980 Make rustc_hir_analysis not depend on rustc_lint.
`rustc_hir_analysis` depends on `rustc_lint` in just a single function:
`emit_delayed_lint`, which is used by the
"emit_ast_lowering_delayed_lints" checking section within
`rustc_hir_analysis::check_crate`.

This commit moves that function and section to out of
`rustc_hir_analysis::check_crate`, into `rustc_interface`, eliminating
the dependency. This seems reasonable because the delayed lint errors
aren't really related to HIR analysis. They were in there just because
HIR analysis follows AST lowering.

This means `rustc_hir_analysis` and `rustc_lint` can both start
compiling as soon as `rustc_trait_selection` finishes. This also changes
the error order in one test, which doesn't matter.

The commit also changes `emit_delayed_lint` to `emit_delayed_lints`,
factoring out some code duplicated in rustdoc.
2026-03-26 14:31:43 +11:00
Shoyu Vanilla d5bbeb978e Revert "Auto merge of #151380 - ShoyuVanilla:shallow-resolve-to-root-var, r=lcnr"
This reverts commit 75b9d89c68, reversing
changes made to 7bee525095.
2026-03-24 22:31:37 +09:00
Zalathar de15ab0065 Store value/side-effect index lists inside CacheEncoder
These lists can be considered part of the encoder state, and bundling them
inside the encoder is certainly more convenient than passing them around
separately.
2026-03-24 12:56:49 +11:00
bors bbe8536158 Auto merge of #154217 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/ef444b33426c326cdb216da335ca9224b77f19e9.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-03-23 04:12:57 +00:00
Ralf Jung b584d4d668 update lockfile 2026-03-22 17:17:56 +01:00
randomicon00 b4f2c8a08e docs: parse unstable options with syn 2026-03-21 12:06:21 -04:00
Ada Bohm bef4b476c1 Updates derive_where and removes workaround 2026-03-19 09:22:03 +01:00
Stuart Cook bbd1428a15 Rollup merge of #153922 - jyn514:jyn/crate-graph, r=jdonszelmann
rustc_mir_build only depends on rustc_lint_defs, not rustc_lint

This speeds up incremental compile times when modifying rustc_lint.
2026-03-16 15:01:35 +11:00
bors a0e206b566 Auto merge of #153799 - notriddle:stringdex-0.0.6, r=GuillaumeGomez
rustdoc-search: update to stringdex 0.0.6

This update includes a few optimizations that reduce the size and index building time:

- the wire format uses two bits to store four possibilities, instead of only handling three https://gitlab.com/notriddle/stringdex/-/merge_requests/34

- the hashes themselves are 40 bits instead of 48, and inlining is able to still fit enough data by storing runs https://gitlab.com/notriddle/stringdex/-/merge_requests/35

- scanning for duplicates takes advantage of the rarity of conflicts, using an array with 32 bit numbers and only pulling in the other 8 bits when actually needed https://gitlab.com/notriddle/stringdex/-/merge_requests/37
2026-03-13 23:18:20 +00:00
Jynn Nelson 7e72e74ea6 mir_build only depends on lint_defs, not lints
This speeds up incremental compile times when modifying rustc_lint.
2026-03-13 20:54:51 +01:00
John Kåre Alsaker 85967c4de4 Add a TaggedQueryKey to identify a query instance 2026-03-13 07:49:38 +01:00
Michael Howell 949570f801 rustdoc-search: update to stringdex 0.0.6
This update includes a few optimizations that reduce the size and
index building time:

- the wire format uses two bits to store four possibilities, instead of
  only handling three
  https://gitlab.com/notriddle/stringdex/-/merge_requests/34

- the hashes themselves are 40 bits instead of 48, and inlining is able
  to still fit enough data by storing runs
  https://gitlab.com/notriddle/stringdex/-/merge_requests/35

- scanning for duplicates takes advantage of the rarity of conflicts,
  using an array with 32 bit numbers and only pulling in the other 8
  bits when actually needed
  https://gitlab.com/notriddle/stringdex/-/merge_requests/37
2026-03-12 19:01:39 -07:00
Jonathan Brouwer cf951bae87 Rollup merge of #153283 - LukeMathWalker:add-rkyv-support, r=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization

## Motivation

The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.

## An Alternative Approach: rkyv

`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](https://github.com/LukeMathWalker/pavex/pull/574/changes/d067e7e0cfa38da5b0a3c8713b1c53beb0b29a5d)).

## The Change

This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).

I have added new round-trip tests to ensure `rkyv` works as expected.

r? @aDotInTheVoid
2026-03-10 22:44:05 +01:00
Guillaume Gomez 28131e1b8f Update sysinfo version to 0.38.4 2026-03-09 17:27:17 +01:00
Luca Palmieri 1d81c5021a feat(rustdoc-json): Add optional support for rkyv (de)serialization 2026-03-09 15:30:07 +01:00
bors a3ac2f21b3 Auto merge of #153449 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? Manishearth 

Cargo.lock update due to Clippy version bump.
2026-03-06 14:41:17 +00:00
Jonathan Brouwer 77f0241206 Rollup merge of #153436 - eggyal:shlex-not-shell_words, r=ChrisDenton
Use shlex instead of shell-words

In rust-lang/rust#152712, the [`shell-words`] crate was introduced as a new dependency of `rustc_llvm` in order for its build script to parse the output of `llvm-config --quote-paths` and thereby handle paths containing whitespace; however, as [noted by bjorn3], that build script already transitively depends upon the [`shlex`] crate (via the [`cc`] crate) which provides similar functionality.

This patch is based off (the already-approved) rust-lang/rust#153419, which would otherwise conflict.

[`cc`]: https://crates.io/crates/cc
[noted by bjorn3]: https://github.com/rust-lang/rust/pull/152712#issuecomment-3994130008
[`shell-words`]: https://crates.io/crates/shell-words
[`shlex`]: https://crates.io/crates/shlex

r? ChrisDenton
2026-03-05 19:41:58 +01:00
Philipp Krones b17d678033 Update Cargo.lock 2026-03-05 17:18:29 +01:00
Alan Egerton f352e743b1 Use shlex instead of shell-words 2026-03-05 10:59:18 +00:00
Alan Egerton 253670b206 Update dispatch2 2026-03-05 01:14:51 +00:00
Jonathan Brouwer 6a44bbd91b Rollup merge of #152712 - eggyal:quote-lib-paths, r=ChrisDenton
Use shell-words to parse output from llvm-config

llvm-config might output paths that contain spaces, in which case the naive approach of splitting on whitespace breaks; instead we ask llvm-config to quote any paths and use the [shell-words](https://crates.io/crates/shell-words) crate by @tmiasko (a new dependency) to parse the output.

r? ChrisDenton
Fixes rust-lang/rust#152707
2026-03-03 19:11:48 +01:00
Jonathan Brouwer 1acf1c5367 Rollup merge of #152730 - BennoLossin:field-projections-lang-item, r=oli-obk
add field representing types

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152730)*

> [!NOTE]
> This is a rewrite of #146307 by using a lang item instead of a custom `TyKind`. We still need a `hir::TyKind::FieldOf` variant, because resolving the field name cannot be done before HIR construction. The advantage of doing it this way is that we don't need to make any changes to types after HIR (including symbol mangling). At the very beginning of this feature implementation, I tried to do it using a lang item, but then quickly abandoned the approach, because at that time I was still intending to support nested fields.

Here is a [range-diff](https://triagebot.infra.rust-lang.org/gh-range-diff/rust-lang/rust/605f49b27444a738ea4032cb77e3bdc4eb811bab..d15f5052095b3549111854a2555dd7026b0a729e/605f49b27444a738ea4032cb77e3bdc4eb811bab..f5f42d1e03495dbaa23671c46b15fccddeb3492f) between the two PRs

---

# Add Field Representing Types (FRTs)

This PR implements the first step of the field projection lang experiment (Tracking Issue: rust-lang/rust#145383). Field representing types (FRTs) are a new kind of type. They can be named through the use of the `field_of!` macro with the first argument being the type and the second the name of the field (or variant and field in the case of an enum). No nested fields are supported.

FRTs natively implement the `Field` trait that's also added in this PR. It exposes information about the field such as the type of the field, the type of the base (i.e. the type that contains the field) and the offset within that base type. Only fields of non-packed structs are supported, fields of enums an unions have unique types for each field, but those do not implement the `Field` trait.

This PR was created in collaboration with @dingxiangfei2009, it wouldn't have been possible without him, so huge thanks for mentoring me!

I updated my library solution for field projections to use the FRTs from `core` instead of creating my own using the hash of the name of the field. See the [Rust-for-Linux/field-projection `lang-experiment` branch](https://github.com/Rust-for-Linux/field-projection/tree/lang-experiment).

## API added to `core::field`

```rust
pub unsafe trait Field {
    type Base;

    type Type;

    const OFFSET: usize;
}

pub macro field_of($Container:ty, $($fields:expr)+ $(,)?);
```

Along with a perma-unstable type that the compiler uses in the expansion of the macro:

```rust
#[unstable(feature = "field_representing_type_raw", issue = "none")]
pub struct FieldRepresentingType<T: ?Sized, const VARIANT: u32, const FIELD: u32> {
    _phantom: PhantomData<T>,
}
```

## Explanation of Field Representing Types (FRTs)

FRTs are used for compile-time & trait-level reflection for fields of structs & tuples. Each struct & tuple has a unique compiler-generated type nameable through the `field_of!` macro. This type natively contains information about the field such as the outermost container, type of the field and its offset. Users may implement additional traits on these types in order to record custom information (for example a crate may define a [`PinnableField` trait](https://github.com/Rust-for-Linux/field-projection/blob/lang-experiment/src/marker.rs#L9-L23) that records whether the field is structurally pinned).

They are the foundation of field projections, a general operation that's generic over the fields of a struct. This genericism needs to be expressible in the trait system. FRTs make this possible, since an operation generic over fields can just be a function with a generic parameter `F: Field`.

> [!NOTE]
> The approach of field projections has changed considerably since this PR was opened. In the end we might not need FRTs, so this API is highly experimental.

FRTs should act as though they were defined as `struct MyStruct_my_field<StructGenerics>;` next to the struct. So it should be local to the crate defining the struct so that one can implement any trait for the FRT from that crate. The `Field` traits should be implemented by the compiler & populated with correct information (`unsafe` code needs to be able to rely on them being correct).

## TODOs

There are some `FIXME(FRTs)` scattered around the code:
- Diagnostics for `field_of!` can be improved
  - `tests/ui/field_representing_types/nonexistent.rs`
  - `tests/ui/field_representing_types/non-struct.rs`
  - `tests/ui/field_representing_types/offset.rs`
  - `tests/ui/field_representing_types/not-field-if-packed.rs`
  - `tests/ui/field_representing_types/invalid.rs`
- Simple type alias already seem to work, but might need some extra work in `compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs`

r? @oli-obk
2026-02-28 12:52:52 +01:00
Benno Lossin 7b428597ff add field representing types 2026-02-27 15:54:20 +01:00
Yacin Tmimi 02a497826f update Cargo.lock 2026-02-26 12:43:21 -05:00
Jonathan Brouwer c82c80598e Rollup merge of #151558 - mejrs:port_on_unimplemented, r=jdonszelmann,jonathanbrouwer
Port diagnostic attributes

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/151558)*

Ports all the diagnostic attributes: on_const, on_unimplemented and rustc_on_unimplemented.

I thought about migrating them one by one but that would leave a lot of code duplicated. So this PR looks big but it's mostly a lot of moving code around with slight modifications.

r? @JonathanBrouwer

cc @jdonszelmann feel free to review if you want, not sure which of you wants it.
2026-02-24 14:41:54 +01:00
Jana Dönszelmann cf7b0d9e29 add json logging 2026-02-24 11:30:55 +01:00
mejrs e8069300e4 Delete unused code 2026-02-24 10:50:38 +01:00
mejrs f944436c29 port over diagnostic::on_unimplemented 2026-02-24 10:50:38 +01:00
Jonathan Brouwer 3787688a8b Rollup merge of #152985 - JonathanBrouwer:convert-feature, r=jdonszelmann
Port `#[feature]` to the new attribute system

Rebase of https://github.com/rust-lang/rust/pull/146652
2026-02-23 20:46:13 +01:00
John Kåre Alsaker 9f7d502d64 Remove deterministic picking from query cycle handling 2026-02-23 01:31:59 +01:00
Jonathan Brouwer 2a58411a87 Port #[feature] to the new attribute parsing infrastructure
Co-authored-by: jdonszelmann <janabent@gmail.com>
2026-02-22 19:28:00 +01:00
Matthias Krüger cc0b9d5c20 Rollup merge of #152928 - alexcrichton:update-wasm-component-ld, r=jieyouxu
Update wasm-component-ld

Same as rust-lang/rust#147495, just keeping it up-to-date.
2026-02-21 13:03:30 +01:00
Alex Crichton 757b7c1bd7 Update wasm-component-ld
Same as 147495, just keeping it up-to-date.
2026-02-20 18:07:46 -08:00
Jonathan Brouwer b0cdafbd4a Rollup merge of #152455 - JonathanBrouwer:remove_translation, r=jdonszelmann
Remove the translation `-Z` options and the `Translator` type.

This PR implements MCP https://github.com/rust-lang/compiler-team/issues/967

It is split up into individually reviewable commits, each commit passes tests:

* https://github.com/rust-lang/rust/commit/678211956793a2e772414a71700a21525af6e67b Removes the translation compiler options from the session
* https://github.com/rust-lang/rust/commit/8f300d02fe8d2f01a39425925afd4cf3e15a822b Removes the now empty `Translator` type
* https://github.com/rust-lang/rust/commit/ab715c536fbd4ac09409e9a44eea2e25ea8a4f48 Renames `translate_message` to `format_diag_message`, as the function no longer does any translation
* https://github.com/rust-lang/rust/commit/8bcbc3f766af6242dcb52afe1ef4f6b1a9685019 Removes a section describing the removed compiler options from the rustc dev guide
2026-02-20 22:00:57 +01:00