Commit graph

317832 commits

Author SHA1 Message Date
Zalathar
90fd76845c Make it clearer that check_pat_lit only handles literal patterns 2026-02-10 11:57:47 +11: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
Matthias Krüger
c1f716ae53
Rollup merge of #152131 - Ozzy1423:attrs6, r=JonathanBrouwer
Port rustc_no_implicit_bounds attribute to parser.

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

r? @JonathanBrouwer
2026-02-09 18:39:42 +01:00
Matthias Krüger
2ce5f487e0
Rollup merge of #145504 - Jules-Bertholet:more_conversion_trait_impls, r=tgross35
Add some conversion trait impls

- `impl<T, const N: usize> From<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsRef<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsRef<[MaybeUninit<T>]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsMut<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsMut<[MaybeUninit<T>]> for MaybeUninit<[T; N]>` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> From<MaybeUninit<[T; N]>> for [MaybeUninit<T>; N]` (cc https://github.com/rust-lang/rust/issues/96097)
- `impl<T, const N: usize> AsRef<[Cell<T>; N]> for Cell<[T; N]>` (equivalent of `as_array_of_cells`, cc https://github.com/rust-lang/rust/issues/88248)
- `impl<T, const N: usize> AsRef<[Cell<T>]> for Cell<[T; N]>`
- `impl<T> AsRef<[Cell<T>]> for Cell<[T]>` (equivalent of `as_slice_of_cells`)

@rustbot label T-libs-api needs-fcp -T-libs

I’ve tried to only add impls that are unlikely to cause single-applicable-impl inference breakage.
2026-02-09 18:39:42 +01:00
Matthias Krüger
c15f4e0e47
Rollup merge of #142957 - xizheyin:142931, r=tgross35
std: introduce path normalize methods at top of `std::path`

Closes rust-lang/rust#142931

Mention other methods that call `conponents` and `canonicalize` that fully normalize path. And fix two typo.

r? libs
2026-02-09 18:39:41 +01:00
Matthias Krüger
8afd63610b
Rollup merge of #152287 - jakubadamw:issue-137190, r=petrochenkov
Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait not implemented

compiler/rustc_trait_selection/src/traits/vtable.rs@`vtable_entries`:

The impossible predicates check in `vtable_entries` used `instantiate_own` which only includes the method's own `where` clauses, without the parent trait's bounds. Replace it with `instantiate_and_check_impossible_predicates` which also checks the trait ref itself, so unsatisfied supertrait bounds are caught and the method is marked `Vacant` instead of ICEing.

Closes rust-lang/rust#137190.
Closes rust-lang/rust#135470.
2026-02-09 18:39:41 +01:00
Matthias Krüger
19122c03c7
Rollup merge of #152236 - davidtwco:compiletest-destabilise-custom-targets, r=scottmcm
compiletest: `-Zunstable-options` for json targets

bootstrap runs compiletest with synthetic custom targets when blessing `mir-opt` tests, but that no longer works after rust-lang/rust#150151/rust-lang/rust#151534 because `-Zunstable-options` is required

Contexts on [Zulips](https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/custom.20targets.20are.20unstable.20and.20require.20.60-Zunstable-options.60).
2026-02-09 18:39:40 +01:00
Matthias Krüger
e2ddf5c951
Rollup merge of #152166 - cyrgani:questionable-pm-cleanups, r=petrochenkov
cleanup some more things in `proc_macro::bridge`

Each commit should be reviewable on its own.
2026-02-09 18:39:40 +01:00
Matthias Krüger
5fa914c13a
Rollup merge of #152134 - hoodmane:emscripten-crt-static-allow-dylibs, r=petrochenkov
Set crt_static_allow_dylibs to true for Emscripten target

And add a test. This is followup work to rust-lang/rust#151704. It introduced a regression where cargo is now unwilling to build cdylibs for Emscripten because `crt_static_default` is `true` but `crt_static_allows_dylibs` is `false`. Unfortunately the added test does not fail without the change because the validation logic is in Cargo, not in rustc. But it's good to have some coverage of this anyways.
2026-02-09 18:39:39 +01:00
Matthias Krüger
144b77aad2
Rollup merge of #151613 - cuviper:array-windows-parity, r=Amanieu
Align `ArrayWindows` trait impls with `Windows`

With `slice::ArrayWindows` getting ready to stabilize in 1.94, I noticed that it currently has some differences in trait implementations compared to `slice::Windows`, and I think we should align these.

- Remove `derive(Copy)` -- we generally don't want `Copy` for iterators at all, as this is seen as a footgun (e.g. rust-lang/rust#21809). This is obviously a breaking change though, so we should only remove this if we also backport the removal before it's stable. Otherwise, it should at least be replaced by a manual impl without requiring `T: Copy`.
- Manually `impl Clone`, simply to avoid requiring `T: Clone`.
- `impl FusedIterator`, because it is trivially so. The `since = "1.94.0"` assumes we'll backport this, otherwise we should change that to the "current" placeholder.
- `impl TrustedLen`, because we can trust our implementation.
- `impl TrustedRandomAccess`, because the required `__iterator_get_unchecked` method is straightforward.

r? libs-api

@rustbot label beta-nominated
(at least for the `Copy` removal, but we could be more selective about the rest).
2026-02-09 18:39:39 +01:00
Matthias Krüger
903f9fc541
Rollup merge of #152388 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to c75729db68.

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

r? @ghost
2026-02-09 18:39:38 +01:00
Weixie Cui
40a264cd45 fix: rhs_span to rhs_span_new 2026-02-09 22:16:36 +08:00
David Wood
43e5203a8c
compiletest: -Zunstable-options for json targets 2026-02-09 13:48:05 +00:00
Oscar Bray
2b22150c18 Port rustc_no_implicit_bounds attribute to parser. 2026-02-09 13:44:10 +00:00
Zalathar
c475bdaa53 Include key_hash in ActiveJobGuard
This value is a previously-computed hash of the key, so it makes sense to
bundle it with the key inside the guard, since the guard will need it on
completion anyway.
2026-02-10 00:20:47 +11:00
Zalathar
e04ae80c5a Rename JobOwner to ActiveJobGuard
This commit also adds and updates some relevant comments.
2026-02-10 00:20:45 +11:00
bors
71dc761bfe Auto merge of #152382 - jhpratt:rollup-DIUVWuF, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#152357 (std: Don't panic when removing a nonexistent UEFI var)
 - rust-lang/rust#152180 (Port `rustc_reservation_impl` to the new attribute parser)
 - rust-lang/rust#152276 (Add message format checking)
2026-02-09 13:15:14 +00:00
xizheyin
88c296a19f std: introduce path normalize methods at top of std::path 2026-02-09 18:25:26 +08:00
Jacob Pratt
9d31498271
Rollup merge of #152276 - JonathanBrouwer:fmt-check, r=jdonszelmann
Add message format checking

Checks the indentation of diagnostic messages, it checks that everything is at least as indented as the attribute that contains it

r? @jdonszelmann (Anyone else, also feel free to review, just assigning to Jana because she's been reviewing the other PRs)
2026-02-09 05:20:29 -05:00
Jacob Pratt
98a3fa2b64
Rollup merge of #152180 - jdonszelmann:port-rustc-reservation-impl, r=jonathanbrouwer
Port `rustc_reservation_impl` to the new attribute parser

r? @JonathanBrouwer
2026-02-09 05:20:28 -05:00
Jacob Pratt
e046884f49
Rollup merge of #152357 - nicholasbishop:push-uolpvnvrlznw, r=joboet
std: Don't panic when removing a nonexistent UEFI var

`std::env::remove_var` does not say that deleting a nonexistent variable is an error (and at least on Linux, it indeed does not cause an error).

The UEFI Shell Protocol spec also doesn't say it's an error, but the edk2 implementation delegates to the UEFI runtime `SetVariable` function, which returns `EFI_NOT_FOUND` when trying to delete a nonexistent variable.

Change the UEFI implementation to check for a `NotFound` error and treat it as success.

CC @Ayush1325
2026-02-09 05:20:27 -05:00
Jana Dönszelmann
6babe687a5
Port rustc_reservation_impl to the new attribute parser 2026-02-09 10:55:22 +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
Adwin White
f248395394 bless tests 2026-02-09 15:09:43 +08: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
Laurențiu Nicola
5ad44f28c6
Merge pull request #21538 from Shourya742/2026-01-28-fix-linking-of-postcard-test
Fix linking of postcard test
2026-02-09 05:53:36 +00:00
Laurențiu Nicola
0e022db2e9
Merge pull request #21607 from lnicola/fix-lockfile
minor: Fix lockfile
2026-02-09 05:31:31 +00:00
Laurențiu Nicola
f394d1e6c6 Fix lockfile 2026-02-09 07:21:53 +02: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
Jonathan Brouwer
99c6009c45
Reformat existing messages 2026-02-08 23:07:58 +01:00
Jonathan Brouwer
2d65a33c61
Implement indent check 2026-02-08 23:07:57 +01: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