Commit graph

1440 commits

Author SHA1 Message Date
Zalathar
fbb34d8c75 Remove wrapper struct QueryCtxt
This struct was only wrapping `TyCtxt` in order to implement traits that
were removed by RUST-152636.

This commit also slightly simplifies the signature of `execute_job_incr`, by
having it call `tcx.dep_graph.data()` internally.
2026-02-17 17:30:55 +11:00
Nicholas Nethercote
47ed4526d9 Remove DEP_NODE_DEBUG.
Like the previous commit, it's no longer needed.
2026-02-16 22:48:58 +11:00
Nicholas Nethercote
74dd36a934 Remove DEP_KIND_DEBUG.
It's plumbing to work around lack of access to `rustc_middle`, which is
no longer a problem.
2026-02-16 22:48:58 +11:00
bors
fef627b1eb Auto merge of #152636 - nnethercote:big-cleanups, r=Zalathar
Big query system cleanups

Recent PRs have moved a lot of code from `rustc_query_system` to `rustc_middle` and `rustc_query_impl`, where this code now has access to `TyCtxt`, e.g. rust-lang/rust#152419, rust-lang/rust#152516. As a result, a lot of abstraction and indirection that existed to work around this limitation is no longer necessary. This PR removes a lot of it.

r? @Zalathar
2026-02-16 04:20:25 +00:00
bjorn3
fa753a46c1 Remove code for ThinLTO from cg_gcc
It was just a dummy implementation to workarround the fact that thin
local lto is the default in rustc. By adding a thin_lto_supported thin
local lto can be automatically disabled for cg_gcc, removing the need
for this dummy implementation. This makes improvements to the LTO
handling on the cg_ssa side a lot easier.
2026-02-15 10:05:48 +00:00
Nicholas Nethercote
7c877d994b Remove DepContext.
It's no longer needed now that we can access `TyCtxt` directly.
2026-02-15 13:07:40 +11:00
Nicholas Nethercote
32e6a1a0ab Remove QueryContext.
`rustc_query_system` has been reduced so much that it's no longer
needed. This avoids a lot of indirection and abstraction.
2026-02-15 13:07:35 +11:00
Jonathan Brouwer
cf0cb74612
Rollup merge of #152577 - Ozzy1423:macro-attr, r=JonathanBrouwer
Port #[rustc_proc_macro_decls] to the new attribute parser.

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

r? @JonathanBrouwer
2026-02-14 18:55:36 +01:00
Nicholas Nethercote
ed091aaf5d Move rustc_query_system::query::dep_graph to rustc_middle.
Most of the files within the `dep_graph` module can be moved wholesale
into `rustc_middle`. But two of them (`mod.rs` and `dep_node.rs`) have
the same name as existing files in `rustc_middle`, so for those I just
copied the contents into the existing files.

The commit also moves `QueryContext` and `incremental_verify_ich*`
because they are tightly intertwined with the dep graph code. And a
couple of error structs moved as well.
2026-02-14 18:46:05 +11:00
Oscar Bray
ab13120882 Port #[rustc_proc_macro_decls] to the new attribute parser. 2026-02-13 13:24:37 +00: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
Zalathar
b9b28ba1b5 Collect active query jobs into struct QueryJobMap 2026-02-13 01:18:24 +11: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
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
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
Jonathan Brouwer
769bf2637b
Rollup merge of #152212 - Ozzy1423:three-attrs, r=JonathanBrouwer
Port some attributes to the attr parser

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

r? @JonathanBrouwer
2026-02-08 19:15:27 +01:00
Jonathan Brouwer
7fbde8b9c8
Rollup merge of #152250 - JonathanBrouwer:convert_finish, r=jdonszelmann
Remove support for slugs in diagnostic messages

This PR contains 5 commits, and is best reviewed commit-by-commit:
- https://github.com/rust-lang/rust/pull/152250/changes/ea8733133cacf4496a2766b3d002492cc29ea7bf Removes support from slugs from `rustc_errors`
- https://github.com/rust-lang/rust/pull/152250/changes/62dd37131f6f43d0dab3e26cf125cd841a08e003 Removes support from slugs from `rustc_macros` (which declares `derive(Diagnostic)`)
- https://github.com/rust-lang/rust/pull/152250/changes/2289e6cfb7e379eba777a10df0a6f474f9450b02 Adjuist the `ui-fulldeps` testsuite to match the changes in `rustc_macros`
- https://github.com/rust-lang/rust/pull/152250/changes/0db0acd6993cbdf84384b00773d7509df6bc20fb Removes support for the fallback bundle (which previously contained all messages, but is now empty) from `rustc_driver_impl` and `rustc_session`
- https://github.com/rust-lang/rust/pull/152250/changes/81d42146040c4a6b3d252e3dc3ac32e563694796 Removes an integration test that tested the translation system using fluent
2026-02-08 19:15:25 +01:00
Adwin White
d8ff397cd6 check stalled coroutine obligations eagerly 2026-02-08 23:57:50 +08:00
Oscar Bray
842bed6f93 Parse #[rustc_delayed_bug_from_inside_query] 2026-02-08 11:40:42 +00:00
Jonathan Brouwer
0db0acd699
Remove the fallback bundle 2026-02-08 11:06:42 +01:00
Stuart Cook
68f4a99963
Rollup merge of #151887 - scottmcm:homogeneous-try-in-compiler, r=jackh726
Remove some unnecessary `try`-related type annotations

I left a few, like
```rust
let result: Result<_, ModError<'_>> = try {
```
where it felt like seeing it might still be useful for the reader.

Feel free to push back on any of these changes if you think they should be left alone.
2026-02-08 16:58:23 +11:00
Jonathan Brouwer
9a114c686f
Convert to inline diagnostics in rustc_parse 2026-02-07 10:30:40 +01:00
Jonathan Brouwer
d96d73fd86
Rollup merge of #152140 - bjorn3:driver_fixed_error_codes, r=jdonszelmann
Hard code the error code registry for custom drivers

And do some cleanups enabled by this.
2026-02-06 10:06:45 +01:00
bjorn3
1851937577 Hard code the error code registry for custom drivers 2026-02-04 21:21:15 +00:00
bors
db3e99bbab Auto merge of #150605 - RalfJung:fallback-intrinsic-skip, r=mati865
skip codegen for intrinsics with big fallback bodies if backend does not need them

This hopefully fixes the perf regression from https://github.com/rust-lang/rust/pull/148478. I only added the intrinsics with big fallback bodies to the list; it doesn't seem worth the effort of going through the entire list.

Fixes https://github.com/rust-lang/rust/issues/149945
Cc @scottmcm @bjorn3
2026-02-04 17:12:58 +00:00
Jonathan Brouwer
cf0e19b0b4
Rollup merge of #152102 - bjorn3:inline_fluent_codegen_backends, r=JonathanBrouwer,GuillaumeGomez
Convert to inline diagnostics in all codegen backends

Part of https://github.com/rust-lang/rust/issues/151366

r? @JonathanBrouwer
2026-02-04 14:39:29 +01:00
Jonathan Brouwer
1c142db7d9
Rollup merge of #152066 - JonathanBrouwer:session_convert, r=jdonszelmann
Convert to inline diagnostics in `rustc_session`

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-04 14:39:24 +01:00
Jonathan Brouwer
a1d588b35e
Rollup merge of #150992 - cezarbbb:cstyle-export-rules2, r=bjorn3,petrochenkov
link modifier `export-symbols`: export all global symbols from selected uptream c static libraries

In order to be able to export symbols from a specified upstream C static library, I redesigned a solution that, compared to a previous PR rust-lang/rust#150335 I submitted, will not have any extra symbols leaking out.

The following points should be noted:
 - This attribute will select and import the `Global` symbols of the first matching library it finds.
 - Developers should ensure that there are no libraries with the same name.
 - This modifier is only compatible with `static` linking kind
 - By default, upstream C static libraries will not export their `Global` symbols regardless of whether `LTO` optimization is enabled. However, after enabling this attribute, if the upstream C static library has `LTO` optimization enabled, the compiler will issue an error to inform the developer that the linked C library is invalid.

The test code is the same as the PR rust-lang/rust#150335.
Here are the results:
1. `cargo +include-libs rustc --release -- -L. -lstatic:+export-symbols=c_add`
(or you can use `#[link(name = "c_add", kind= "static", modifier = "+export-symbols")]` in the file)
```bash
                 U abort@GLIBC_2.2.5
                 U bcmp@GLIBC_2.2.5
0000000000014f60 T c_add
                 U calloc@GLIBC_2.2.5
                 U close@GLIBC_2.2.5
0000000000014f70 T c_sub
                 w __cxa_finalize@GLIBC_2.2.5
                 w __cxa_thread_atexit_impl@GLIBC_2.18
                 U dl_iterate_phdr@GLIBC_2.2.5
0000000000014ee0 T downstream_add
                 U __errno_location@GLIBC_2.2.5
                 U free@GLIBC_2.2.5
                 U fstat64@GLIBC_2.33
                 U getcwd@GLIBC_2.2.5
                 U getenv@GLIBC_2.2.5
                 w __gmon_start__
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U lseek64@GLIBC_2.2.5
                 U malloc@GLIBC_2.2.5
                 U memcpy@GLIBC_2.14
                 U memmove@GLIBC_2.2.5
                 U memset@GLIBC_2.2.5
                 U mmap64@GLIBC_2.2.5
                 U munmap@GLIBC_2.2.5
                 U open64@GLIBC_2.2.5
                 U posix_memalign@GLIBC_2.2.5
                 U pthread_key_create@GLIBC_2.34
                 U pthread_key_delete@GLIBC_2.34
                 U pthread_setspecific@GLIBC_2.34
                 U read@GLIBC_2.2.5
                 U readlink@GLIBC_2.2.5
                 U realloc@GLIBC_2.2.5
                 U realpath@GLIBC_2.3
                 U stat64@GLIBC_2.33
                 w statx@GLIBC_2.28
                 U strlen@GLIBC_2.2.5
                 U syscall@GLIBC_2.2.5
                 U __tls_get_addr@GLIBC_2.3
                 U _Unwind_Backtrace@GCC_3.3
                 U _Unwind_DeleteException@GCC_3.0
                 U _Unwind_GetDataRelBase@GCC_3.0
                 U _Unwind_GetIP@GCC_3.0
                 U _Unwind_GetIPInfo@GCC_4.2.0
                 U _Unwind_GetLanguageSpecificData@GCC_3.0
                 U _Unwind_GetRegionStart@GCC_3.0
                 U _Unwind_GetTextRelBase@GCC_3.0
                 U _Unwind_RaiseException@GCC_3.0
                 U _Unwind_Resume@GCC_3.0
                 U _Unwind_SetGR@GCC_3.0
                 U _Unwind_SetIP@GCC_3.0
                 U write@GLIBC_2.2.5
                 U writev@GLIBC_2.2.5
```
3. `cargo +nightly rustc --release -- -L ./`
```bash
                 U abort@GLIBC_2.2.5
                 U bcmp@GLIBC_2.2.5
                 U calloc@GLIBC_2.2.5
                 U close@GLIBC_2.2.5
                 w __cxa_finalize@GLIBC_2.2.5
                 w __cxa_thread_atexit_impl@GLIBC_2.18
                 U dl_iterate_phdr@GLIBC_2.2.5
0000000000011e10 T downstream_add
                 U __errno_location@GLIBC_2.2.5
                 U free@GLIBC_2.2.5
                 U fstat64@GLIBC_2.33
                 U getcwd@GLIBC_2.2.5
                 U getenv@GLIBC_2.2.5
                 w gettid@GLIBC_2.30
                 w __gmon_start__
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U lseek64@GLIBC_2.2.5
                 U malloc@GLIBC_2.2.5
                 U memcpy@GLIBC_2.14
                 U memmove@GLIBC_2.2.5
                 U memset@GLIBC_2.2.5
                 U mmap64@GLIBC_2.2.5
                 U munmap@GLIBC_2.2.5
                 U open64@GLIBC_2.2.5
                 U posix_memalign@GLIBC_2.2.5
                 U pthread_key_create@GLIBC_2.34
                 U pthread_key_delete@GLIBC_2.34
                 U pthread_setspecific@GLIBC_2.34
                 U read@GLIBC_2.2.5
                 U readlink@GLIBC_2.2.5
                 U realloc@GLIBC_2.2.5
                 U realpath@GLIBC_2.3
                 U stat64@GLIBC_2.33
                 w statx@GLIBC_2.28
                 U strlen@GLIBC_2.2.5
                 U syscall@GLIBC_2.2.5
                 U __tls_get_addr@GLIBC_2.3
                 U _Unwind_Backtrace@GCC_3.3
                 U _Unwind_GetDataRelBase@GCC_3.0
                 U _Unwind_GetIP@GCC_3.0
                 U _Unwind_GetIPInfo@GCC_4.2.0
                 U _Unwind_GetLanguageSpecificData@GCC_3.0
                 U _Unwind_GetRegionStart@GCC_3.0
                 U _Unwind_GetTextRelBase@GCC_3.0
                 U _Unwind_RaiseException@GCC_3.0
                 U _Unwind_Resume@GCC_3.0
                 U _Unwind_SetGR@GCC_3.0
                 U _Unwind_SetIP@GCC_3.0
                 U write@GLIBC_2.2.5
                 U writev@GLIBC_2.2.5
```

r? @bjorn3
2026-02-04 14:39:17 +01:00
bjorn3
d2a0557afb Convert to inline diagnostics in all codegen backends 2026-02-04 13:12:49 +00:00
Jonathan Brouwer
0f9b0d3841
Convert to inline diagnostics in rustc_session 2026-02-04 13:22:20 +01:00
Jonathan Brouwer
e7c142cc89
Convert to inline diagnostics in rustc_interface 2026-02-04 08:10:10 +01:00
cezarbbb
dcdffe8d80 link modifier export-symbols: export all global symbols from selected uptream c static libraries 2026-02-04 09:26:21 +08:00
Zalathar
e58538c552 Rename collect_active_jobs to several distinct names 2026-02-03 20:10:22 +11:00
Zalathar
0cbbe56d84 Work around rustfmt giving up on a large expression 2026-02-02 13:28:09 +11:00
Scott McMurray
f7931c8050 Remove some unnecessary try-related type annotations
I left a few, like
```rust
let result: Result<_, ModError<'_>> = try {
```
where it felt like seeing it might still be useful for the reader.

Feel free to push back on any of these changes if you think seeing the type would be better.
2026-01-30 18:21:19 -08:00
Stuart Cook
933e686e91
Rollup merge of #151137 - osiewicz:151090-checksum-freshness-binary-files, r=jdonszelmann
checksum-freshness: Fix invalid checksum calculation for binary files

Admittedly this is not the cleanest way to achieve this, but SourceMap is quite intertwined with source files being represented as Strings.
Tracking issue: https://github.com/rust-lang/cargo/issues/14136
Closes: rust-lang/rust#151090
2026-01-27 12:50:50 +11:00
Piotr Osiewicz
0df94dd94e checksum-freshness: Fix incorrect hash/file length values of binary
dependency files
2026-01-26 12:09:55 +01:00
Zalathar
4b25ccdb91 Rename DepKindStruct to DepKindVTable 2026-01-24 18:22:14 +11:00
Jamie Hill-Daniel
e73dfaa62f Move collect_crate_types to rustc_interface, and use new attribute parser 2026-01-22 02:34:28 +00:00
Jamie Hill-Daniel
66b78b700b Port crate_type to attribute parser 2026-01-22 02:34:28 +00:00
Zalathar
154255698a Make Deps::name lookup a non-self associated function
The dep names needed here are statically available from `rustc_middle`.
2026-01-21 12:02:26 +11:00
Zalathar
17c5b7a4b5 Replace make_dep_kind_name_array! with a slice constant 2026-01-21 12:02:26 +11:00
Jonathan Brouwer
0ee7d96253
Remove all allows for diagnostic_outside_of_impl and untranslatable_diagnostic throughout the codebase
This PR was mostly made by search&replacing
2026-01-19 17:39:49 +01:00
Felix Rath
8fa2f693bb
Implement incremental caching for derive macro expansions 2026-01-16 07:36:36 +01:00
Jonathan Brouwer
db10879fd1
Rollup merge of #151096 - rm-providers-deref, r=oli-obk
Remove `Deref`/`DerefMut` impl for `Providers`.

It's described as a "backwards compatibility hack to keep the diff small". Removing it requires only a modest amount of churn, and the resulting code is clearer without the invisible derefs.

r? @oli-obk
2026-01-14 11:05:42 +01:00
Nicholas Nethercote
3aa31788b5 Remove Deref/DerefMut impl for Providers.
It's described as a "backwards compatibility hack to keep the diff
small". Removing it requires only a modest amount of churn, and the
resulting code is clearer without the invisible derefs.
2026-01-14 15:55:59 +11:00
Jonathan Brouwer
a89683dd95
Rollup merge of #150151 - destabilise-target-spec-json, r=Kivooeo
Destabilise `target-spec-json`

Per rust-lang/compiler-team#944:

> Per https://github.com/rust-lang/rust/issues/71009, the ability to load target spec JSONs was stabilised accidentally. Within the team, we've always considered the format to be unstable and have changed it freely. This has been feasible as custom targets can only be used with core, like any other target, and so custom targets de-facto require nightly to be used (i.e. to build core manually or use Cargo's -Zbuild-std).
>
> Current build-std RFCs (https://github.com/rust-lang/rfcs/pull/3873, https://github.com/rust-lang/rfcs/pull/3874) propose a mechanism for building core on stable (at the request of Rust for Linux), which combined with a stable target-spec-json format, permit the current format to be used much more widely on stable toolchains. This would prevent us from improving the format - making it less tied to LLVM, switching to TOML, enabling keys in the spec to be stabilised individually, etc.
>
> De-stabilising the format gives us the opportunity to improve the format before it is too challenging to do so. Internal company toolchains and projects like Rust for Linux already use target-spec-json, but must use nightly at some point while doing so, so while it could be inconvenient for those users to destabilise this, it is hoped that an minimal alternative that we could choose to stabilise can be proposed relatively quickly.
2026-01-13 09:01:29 +01:00
Jonathan Brouwer
b5dd72d292
Port #[collapse_debuginfo] to the new attribute parsing system 2026-01-11 10:54:45 +01:00
mu001999
759857cce3 Add missing translator resources for interface parse_cfg and parse_check_cfg 2026-01-04 11:53:31 +08:00
Ralf Jung
57e44f5046 skip codegen for intrinsics with big fallback bodies if backend does not need them 2026-01-02 23:14:02 +01:00