Commit graph

317739 commits

Author SHA1 Message Date
Guillaume Gomez
5107af264d Add extra test to ensure the highlighting for macros is working as expected 2026-02-11 12:06:24 +01:00
Guillaume Gomez
31c4ad33cc Add regression test for macro call highlighting 2026-02-09 20:53:10 +01:00
Guillaume Gomez
61b5382ad8 Correctly check if a macro call is actually a macro call in rustdoc highlighter 2026-02-09 20:53:10 +01:00
bors
c6936c309a Auto merge of #152371 - nnethercote:rm-QueryDispatcher, r=Zalathar
Remove `QueryDispatcher`

`QueryDispatcher` is a trait that existed purely because `rustc_query_system` had code that didn't have access to `TyCtxt`. That is no longer the case, so the trait can be removed.

r? @Zalathar
2026-02-09 09:34:09 +00:00
Nicholas Nethercote
f9958048e0 Move HashResult.
It's the only thing left in `rustc_query_system::query::dispatcher`.
2026-02-09 20:02:43 +11:00
Nicholas Nethercote
541d7fc19d Remove trait QueryDispatcher.
It existed only to bridge the divide between `rustc_query_system` and
`rustc_query_impl`. But enough pieces have been moved from the former to
the latter that the trait is no longer needed. Less indirection and
abstraction makes the code easier to understand.
2026-02-09 20:02:41 +11:00
Nicholas Nethercote
f91c8083d8 Adjust make_dep_kind_vtable_for_query.
It takes an `is_anon` argument, but it's now generic over `QueryFlags`,
which contains the same `is_anon` field. So the argument is no longer
necessary.
2026-02-09 20:00:23 +11:00
bors
4cd4c18438 Auto merge of #152373 - Zalathar:rollup-wDsfoHs, r=Zalathar
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#150823 (Implement MVP for opaque generic const arguments)
 - rust-lang/rust#152071 (Implement stdio FD constants)
 - rust-lang/rust#152171 (Port `rustc_strict_coherence` to the new attribute parser)
 - rust-lang/rust#152291 (Port `rustc_insignificant_dtor`)

Failed merges:

 - rust-lang/rust#152180 (Port `rustc_reservation_impl` to the new attribute parser)
2026-02-09 05:59:48 +00:00
Stuart Cook
7cb4501916
Rollup merge of #152291 - jdonszelmann:port-rustc-insignificant-dtor, r=jonathanbrouwer
Port `rustc_insignificant_dtor`

r? @JonathanBrouwer

Second commit removes it from an impl in std. I looked, and I really think it had no effect in the past. We only look for this attr on ADTs...
2026-02-09 14:32:01 +11:00
Stuart Cook
12f0ef7480
Rollup merge of #152171 - jdonszelmann:port-rustc-strict-coherence, r=jonathanbrouwer
Port `rustc_strict_coherence` to the new attribute parser

r? @JonathanBrouwer
2026-02-09 14:32:00 +11:00
Stuart Cook
11c7917874
Rollup merge of #152071 - hanna-kruppe:stdio-fd-consts, r=ChrisDenton
Implement stdio FD constants

Tracking issue: rust-lang/rust#150836
2026-02-09 14:32:00 +11:00
Stuart Cook
7ae47be6aa
Rollup merge of #150823 - camelid:ogca, r=BoxyUwU
Implement MVP for opaque generic const arguments

This is meant to be the interim successor to generic const expressions.
Essentially, const item RHS's will be allowed to do arbitrary const
operations using generics. The limitation is that these const items will
be treated opaquely, like ADTs in nominal typing, such that uses of them
will only be equal if the same const item is referenced. In other words,
two const items with the exact same RHS will not be considered equal.

I also added some logic to check feature gates that depend on others
being enabled (like oGCA depending on mGCA).

### Coherence

During coherence, OGCA consts should be normalized ambiguously because
they are opaque but eventually resolved to a real value. We don't want
two OGCAs that have the same value to be treated as distinct for
coherence purposes. (Just like opaque types.)

This actually doesn't work yet because there are pre-existing
fundamental issues with equate relations involving consts that need to
be normalized. The problem is that we normalize only one layer of the
const item and don't actually process the resulting anon const. Normally
the created inference variable should be handled, which in this case
would cause us to hit the anon const, but that's not happening.
Specifically, `visit_const` on `Generalizer` should be updated to be
similar to `visit_ty`.

r? @BoxyUwU
2026-02-09 14:31:59 +11:00
bors
39219ceb97 Auto merge of #152318 - nnethercote:streamline-HashStableContext, r=cjgillot
Streamline `rustc_span::HashStableContext`.

Currently this trait has five methods. But it only really needs three.

For example, currently stable hashing of spans is implemented in `rustc_span`, except a couple of sub-operations are delegated to `rustc_query_system`: `def_span` and `span_data_to_lines_and_cols`. These two delegated sub-operations can be reduced to a single delegated operation that does the full hash computation.

Likewise, `assert_default_hashing_controls` depends on two delegated sub-operations, `hashing_controls` and
`unstable_opts_incremental_ignore_spans`, and can be simplified.

I find the resulting code simpler and clearer -- when necessary, we do a whole operation in `rustc_query_system` instead of doing it partly in `rustc_span` and partly in `rustc_query_system`.

r? @cjgillot
2026-02-09 02:31:13 +00:00
Nicholas Nethercote
52caa7ae6d Remove QueryDispatcherUnerased::Dispatcher associated type.
It's always `SemiDynamicQueryDispatcher`, so we can just use that type
directly. (This requires adding some explicit generic params to
`QueryDispatcherUnerased`.) Less indirection makes the code clearer, and
this is a prerequisite for the next commit, which is a much bigger
simplification.
2026-02-09 11:03:43 +11:00
Nicholas Nethercote
d3d4fd9312 Tweak query key trait bounds.
Query keys must be stably hashable. Currently this requirement is
expressed as a where-clause on `impl QueryDispatcher for
SemiDynamicQueryDispatcher` and a where-clause on
`create_deferred_query_stack_frame`.

This commit removes those where-clause bounds and adds a single bound to
`QueryCache::Key`, which already has some other bounds. I.e. it
consolidates the bounds. It also gives them a name (`QueryCacheKey`) to
avoid repeating them. There is also a related `Key` trait in
`rustc_middle`; it should probably be merged with `QueryCacheKey` in the
future, but not today.

This cleanup helps with the next two commits, which do bigger
rearrangements, and where the where-clauses caused me some difficulties.
2026-02-09 10:23:44 +11:00
bors
1c316d3461 Auto merge of #152361 - JonathanBrouwer:rollup-Qkwz1vN, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151869 (add test for codegen of SIMD vector from array repeat)
 - rust-lang/rust#152077 (bootstrap: always propagate `CARGO_TARGET_{host}_LINKER`)
 - rust-lang/rust#126100 (Reword the caveats on `array::map`)
 - rust-lang/rust#152275 (Stop having two different alignment constants)
 - rust-lang/rust#152325 (Remove more adhoc groups that correspond to teams)
2026-02-08 21:42:19 +00:00
Jana Dönszelmann
2dda303229
Port rustc_strict_coherence to the new attribute parser 2026-02-08 22:28:58 +01:00
Jana Dönszelmann
9d6e120939
remove from impl block in std 2026-02-08 22:22:58 +01:00
Jana Dönszelmann
f1b4c2a0e6
Port rustc_insignificant_dtor to the new attribute parser 2026-02-08 22:22:58 +01:00
Jonathan Brouwer
b0c9c4b3e2
Rollup merge of #152325 - Kobzol:remove-adhoc-groups, r=Mark-Simulacrum
Remove more adhoc groups that correspond to teams

Following in the footsteps of https://github.com/rust-lang/rust/pull/152310.

- [types](https://github.com/rust-lang/team/blob/main/teams/types.toml) team - removed Niko and lqd from team rotation in triagebot
- [project-const-traits](https://github.com/rust-lang/team/blob/main/teams/project-const-traits.toml) - no changes needed, whole team was already on rotation
- [project-stable-mir](https://github.com/rust-lang/team/blob/main/teams/project-stable-mir.toml) - no changes needed, whole team was already on rotation
- [project-exploit-mitigations](https://github.com/rust-lang/team/blob/main/teams/project-exploit-mitigations.toml) - removed 1c3t3a from team rotation in triagebot (TODO - it didn't work yet, need to fix triagebot to allow running commands on top of people that are only in project/working groups)
2026-02-08 21:06:30 +01:00
Jonathan Brouwer
9f778b4341
Rollup merge of #152275 - scottmcm:range-range-inclusive, r=Mark-Simulacrum
Stop having two different alignment constants

Now that there's a `<T as SizedTypeProperties>::ALIGNMENT` constant, `Alignment::of` can use that instead of an inline constant, like how `Layout::new` uses the constant from `SizedTypeProperties`.
2026-02-08 21:06:30 +01:00
Jonathan Brouwer
c33bd8aa53
Rollup merge of #126100 - scottmcm:decaveat-map, r=Mark-Simulacrum
Reword the caveats on `array::map`

Thanks to #107634 and some improvements in LLVM (particularly [`dead_on_unwind`](https://llvm.org/docs/LangRef.html#parameter-attributes)), the method actually optimizes reasonably well now.

So focus the discussion on the fundamental ordering differences where the optimizer might never be able to fix it because of the different behaviour, and keep encouraging `Iterator::map` where an array wasn't actually ever needed.
2026-02-08 21:06:29 +01:00
Jonathan Brouwer
120b188466
Rollup merge of #152077 - cuviper:bootstrap-host-linker, r=Mark-Simulacrum
bootstrap: always propagate `CARGO_TARGET_{host}_LINKER`

We were already setting `CARGO_TARGET_{target}_LINKER` when there is a
setting in `bootstrap.toml`, and when the host and target are the same,
this is also used for build scripts and proc-macros.

However, the host value wasn't set when building for any other target,
and Cargo would see that as a fingerprint change for those build
artifacts, rebuilding them.

If we always set the `CARGO_TARGET_{host}_LINKER`, then those build
scripts will keep a consistent Cargo fingerprint, so they'll remain
cached no matter how we're alternating targets.
2026-02-08 21:06:29 +01:00
Jonathan Brouwer
b566ac2c47
Rollup merge of #151869 - folkertdev:simd-array-repeat, r=Mark-Simulacrum
add test for codegen of SIMD vector from array repeat

fixes https://github.com/rust-lang/rust/issues/97804

It appears that this issue was fixed silently in LLVM 19. The original codegen was terrible, but starting at LLVM 19 `opt` is able to generate good code.

https://llvm.godbolt.org/z/5vq8scP6q

cc @programmerjake
2026-02-08 21:06:28 +01:00
Mark Rousskov
4a979d546b Stop having two different alignment constants
* Stop having two different alignment constants
* Update library/core/src/alloc/global.rs
2026-02-08 19:54:03 +00:00
bors
6efa357bff Auto merge of #152358 - JonathanBrouwer:rollup-kIGpLTP, r=JonathanBrouwer
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#151455 (Fix `SourceFile::normalized_byte_pos`)
 - rust-lang/rust#152250 (Remove support for slugs in diagnostic messages)
 - rust-lang/rust#152322 (Replace some `feature(core_intrinsics)` with stable hints)
 - rust-lang/rust#152328 (Fix a few diagnostics)
 - rust-lang/rust#151640 (Cleanup offload datatransfer)
 - rust-lang/rust#152212 (Port some attributes to the attr parser)
 - rust-lang/rust#152309 (Fix bound var resolution for trait aliases)
 - rust-lang/rust#152339 (diagnostics: fix ICE in closure signature mismatch)
 - rust-lang/rust#152341 (`cfg_select!`: allow optional comma after `{ /* ... */ }`)
2026-02-08 18:16:53 +00:00
Jonathan Brouwer
78bd6abbe6
Rollup merge of #152341 - folkertdev:cfg-select-optional-comma, r=JonathanBrouwer
`cfg_select!`: allow optional comma after `{ /* ... */ }`
2026-02-08 19:15:28 +01:00
Jonathan Brouwer
e01abd7409
Rollup merge of #152339 - JonatanLindh:fix-issue-152331, r=Urgau
diagnostics: fix ICE in closure signature mismatch

Fixes rust-lang/rust#152331

Fixes an ICE where `AdjustSignatureBorrow` caused a panic because it attempted to set the `len` argument which was already defined by the parent diagnostic.

Both variants used `len` as  argument name, but can both be present in a diagnostic. They now use different names for the argument.
2026-02-08 19:15:27 +01:00
Jonathan Brouwer
6521fcf018
Rollup merge of #152309 - rynewang:fix/ice-152158-rtn-trait-alias, r=fmease
Fix bound var resolution for trait aliases

Fixes rust-lang/rust#152158
Fixes rust-lang/rust#152244
2026-02-08 19:15:27 +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
16c7ee5c05
Rollup merge of #151640 - ZuseZ4:cleanup-datatransfer, r=nnethercote
Cleanup offload datatransfer

There are 3 steps to run code on a GPU: Copy data from the host to the device, launch the kernel, and move it back.
At the moment, we have a single variable describing the memory handling to do in each step, but that makes it hard for LLVM's opt pass to understand what's going on. We therefore split it into three variables, each only including the bits relevant for the corresponding stage.

cc @jdoerfert @kevinsala

r? compiler
2026-02-08 19:15:26 +01:00
Jonathan Brouwer
0d9b0ab620
Rollup merge of #152328 - JonathanBrouwer:fix_diags, r=JonathanBrouwer
Fix a few diagnostics

When working on the inline diagnostics conversion (https://github.com/rust-lang/rust/issues/151366), I noticed that my script sometimes took the wrong message.
Because it didn't happen very often, I just fixed it manually when a uitest fails.

However I got paranoid that the script changed messages that were not covered by uitests, so I checked for all messages in the previous `messages.ftl` files, whether they occured at least once in the codebase. I found 3 messages that indeed were wrongly replaced by my script, fixed them, and added uitests to make sure this doesn't happen again :)

r? @jdonszelmann (Anyone else, also feel free to review, just assigning to Jana because she's been reviewing the other PRs)
2026-02-08 19:15:26 +01:00
Jonathan Brouwer
b74d085f8f
Rollup merge of #152322 - Zalathar:core-intrinsics, r=fmease
Replace some `feature(core_intrinsics)` with stable hints

I noticed that some compiler crates use `feature(core_intrinsics)` for optimization hints, when they could potentially be using stable `std::hint` functions instead.

This PR replaces the occurrences in `rustc_arena` and `rustc_data_structures`.
2026-02-08 19:15:25 +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
Jonathan Brouwer
329353e42c
Rollup merge of #151455 - eggyal:normalized-byte-pos, r=cjgillot
Fix `SourceFile::normalized_byte_pos`

This method was broken by 258ace6, which changed `self.normalized_pos` to use relative offsets however this method continued to compare against an absolute offset.

Also adds a regression test for the issue that this method was originally introduced to fix.

Closes rust-lang/rust#149568
Fixes regression of rust-lang/rust#110885

r? cjgillot (as author of the breaking commit)
2026-02-08 19:15:24 +01:00
Noah Lev
9a30ec8149 Implement MVP for opaque generic const arguments
This is meant to be the interim successor to generic const expressions.
Essentially, const item RHS's will be allowed to do arbitrary const
operations using generics. The limitation is that these const items will
be treated opaquely, like ADTs in nominal typing, such that uses of them
will only be equal if the same const item is referenced. In other words,
two const items with the exact same RHS will not be considered equal.

I also added some logic to check feature gates that depend on others
being enabled (like oGCA depending on mGCA).

= Coherence =

During coherence, OGCA consts should be normalized ambiguously because
they are opaque but eventually resolved to a real value. We don't want
two OGCAs that have the same value to be treated as distinct for
coherence purposes. (Just like opaque types.)

This actually doesn't work yet because there are pre-existing
fundamental issues with equate relations involving consts that need to
be normalized. The problem is that we normalize only one layer of the
const item and don't actually process the resulting anon const. Normally
the created inference variable should be handled, which in this case
would cause us to hit the anon const, but that's not happening.
Specifically, `visit_const` on `Generalizer` should be updated to be
similar to `visit_ty`.
2026-02-08 18:15:11 +00:00
Jonathan Brouwer
d14c26f45a
Fix help on AmbiguousMissingKwForItemSub diagnostic 2026-02-08 17:02:40 +01:00
Jonathan Brouwer
8aa0e905f4
Fix suggestion on CallToDeprecatedSafeFnRequiresUnsafe diagnostic 2026-02-08 17:02:40 +01:00
Folkert de Vries
053f76e9f0
cfg_select!: allow optional comma after { /* ... */ } 2026-02-08 13:46:29 +01:00
Jonatan Lindh
fb55b5dcf3 diagnostics: fix ICE in closure signature mismatch
This fixes the ICE by renaming conflicting arguments in the diagnostic.
2026-02-08 13:32:50 +01:00
Oscar Bray
6361d5f279 Parse #[rustc_outlives] 2026-02-08 11:41:36 +00:00
bors
286fbe5d84 Auto merge of #152160 - nnethercote:start-cutting-down-rustc_query_system, r=Zalathar
Start cutting down `rustc_query_system`

The query system is implemented in `rustc_query_system`, `rustc_middle`, and `rustc_query_impl`. `rustc_query_system` is hamstrung by not having access to `TyCtxt`, and there seems to be consensus to eliminate it. It's contents can be moved into the other two crates. Moving as much stuff as possible to `rustc_query_impl` is preferred, because `rustc_middle` is already so big.

This PR starts this process. It moves one small function to `rustc_middle` and a good chunk of code to `rustc_query_impl`.

Once `rustc_query_system` is gone (or at least shrunk down a lot more) some of the traits like `DepContext`, `QueryContext`, and `QueryDispatcher` will be removable.

r? @Zalathar
2026-02-08 11:41:28 +00:00
Oscar Bray
7668496274 Parse #[rustc_evaluate_where_clauses] 2026-02-08 11:41:10 +00:00
Oscar Bray
842bed6f93 Parse #[rustc_delayed_bug_from_inside_query] 2026-02-08 11:40:42 +00:00
Nicholas Nethercote
0f3108327b Streamline rustc_span::HashStableContext.
Currently this trait has five methods. But it only really needs three.

For example, currently stable hashing of spans is implemented in
`rustc_span`, except a couple of sub-operations are delegated to
`rustc_query_system`: `def_span` and `span_data_to_lines_and_cols`.
These two delegated sub-operations can be reduced to a single delegated
operation that does the full hash computation.

Likewise, `assert_default_hashing_controls` depends on two delegated
sub-operations, `hashing_controls` and
`unstable_opts_incremental_ignore_spans`, and can be simplified.

I find the resulting code simpler and clearer -- when necessary, we do a
whole operation in `rustc_query_system` instead of doing it partly in
`rustc_span` and partly in `rustc_query_system`.
2026-02-08 22:02:55 +11:00
Jonathan Brouwer
81d4214604
Remove fluent tests in rustc_error 2026-02-08 11:06:42 +01:00
Jonathan Brouwer
0db0acd699
Remove the fallback bundle 2026-02-08 11:06:42 +01:00
Jonathan Brouwer
2289e6cfb7
Adjust expected uitests results for the updated derive(Diagnostic) macro 2026-02-08 11:06:42 +01:00
Jonathan Brouwer
62dd37131f
Remove slugs from the #[derive(Diagnostic)] macro 2026-02-08 11:03:56 +01:00
Jonathan Brouwer
ea8733133c
Remove DiagMessage::FluentIdentifier 2026-02-08 10:33:29 +01:00