Commit graph

317920 commits

Author SHA1 Message Date
Matthias Krüger
2194af9680
Rollup merge of #152419 - nnethercote:mv-more-query-system-code, r=Zalathar
Move more query system code

Towards the goal of eliminating `rustc_query_system`, this commit moves some code from `rustc_query_system` to `rustc_middle` and `rustc_query_impl`, and from `rustc_middle` to `rustc_query_impl`.

r? @Zalathar
2026-02-11 13:48:46 +01:00
bors
d34f1f9314 Auto merge of #152420 - tgross35:update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to 6a67a9f627.

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

r? @ghost
2026-02-11 04:12:19 +00:00
bors
7b25457166 Auto merge of #151943 - Zalathar:cache-on-disk, r=TaKO8Ki
Clean up query macros for `cache_on_disk_if`

This PR aims to make the macros for dealing with `cache_on_disk_if` a bit easier to read and work with.

There should be no change to compiler behaviour.
2026-02-10 20:57:44 +00:00
bors
9e79395f92 Auto merge of #151509 - Zoxc:gen-color-race, r=zetanumbers,petrochenkov
Handle race when coloring nodes concurrently as both green and red

This fixes a race where a duplicate dep node gets written to the dep graph if a node was marked as green and promoted during execution, then marked as red after execution.

This can occur when a `no_hash` query A depends on a query B which cannot be forced so it was not colored when starting execution of query A. During the execution of query A it will execute query B and color it green. Before A finishes another thread tries to mark A green, this time succeeding as B is now green, and A gets promoted and written to metadata. Execution of A then finishes and because it's `no_hash` we assume the result changed and thus we color the node again, now as red and write it to metadata again. This doesn't happen with non-`no_hash` queries as they will be green if all their dependencies are green.

This changes the code coloring nodes red to also use `compare_exchange` to deal with this race ensuring that the coloring of nodes only happens once.

Fixes rust-lang/rust#150018
Fixes rust-lang/rust#142778
Fixes rust-lang/rust#141540
2026-02-10 16:17:00 +00:00
bors
d00ba92259 Auto merge of #152437 - JonathanBrouwer:rollup-bWpnWOz, r=JonathanBrouwer
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#152364 (Port a lot of attributes to the new parser)
 - rust-lang/rust#151954 (Add help message suggesting explicit reference cast for From/TryFrom)
 - rust-lang/rust#152148 (Move `impl Interner for TyCtxt` to its own submodule)
 - rust-lang/rust#152226 (Modernize diagnostic for indeterminate trait object lifetime bounds)
 - rust-lang/rust#152351 (Remove `SubdiagMessage` in favour of the identical `DiagMessage`)
 - rust-lang/rust#152417 (Move the needs-drop check for `arena_cache` queries out of macro code)
 - rust-lang/rust#150688 (typeck: Make it clearer that `check_pat_lit` only handles literal patterns)
 - rust-lang/rust#152293 (Format heterogeneous try blocks)
 - rust-lang/rust#152355 (Update documentation of rustc_macros)
 - rust-lang/rust#152396 (Uplift `Predicate::allow_normalization` to `rustc_type_ir`)
2026-02-10 12:04:24 +00:00
Jonathan Brouwer
083622cdd0
Rollup merge of #152396 - ShoyuVanilla:uplift-allow-normalize, r=lcnr
Uplift `Predicate::allow_normalization` to `rustc_type_ir`

Found this FIXME comment while fixing a bug in rust-analyzer 😄
cc https://github.com/rust-lang/rust-analyzer/pull/21611

r? types
2026-02-10 13:00:49 +01:00
Jonathan Brouwer
faa15808cf
Rollup merge of #152355 - JonathanBrouwer:update-macro-doc, r=nnethercote
Update documentation of rustc_macros

Update the docs to reflect the changes in https://github.com/rust-lang/rust/issues/151366
2026-02-10 13:00:49 +01:00
Jonathan Brouwer
d9a86757c9
Rollup merge of #152293 - ia0:try_blocks_heterogeneous, r=ytmimi
Format heterogeneous try blocks

The tracking issue for `try_blocks_heterogeneous` is https://github.com/rust-lang/rust/issues/149488.

This follows the formatting of homogeneous try blocks (feature `try_blocks`) by considering `try bikeshed <type>` to be the equivalent of `try` (in particular a single "token").

An alternative would be to permit breaking between `bikeshed` and `<type>`, but given that those 2 elements are an explicitly temporary part of the syntax, it doesn't seem worth it. There also doesn't seem to be any existing precedent breaking between a keyword and a type. It also doesn't seem to be useful in practice, given that the type itself doesn't break (which is how it works for the return type of closures) and has more chances to dominate the length in case a break is necessary.

Happy to adapt anything in case this formatting is not optimal.

The test is also copied from homogeneous try blocks with 2 additional test cases to demonstrate the behavior with long types.

See [#t-lang > try blocks @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/try.20blocks/near/572387493) for context.
2026-02-10 13:00:48 +01:00
Jonathan Brouwer
b5cf35214f
Rollup merge of #150688 - Zalathar:check-pat-lit, r=petrochenkov
typeck: Make it clearer that `check_pat_lit` only handles literal patterns

Nowadays, the `hir::PatExprKind` enum guarantees that “expressions” in patterns can only be paths or literals.

`PatExprKind::Path` is already handled by the previous match arm, so we can make this match arm explicitly match on `PatExprKind::Lit` without losing exhaustiveness.

There should be no actual change to compiler behaviour.
2026-02-10 13:00:48 +01:00
Jonathan Brouwer
5541e5c057
Rollup merge of #152417 - Zalathar:arena-alloc, r=nnethercote
Move the needs-drop check for `arena_cache` queries out of macro code

This is slightly simpler than before, because now the macro only needs to call a single function, and can just unconditionally supply `tcx` and a typed arena.

There should be no actual change to compiler behaviour.
2026-02-10 13:00:47 +01:00
Jonathan Brouwer
70ef5048d4
Rollup merge of #152351 - JonathanBrouwer:remove_subdiag, r=nnethercote
Remove `SubdiagMessage` in favour of the identical `DiagMessage`

For https://github.com/rust-lang/rust/issues/151366
Just some more cleanup :)
SubdiagMessage is now identical to DiagMessage, so there's no point in having both of them
2026-02-10 13:00:47 +01:00
Jonathan Brouwer
2af7bc0e17
Rollup merge of #152226 - fmease:modernize-indeterminate-object-lifetime-diag, r=chenyukang
Modernize diagnostic for indeterminate trait object lifetime bounds

* remove suggestion from the diagnostic message (bad style, too long) and turn it into a structured suggestion
* replace *object type* with *trait object type* since the former is an outdated term
2026-02-10 13:00:46 +01:00
Jonathan Brouwer
2aaf3a19d5
Rollup merge of #152148 - Zalathar:tcx-interner, r=petrochenkov
Move `impl Interner for TyCtxt` to its own submodule

This impl is several hundred lines of mostly self-contained, mostly boilerplate code that can be extracted out of the dauntingly large `rustc_middle::ty::context` module.

- The trait and its impl were introduced by https://github.com/rust-lang/rust/pull/97287.

---

There should be no change to compiler behaviour.
2026-02-10 13:00:45 +01:00
Jonathan Brouwer
39bb68119d
Rollup merge of #151954 - Muhtasim-Rasheed:issue-109829-help-message, r=eholk
Add help message suggesting explicit reference cast for From/TryFrom

Closes rust-lang/rust#109829

Improves E0277 diagnostics when a `From` or `TryFrom` implementation is expected, but the provided type is a reference that can be explicitly cast to a type the trait can convert from.
2026-02-10 13:00:45 +01:00
Jonathan Brouwer
935904f534
Rollup merge of #152364 - jdonszelmann:port-a-lot, r=jonathanbrouwer
Port a lot of attributes to the new parser

r? @JonathanBrouwer

See commits for which attributes
2026-02-10 13:00:44 +01:00
Jana Dönszelmann
12dbc1bc63
remove 'static in many places 2026-02-10 10:48:46 +01:00
Jana Dönszelmann
fe7530cad2
Make rustc_object_lifetime_default use NoArgsAttributeParser 2026-02-10 10:36:16 +01:00
Jana Dönszelmann
eab26e329b
Port rustc_no_mir_inline to the new attribute parser 2026-02-10 10:25:19 +01:00
Jana Dönszelmann
f4c135f91b
Port rustc_trivial_field_reads to the new attribute parser 2026-02-10 10:19:08 +01:00
Jonathan Brouwer
2377d355ad
Update documentation of rustc_macros 2026-02-10 10:17:59 +01:00
Jana Dönszelmann
954f483557
Port rustc_never_type_options to the new attribute parser 2026-02-10 10:17:24 +01:00
Jonathan Brouwer
ea361287be Remove SubdiagMessage in favour of the identical DiagMessage 2026-02-10 09:13:45 +00:00
Jana Dönszelmann
a17eb934db
Port rustc_capture_analysis to the new attribute parser 2026-02-10 10:10:38 +01:00
Jana Dönszelmann
9d10b2ff37
Port rustc_conversion_suggestion to the new attribute parser 2026-02-10 10:10:38 +01:00
Jana Dönszelmann
9cc2924959
Port rustc_deprecated_safe_2024 to the new attribute parser 2026-02-10 10:10:38 +01:00
Jana Dönszelmann
00fef81964
Port rustc_expected_cgu_reuse to the new attribute parser 2026-02-10 10:10:38 +01:00
Nicholas Nethercote
a34317e5a5 Move report_cycle.
From `rustc_query_system::query::job` to `rustc_query_impl::job`.
2026-02-10 18:46:05 +11:00
Nicholas Nethercote
923de04f6a Move rustc_middle::query::values to rustc_query_impl.
Because all uses are now in `rustc_query_impl`. This was made possible
by the previous commit. Less code in `rustc_middle`, hooray.
2026-02-10 18:46:05 +11:00
Nicholas Nethercote
066a935b0c Move parts of rustc_query_system::query::job to rustc_middle::job.
The latter is a new module.

As well as the code motion, some other changes were required.
- `QueryJobId` methods became free functions so they could move while
  `QueryJobId` itself stayed put. This was so `QueryMap` and
  `QueryJobInfo` could be moved.
- Some visibilities in `rustc_query_system` required changing.
- `collect_active_jobs_from_all_queries` is no longer required in `trait
  QueryContext`.
2026-02-10 16:59:33 +11:00
Shoyu Vanilla
20f65fc537 Uplift Predicate::allow_normalization to rustc_type_ir 2026-02-10 12:26:12 +09:00
bors
f21b4c0888 Auto merge of #152412 - JonathanBrouwer:rollup-hShycIY, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#151960 (rustc_parse: improve the error diagnostic for "missing let")
 - rust-lang/rust#152157 (Fix error spans for `asm!()` args that are macros)
 - rust-lang/rust#152317 (fix: sup_trace to sub_trace)
 - rust-lang/rust#150897 (rustc_parse_format: improve diagnostics for unsupported debug = syntax)
 - rust-lang/rust#151154 (Add `s390x-unknown-none-softfloat` with `RustcAbi::Softfloat`)
 - rust-lang/rust#152013 (Update to Xcode 26.2)
 - rust-lang/rust#152326 (Remove the compiler adhoc group)
2026-02-10 02:25:24 +00:00
Zalathar
4dc82e99ef Move the needs-drop check for arena_cache queries out of macro code 2026-02-10 13:23:25 +11:00
Nicholas Nethercote
1c4661ccec Derive Clone for QueryLatch.
The derived version is equivalent to the hand-written version.
2026-02-10 12:23:52 +11:00
Nicholas Nethercote
e1ed3bf01d Remove out-of-date comment.
Keys and values now must be `Copy` due to erasing.
2026-02-10 12:23:52 +11:00
Zalathar
b7bfb768d0 Indicate that bidirectional_lang_item_map! declares functions
Requiring `fn` in the macro syntax makes it a little more obvious that the
macro declares functions with those names, and makes them easier to grep for.
2026-02-10 12:03:40 +11:00
Zalathar
4234d2dd72 Move impl Interner for TyCtxt to its own submodule 2026-02-10 12:03:39 +11:00
Zalathar
91d47a5c0d Don't import TyCtxt from crate::ty::context 2026-02-10 11:58:44 +11:00
Zalathar
90fd76845c Make it clearer that check_pat_lit only handles literal patterns 2026-02-10 11:57:47 +11:00
Jonathan Brouwer
415780bb11
Rollup merge of #152326 - Kobzol:remove-compiler-adhoc-group, r=wesleywiser
Remove the compiler adhoc group

Since triagebot now allows configuring rotation mode through a specific team.

Original review rotation:

```toml
compiler = [
    "@BoxyUwU",
    "@chenyukang",
    "@davidtwco",
    "@eholk",
    "@fee1-dead",
    "@fmease",
    "@jackh726",
    "@jieyouxu",
    "@jdonszelmann",
    "@JonathanBrouwer",
    "@madsmtm",
    "@mati865",
    "@Nadrieril",
    "@nnethercote",
    "@oli-obk",
    "@petrochenkov",
    "@SparrowLii",
    "@TaKO8Ki",
    "@tiif",
    "@WaffleLapkin",
    "@wesleywiser",
]
```

I went through all the remaining members of t-compiler now and set their `compiler` team rotation to be off, to match the original state. You can check it with `team-stats compiler`.

r? @davidtwco
2026-02-09 23:37:49 +01:00
Jonathan Brouwer
bcd01e7cc1
Rollup merge of #152013 - madsmtm:update-xcode, r=shepmaster
Update to Xcode 26.2

Update our CI to run with Xcode 26.

This means that:
- LLVM will be built with a newer Clang version (before Apple Clang 15, now Apple Clang 17).
- Our binaries (e.g. `rustc` and `libstd*.dylib`) will have their SDK version raised (before macOS 14.5, now 26.2).
- Our binaries will be built with a newer linker (before 1053.12, now 1230.1).

The last two points can be observed with:
```sh
$ vtool -show-build ./build/host/stage1/bin/rustc
Load command 10
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform MACOS
    minos 11.0
      sdk 26.2
   ntools 1
     tool LD
  version 1230.1
$ vtool -show-build ./build/host/stage1/lib/rustlib/aarch64-apple-darwin/lib/libstd*.dylib
Load command 9
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform MACOS
    minos 11.0
      sdk 26.2
   ntools 1
     tool LD
  version 1230.1
```

This shouldn't have much of an effect, but things like `dyld` is known to inspect the SDK version, so it _might_ expose some latent bugs (I really don't expect it to though).

This also updates the macOS runners to run on macOS 15 (the macOS 14 runners only have up to Xcode 16.2 available). That is desirable anyhow, as [the macOS 14 runners will be deprecated in July](https://github.com/actions/runner-images/issues/13518). This is probably also required for https://github.com/rust-lang/rust/pull/147192.

r? shepmaster
2026-02-09 23:37:48 +01:00
Jonathan Brouwer
1f59a4a86b
Rollup merge of #151154 - fneddy:s390x_softfloat_abi, r=workingjubilee
Add `s390x-unknown-none-softfloat` with `RustcAbi::Softfloat`

followup on rust-lang/rust#150766

add an `s390x-unknown-none-softfloat` target to use for kernel compilation, as the Linux kernel does not wish to pay the overhead of saving float registers by default on kernel switch. this target's `extern "C"` ABI is unspecified, so it is unstable and subject to change between versions, just like the Linux intrakernel ABI and `extern "Rust"` ABIs are unstable.

enforce target feature incompatibility by adding `RustcAbi::Softfloat`. this is itself just a rename of `RustcAbi::X86Softfloat`, accepting both "x86-softfloat" and "softfloat" as valid strings in the target.json format. the target-features of `"soft-float"` and `"vector"` are incompatible for s390x, so issue a compatibility warning if they are combined.
2026-02-09 23:37:48 +01:00
Jonathan Brouwer
af70d82355
Rollup merge of #150897 - Unique-Usman:ua/debug, r=estebank
rustc_parse_format: improve diagnostics for unsupported debug = syntax

Detect Python-style f-string debug syntax in format strings and emit a
clear diagnostic explaining that it is not supported in Rust. When the
intended operation can be inferred, suggest the corresponding Rust
alternative (e.g. `dbg!` for `{x=}`).
2026-02-09 23:37:47 +01:00
Jonathan Brouwer
3199309f05
Rollup merge of #152317 - cuiweixie:sup_trace, r=jackh726
fix: sup_trace to sub_trace

This looks like a copy-past here from the line above.
2026-02-09 23:37:46 +01:00
Jonathan Brouwer
e0c8737f8a
Rollup merge of #152157 - gurry:131292-asm-concat-unicode, r=petrochenkov
Fix error spans for `asm!()` args that are macros

Fixes rust-lang/rust#131292 which is exactly the same issue as rust-lang/rust#129503 but for [`err.secondary_label`](9f4b56a5ae/compiler/rustc_builtin_macros/src/asm.rs (L399-L401)) instead of [`err.span`](9f4b56a5ae/compiler/rustc_builtin_macros/src/asm.rs (L385-L391)). The latter issue was fixed in https://github.com/rust-lang/rust/pull/130917 so see that PR for context.

In addition to the above, the current PR also proactively fixes potential future issues of the same kind which would have occurred over [here ](9f4b56a5ae/compiler/rustc_builtin_macros/src/asm.rs (L478-L482))and [here](9f4b56a5ae/compiler/rustc_builtin_macros/src/asm.rs (L493-L497)).
2026-02-09 23:37:45 +01:00
Jonathan Brouwer
9709215995
Rollup merge of #151960 - Unique-Usman:ua/missingletleft, r=estebank
rustc_parse: improve the error diagnostic for "missing let"
2026-02-09 23:37:45 +01:00
bors
381e9ef09e Auto merge of #152324 - Keith-Cancel:mgca4, r=BoxyUwU
Update mgca to use `type const` syntax instead of the `#[type_const]` attribute. 

This PR changes the `#[type_const]` attribute to the `type const` syntax for  https://github.com/rust-lang/rust/issues/132980.

This will fixes https://github.com/rust-lang/rust/issues/151273 and similar issues, since we need to check `type const` of items before expansion. The move to add a syntax was mentioned here: https://github.com/rust-lang/rust/pull/151289#issuecomment-3765241397

The first part of this PR adds support by allowing `type const <IDENT>: <TYPE> { = <EXPR> };` syntax in `rustc_parse/src/parser/item.rs`.

The next part since the AST item does not contain enough information to determine if we have a `type const` was rework `ConstItemRhs` into `ConstItemRhsKind` to store the information since we no longer have the attribute acting as a source of extra data/metadata. 

The hir node `ConstItemRhsKind` current shape mostly works, except in the case of `TraitItemKind` where it is an option. I initially went about giving `hir::ConstItemRhsKind` a similar form the AST, but it touches a lot more lines of code and files so because of that, the less invasive option was to add a simple boolean flag to `TraitItemKind`. 

The forth part of this PR includes adding a query I called `is_rhs_type_const` so that we can handle both local and foreign def_ids. 

The fifth aspect of the PR is adding a `mgca_type_const_syntax` feature gate that is checked before expansion. The standard mgca feature gate is ran after expansion. This feature gate allows for conditional compilation (e.g #[cfg(..)]) of the `type const` syntax  in nightly without `min_generic_const_args` being enabled. 

The last bit is updating all the the tests that used the `#[type_const]` attribute to use the new syntax that failed because of the changes. This is the bulk of touched/edited files in the PR. 

r? @BoxyUwU 
@rustbot label +F-associated_const_equality +F-min_generic_const_args
2026-02-09 22:37:29 +00:00
bors
18d13b5332 Auto merge of #152399 - matthiaskrgr:rollup-uDIDnAN, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#152388 (`rust-analyzer` subtree update)
 - rust-lang/rust#151613 (Align `ArrayWindows` trait impls with `Windows`)
 - rust-lang/rust#152134 (Set crt_static_allow_dylibs to true for Emscripten target)
 - rust-lang/rust#152166 (cleanup some more things in `proc_macro::bridge`)
 - rust-lang/rust#152236 (compiletest: `-Zunstable-options` for json targets)
 - rust-lang/rust#152287 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait not implemented)
 - rust-lang/rust#142957 (std: introduce path normalize methods at top of `std::path`)
 - rust-lang/rust#145504 (Add some conversion trait impls)
 - rust-lang/rust#152131 (Port rustc_no_implicit_bounds attribute to parser.)
 - rust-lang/rust#152315 (fix: rhs_span to rhs_span_new)
 - rust-lang/rust#152327 (Check stalled coroutine obligations eagerly)
 - rust-lang/rust#152377 (Rename the query system's `JobOwner` to `ActiveJobGuard`, and include `key_hash`)
2026-02-09 19:19:04 +00:00
Matthias Krüger
2f16df1832
Rollup merge of #152377 - Zalathar:active-job-guard, r=nnethercote
Rename the query system's `JobOwner` to `ActiveJobGuard`, and include `key_hash`

`JobOwner` appears to have had more responsibilities in the past, but nowadays it's just a stack-guard object used by `execute_job` to poison the query state for the current key if some inner part of query execution panics.

The new name and comments should hopefully be clearer about its (limited) role.

I have also included a follow-up change that stores both the key and its previously-computed hash in the guard, instead of just the key. This avoids having to pass the key to `complete`, and avoids having to recompute the hash in `drop`.

r? nnethercote (or compiler)
2026-02-09 18:39:44 +01:00
Matthias Krüger
1f0e21584e
Rollup merge of #152327 - adwinwhite:fix-non-defining-use-ices-ready, r=lcnr
Check stalled coroutine obligations eagerly

Fixes rust-lang/rust#151322
Fixes rust-lang/rust#151323
Fixes rust-lang/rust#137916
Fixes rust-lang/rust#138274

The problem is that stalled coroutine obligations can't be satisifed so that they cause normalization to fail in `mir_borrowck`.
Thus, we failed to register any opaque to storage in the next solver.
I fix it by checking these obligations earlier in `mir_borrowck`.

r? @lcnr
2026-02-09 18:39:43 +01:00
Matthias Krüger
7ecefd01d5
Rollup merge of #152315 - cuiweixie:bugfix-span, r=jieyouxu
fix: rhs_span to rhs_span_new
2026-02-09 18:39:43 +01:00