Commit Graph

320040 Commits

Author SHA1 Message Date
Jonathan Brouwer ef4cff2ea3 Rollup merge of #153015 - joboet:atomic_alias_generic, r=jhpratt
core: make atomic primitives type aliases of `Atomic<T>`

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

This makes `AtomicI32` and friends type aliases of `Atomic<T>` by encoding their alignment requirements via the use of an internal `Storage` associated type. This is also used to encode that `AtomicBool` store a `u8` internally.

Modulo the `Send`/`Sync` implementations, this PR does not move any trait implementations, methods or associated functions – I'll leave that for another PR.
2026-03-02 20:10:34 +01:00
Jonathan Brouwer 4a3d3cb486 Rollup merge of #151962 - TaKO8Ki:pointee-sized-next-solver-ice, r=lcnr
Fix next-solver ICE on PointeeSized goals

Fixes rust-lang/rust#151957
2026-03-02 20:10:33 +01:00
Jonathan Brouwer 1654b17cd8 Rollup merge of #151780 - rwardd:ryan/fix-option-permutations, r=nikic
Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`

It was discovered that the FileCheck tests when performing an `Option::or` operation on a slice was failing when tested on a big endian host.

The compiler explorer link is here outlining the codegen output differences - https://rust.godbolt.org/z/qdE7d3G4f

This MR relaxes the constraints for the `*slice_u8` variants of the test (by changing `CHECK-NEXT` to `CHECK-DAG`), whilst still maintaining the check for the necessary `or` logic.

Huge thanks to @Gelbpunkt for identifying this issue! It has been confirmed that this fix passes on a big endian target now as well.

Closes rust-lang/rust#151718
2026-03-02 20:10:33 +01:00
Jonathan Brouwer 6d16e3b73b Rollup merge of #153153 - folkertdev:thumb-and-arm, r=jieyouxu
add tests for thumb interworking

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

thumb programs (using a 16-bit instruction encoding) can call arm (32-bit instruction encoding) code. Doing so requires switching from thumb mode to arm mode, executing, then switching back. Test that this happens correctly, in particular for naked functions.

cc @thejpster can you confirm the output looks good here and that we're testing all of the relevant things
r? jieyouxu  because this is doing some interesting things testing-wise

I believe that we need run-make here because we need to look at the assembly after the linker has run. It will correct calls from thumb to arm: depending on the thumb version this either uses a special instruction or inserts  a call to a thunk that handles switching between thumb and arm mode.
2026-03-02 20:10:31 +01:00
bors 8ddf4ef064 Auto merge of #153278 - JonathanBrouwer:rollup-k88jgqQ, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#153169 (Various small query cleanups)
 - rust-lang/rust#152304 (stabilize new RangeToInclusive type)
 - rust-lang/rust#153046 (Couple of cg_ssa refactorings)
 - rust-lang/rust#153090 (elf-raw-dylib: set type for functions)
 - rust-lang/rust#153225 (tests/ui/asm: add annotations for reference rules)
 - rust-lang/rust#153233 (test: add regression test for fuzzy_provenance_casts lint ICE)
2026-03-02 12:02:00 +00:00
joboet e9ca34fe64 reference more reliable items in rustdoc tests 2026-03-02 11:57:04 +01:00
joboet 88cec3a1c0 update debuginfo visualizers and tests 2026-03-02 11:57:03 +01:00
Folkert de Vries 2d8ceee19c add tests for a thumb program calling arm code
and in particular for naked functions in that scenario
2026-03-02 10:53:51 +01:00
Takayuki Maeda ca74063cea simplify test case and add revisions for both solvers
remove *
2026-03-02 17:55:10 +09:00
Takayuki Maeda 6cda9bfafc replace issue number with link 2026-03-02 17:51:16 +09:00
Takayuki Maeda 66786fc407 fix next-solver ICE on PointeeSized goals 2026-03-02 17:50:02 +09:00
Jonathan Brouwer 80a9870aba Rollup merge of #153233 - yuyahy:ice-issue-137588-regression-test, r=nnethercote
test: add regression test for fuzzy_provenance_casts lint ICE

This PR adds a regression test for an ICE in `draw_code_line` that occurred when emitting a `fuzzy_provenance_casts` lint diagnostic for code with an inner attribute spanning the entire file, causing a panic on an empty `file_lines` from a dummy span.

The ICE no longer reproduces on the latest main. This PR only adds a regression test to prevent future regressions.
The test is based on the auto-reduced code from the issue.
rust-lang/rust#137588
2026-03-02 09:49:25 +01:00
Jonathan Brouwer 84f63879e8 Rollup merge of #153225 - DanielEScherzer:test-references-asm, r=ehuss
tests/ui/asm: add annotations for reference rules

r? ehuss

Replaced rust-lang/rust#152881 which got closed when the branch was renamed

@rustbot label +A-docs
2026-03-02 09:49:24 +01:00
Jonathan Brouwer 09b8f72ef0 Rollup merge of #153090 - mati865:elf-raw-dylib-fns, r=TaKO8Ki
elf-raw-dylib: set type for functions

Avoids GNU ld warnings like:
```
type and size of dynamic symbol `meooooooooooooooow' are not defined
```
First noticed in https://github.com/rust-lang/rust/pull/152451#issuecomment-3880667900 with changes from https://github.com/rust-lang/rust/pull/149937.
2026-03-02 09:49:23 +01:00
Jonathan Brouwer ad4b2c01a1 Rollup merge of #153046 - bjorn3:cg_ssa_cleanups, r=TaKO8Ki
Couple of cg_ssa refactorings

These should help a bit with using cg_ssa in cg_clif at some point in the future.
2026-03-02 09:49:22 +01:00
Jonathan Brouwer 44c70812bc Rollup merge of #152304 - pitaj:stabilize-new_range_api, r=tgross35
stabilize new RangeToInclusive type

stabilizes `core::range::RangeToInclusive`

```rust
// in core::range

pub struct RangeToInclusive<Idx> {
    pub last: Idx,
}

impl<Idx: fmt::Debug> fmt::Debug for RangeInclusive<Idx> { /* ... */ }

impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
    pub const fn contains<U>(&self, item: &U) -> bool
    where
        Idx: [const] PartialOrd<U>,
        U: ?Sized + [const] PartialOrd<Idx>;
}

impl<T> const RangeBounds<T> for RangeToInclusive<T> { /* ... */ }
impl<T> const RangeBounds<T> for RangeToInclusive<&T> { /* ... */ }

impl<T> const From<RangeToInclusive<T>> for legacy::RangeToInclusive<T> { /* ... */ }
impl<T> const From<legacy::RangeToInclusive<T>> for RangeToInclusive<T> { /* ... */ }

unsafe impl<T> const SliceIndex<[T]> for range::RangeToInclusive<usize> {
    type Output = [T];
    /* ... */
}
unsafe impl const SliceIndex<str> for range::RangeToInclusive<usize> {
    type Output = str;
    /* ... */
}
```

Tracking issue: https://github.com/rust-lang/rust/issues/125687
2026-03-02 09:49:22 +01:00
Jonathan Brouwer af84b2a02a Rollup merge of #153169 - nnethercote:rm-is_anon-etc, r=petrochenkov
Various small query cleanups

I found these while doing a close read of the query code.

r? @oli-obk
2026-03-02 09:49:21 +01:00
bors 8d50bccc5b Auto merge of #153251 - scottmcm:deallocate-nonnull, r=joboet
Update `__rust_[rd]ealloc` to take `NonNull<u8>` instead of `*mut u8`

Passing null to it is [already UB per Miri](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=8dcd25a549c11de72adc94a668277779) anyway, and this is ABI-compatible as `NonNull` is `repr(transparent)`.

Inspired by https://github.com/rust-lang/rust/pull/152702#discussion_r2829961575 ; Similar to rust-lang/rust#152605 which changed `align: usize` to `align: ptr::Alignment`.
2026-03-02 08:10:05 +00:00
Nicholas Nethercote 5bd28b85bd Remove FromCycleError impl for SymbolName.
It has no effect.

`symbol_name` is the only query that produces a `SymbolName`. If it was
marked with `cycle_delayed_bug`/`cycle_stash` then this `FromCycleError`
impl would make sense, but that's not the case. Maybe it was the case in
the past.
2026-03-02 14:26:58 +11:00
Nicholas Nethercote 5677f7c706 Rename trait Value as FromCycleError.
`Value` is an unhelpfully generic name. Standard naming procedure for a
trait with a single method is for the trait name to match the method
name, which is what this commit does. Likewise, the enclosing module is
renamed from `values` to `from_cycle_error`.

Also add a comment about some non-obvious behaviour.
2026-03-02 14:26:58 +11:00
Nicholas Nethercote 6f111d21a5 Remove a duplicated comment.
This exact comment block also appears in
`compiler/rustc_middle/src/queries.rs`, which is a better place for it.
2026-03-02 14:26:58 +11:00
Nicholas Nethercote 2aaced6344 Replace two abort_if_errors calls.
Calling `abort_if_errors` after emitting an error is guaranteed to call
`raise_fatal`, so just do that directly instead.
2026-03-02 14:26:58 +11:00
Nicholas Nethercote 8129da81e2 Remove three single-use type synonyms.
It's an unnecessary level of indirection.
2026-03-02 14:26:56 +11:00
Nicholas Nethercote fc395ed961 Merge two assertion blocks in execute_job_non_incr.
It reads better that way.
2026-03-02 14:23:55 +11:00
Nicholas Nethercote 7a4daa48b8 Avoid an early return in try_execute_query.
When there are two cases of equal size and importance, I find an if/else
expression easier to read than an early return.
2026-03-02 14:21:03 +11:00
Nicholas Nethercote c0770baed8 Make from_cycle_error consume the CycleError.
This makes it clear the `CycleError` is not used after the call.
2026-03-02 14:21:03 +11:00
Nicholas Nethercote cc1b878386 Inline and remove handle_cycle_error.
It has a single use.
2026-03-02 14:21:03 +11:00
Nicholas Nethercote 72a001bc25 Remove DepKindVTable::is_anon.
It's unused.
2026-03-02 14:21:00 +11:00
bors ddd36bd570 Auto merge of #153157 - madsmtm:fix-eq-derive-comptime-regression, r=JonathanBrouwer
Re-add `#[inline]` to `Eq::assert_fields_are_eq`

Fixes a compile-time regression in https://github.com/rust-lang/rust/pull/149978: non-inline methods are generally codegen'd while inline methods are deferred (and this function should never be called, so deferring is the right choice).

r? JonathanBrouwer
CC @cyrgani
2026-03-02 02:41:00 +00:00
joboet 4d09563d8d bless UI tests referencing atomic primitives 2026-03-02 00:23:24 +01:00
joboet 95e571ded1 update references to Atomic in diagnostics
... and remove some unused diagnostic items.
2026-03-02 00:23:23 +01:00
joboet 4b86b1a11a compiler: manually implement DynSend for atomic primitives
The manual `DynSend` implementation for `AtomicPtr` blocks the
auto-implementation for other atomic primitives since they forward to the same
`Atomic<T>` type now. This breakage cannot occur in user code as it depends on
`DynSend` being a custom auto-trait.
2026-03-02 00:23:23 +01:00
joboet fa66fef1d1 core: make atomic primitives type aliases of Atomic<T> 2026-03-02 00:23:23 +01:00
bors e7d90c695a Auto merge of #153131 - Kobzol:filesearch-opt, r=nnethercote
Optimize dependency file search

I tried to look into the slowdown reported in https://github.com/rust-lang/cargo/issues/16665.

I created a Rust hello world program, and used this Python script to create a directory containing 200k files:
```python
from pathlib import Path

dir = Path("deps")
dir.mkdir(parents=True, exist_ok=True)
for i in range(200000):
    path = dir / f"file{i:07}.o"
    with open(path, "w") as f:
        f.write("\n")
```

Then I tried to do various small microoptimalizations and simplifications to the code that iterates the search directories. Each individual commit improved performance, with the third one having the biggest effect.

Here are the results on `main` vs the last commit with the stage1 compiler on Linux, using `hyperfine "rustc +stage1 src/main.rs -L deps" -r 30` (there's IO involved, so it's good to let it run for a while):

```bash
Benchmark 1: rustc +stage1 src/main.rs -L deps
  Time (mean ± σ):     299.4 ms ±   2.7 ms    [User: 161.9 ms, System: 144.9 ms]
  Range (min … max):   294.8 ms … 307.1 ms    30 runs

Benchmark 1: rustc +stage1 src/main.rs -L deps
  Time (mean ± σ):     208.1 ms ±   4.5 ms    [User: 87.3 ms, System: 128.7 ms]
  Range (min … max):   202.4 ms … 219.6 ms    30 runs
```

Would be cool if someone could try this on macOS (maybe @ehuss - not sure if you have macOS or you only commented about its behavior on the Cargo issue :) ).

I also tried to prefilter the paths (not in this PR); right now we load everything and then we filter files with given prefixes, that's wasteful. Filtering just files starting with `lib` would get us down to ~150ms here. (The baseline without `-L` is ~80ms on my PC). The rest of the 70ms is essentially allocations from iterating the directory entries and sorting. That would be very hard to change - iterating the directory entries (de)allocates a lot of intermediate paths :( We'd have to implement the iteration by hand with either arena allocation, or at least some better management of memory.

r? @nnethercote
2026-03-01 23:00:45 +00:00
bors 80381278a0 Auto merge of #153260 - JonathanBrouwer:rollup-J54yMmy, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#153130 (std: move `getpid` to `sys::process`)
 - rust-lang/rust#152549 (Revert "resolve: Downgrade `ambiguous_glob_imports` to warn-by-default")
 - rust-lang/rust#153231 (diags: Pass `DiagArgMap` instead of `FluentArgs` into `format_diag_message`)
 - rust-lang/rust#153246 (Fix compile error in std::fs impl on VEXos target)
 - rust-lang/rust#153255 (Recover feature lang_items for emscripten)
 - rust-lang/rust#153257 (update my mailmap)
2026-03-01 19:45:00 +00:00
Jonathan Brouwer 0f378f9902 Rollup merge of #153257 - lqd:lqd-mailmap, r=lqd
update my mailmap

This canonicalizes new email addresses in the mailmap.

self reviews are OK for this kind of change: r? me
2026-03-01 17:43:43 +01:00
Jonathan Brouwer f118cddf47 Rollup merge of #153255 - mu001999-contrib:fix/features, r=joboet
Recover feature lang_items for emscripten

Fixes https://github.com/rust-lang/rust/pull/152469#discussion_r2858304043

The previous https://github.com/rust-lang/rust/pull/153128 lacks of `feature`
2026-03-01 17:43:43 +01:00
Jonathan Brouwer 3bbbcbac91 Rollup merge of #153246 - vexide:fix/fs-dir, r=joboet
Fix compile error in std::fs impl on VEXos target

This PR fixes a compile error in the standard library on the `armv7a-vex-v5` target that was caused by there not being a version of the `Dir` struct exported from `std::sys::fs::vexos`. Reading from directories isn't supported on this platform, so the module now re-exports the unsupported version of `Dir`.
2026-03-01 17:43:42 +01:00
Jonathan Brouwer db167a8094 Rollup merge of #153231 - JonathanBrouwer:move_diag_arg_map, r=Kivooeo
diags: Pass `DiagArgMap` instead of `FluentArgs` into `format_diag_message`

This PR no longer exposes `FluentArgs` outside of `translation.rs`, instead using the already existing `DiagArgMap`.
This is in preparation of a few upcoming PRs, as well as just making the code slightly nicer.

Will do a perf run because this technically calls `to_fluent_args` a few more times than previously, but not expecting this to be significant
2026-03-01 17:43:42 +01:00
Jonathan Brouwer ca6dc4c7be Rollup merge of #152549 - petrochenkov:diesel3, r=fmease
Revert "resolve: Downgrade `ambiguous_glob_imports` to warn-by-default"

This reverts commit cd05071ec4.

Revert of https://github.com/rust-lang/rust/pull/151130.
This will need to be merged after ~February 27 2026, when Rust 1.95 branches out from the main branch.
2026-03-01 17:43:41 +01:00
Jonathan Brouwer ad896d3457 Rollup merge of #153130 - joboet:move_getpid_sys_process, r=Mark-Simulacrum
std: move `getpid` to `sys::process`

Part of rust-lang/rust#117276.

Availability of process IDs is highly correlated with availability of processes, so moving the `getpid` implementations to `sys::process` makes a lot of sense (and removes quite some code duplication). The only notable change here is on Hermit, which doesn't have processes but does have `getpid`. But that [always returns 0](https://github.com/hermit-os/kernel/blob/ef27b798856b50d562a42c4ffd2edcb7493c5b5f/src/syscalls/tasks.rs#L21), so I doubt it is useful. If the change to a panic is problematic we could always copy the stub implementation and return zero ourselves (this also applies to the other single-process platforms).

CC @stlankes @mkroening
2026-03-01 17:43:40 +01:00
bors 28b5c1cc08 Auto merge of #153122 - Zalathar:dep-kind-vtable, r=nnethercote
Improve the forcing/promotion functions in `DepKindVTable`

This is a bundle of changes to the two function pointers in `DepKindVTable` that are responsible for forcing dep nodes, or promoting disk-cached values from the previous session into memory.

The perf improvements to incr-unchanged and incr-patched are likely from skipping more of the “promotion” plumbing for queries that never cache to disk.
2026-03-01 16:28:20 +00:00
bors 024757fea5 Auto merge of #153252 - matthiaskrgr:rollup-uYxeyaV, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#152042 (Suggest async block instead of async closure when possible)
 - rust-lang/rust#152949 (Introduce --ci flag in tidy)
 - rust-lang/rust#152655 (Disable debug_assert_not_in_new_nodes for multiple threads)
 - rust-lang/rust#153209 (Clean up `QueryVTable::hash_result` into `hash_value_fn`)
 - rust-lang/rust#153229 (rustfmt: add test for field representing type builtin syntax)
2026-03-01 13:17:01 +00:00
Rémy Rakic 51e40d6379 update my mailmap 2026-03-01 13:00:22 +01:00
mu001999 17ba37fe89 Recover feature lang_items for emscripten 2026-03-01 18:57:52 +08:00
Jonathan Brouwer 01dbf41bc0 Add doc comment to DiagArgMap 2026-03-01 10:47:29 +01:00
Jonathan Brouwer 51f35d76a2 Pass DiagArgMap instead of FluentArgs into format_diag_message 2026-03-01 10:07:39 +01:00
Jonathan Brouwer 5ade46246e Move DiagArgMap to rustc_error_messages 2026-03-01 10:07:36 +01:00
Zalathar 08df254a60 Don't try to promote queries that never cache to disk 2026-03-01 19:42:19 +11:00
Zalathar f7ac4266f5 Explain why some queries don't support forcing/promotion 2026-03-01 19:42:19 +11:00