Commit graph

308340 commits

Author SHA1 Message Date
Matthias Krüger
b134c9c135
Rollup merge of #147630 - nnethercote:bitset-cleanups, r=cjgillot,Zalathar
Bitset cleanups

Some minor cleanups I did while working on rust-lang/rust#147619.

r? ```@Zalathar```
2025-10-14 19:47:30 +02:00
Matthias Krüger
f8b65f7bc7
Rollup merge of #147526 - bjorn3:alloc_shim_weak_shape, r=petrochenkov,RalfJung
Move computation of allocator shim contents to cg_ssa

In the future this should make it easier to use weak symbols for the allocator shim on platforms that properly support weak symbols. And it would allow reusing the allocator shim code for handling default implementations of the upcoming externally implementable items feature on platforms that don't properly support weak symbols.

In addition to make this possible, the alloc error handler is now handled in a way such that it is possible to avoid using the allocator shim when liballoc is compiled without `no_global_oom_handling` if you use `#[alloc_error_handler]`. Previously this was only possible if you avoided liballoc entirely or compiled it with `no_global_oom_handling`. You still need to avoid libstd and to define the symbol that indicates that avoiding the allocator shim is unstable.
2025-10-14 19:47:29 +02:00
Matthias Krüger
dcd2dd9bba
Rollup merge of #146503 - joboet:macos-condvar-timeout, r=ibraheemdev
std: improve handling of timed condition variable waits on macOS

Fixes rust-lang/rust#37440 (for good).

This fixes two issues with `Condvar::wait_timeout` on macOS:

Apple's implementation of `pthread_cond_timedwait` internally converts the absolute timeout to a relative one, measured in nanoseconds, but fails to consider overflow when doing so. This results in `wait_timeout` returning much earlier than anticipated when passed a duration that is slightly longer than `u64::MAX` nanoseconds (around 584 years). The existing clamping introduced by rust-lang/rust#42604 to address rust-lang/rust#37440 unfortunately used a maximum duration of 1000 years and thus still runs into the bug when run on older macOS versions (or with `PTHREAD_MUTEX_USE_ULOCK` set to a value other than "1"). See https://github.com/rust-lang/rust/issues/37440#issuecomment-3285958326 for context.

Reducing the maximum duration alone however would not be enough to make the implementation completely correct. As macOS does not support `pthread_condattr_setclock`, the deadline passed to `pthread_cond_timedwait` is measured against the wall-time clock. `std` currently calculates the deadline by retrieving the current time and adding the duration to that, only for macOS to convert the deadline back to a relative duration by [retrieving the current time itself](1ebf56b3a7/src/pthread_cond.c (L802-L819)) (this conversion is performed before the aforementioned problematic one). Thus, if the wall-time clock is adjusted between the `std` lookup and the system lookup, the relative duration could have changed, possibly even to a value larger than $2^{64}\ \textrm{ns}$. Luckily however, macOS supports the non-standard, tongue-twisting `pthread_cond_timedwait_relative_np` function which avoids the wall-clock-time roundtrip by taking a relative timeout. Even apart from that, this function is perfectly suited for `std`'s purposes: it is public (albeit badly-documented) API, [available since macOS 10.4](1ebf56b3a7/include/pthread/pthread.h (L555-L559)) (that's way below our minimum of 10.12) and completely resilient against wall-time changes as all timeouts are [measured against the monotonic clock](e3723e1f17/bsd/kern/sys_ulock.c (L741)) inside the kernel.

Thus, this PR switches `Condvar::wait_timeout` to `pthread_cond_timedwait_relative_np`, making sure to clamp the duration to a maximum of $2^{64} - 1 \ \textrm{ns}$. I've added a miri shim as well, so the only thing missing is a definition of `pthread_cond_timedwait_relative_np` inside `libc`.
2025-10-14 19:47:28 +02:00
Matthias Krüger
252974a717
Rollup merge of #146187 - clarfonthey:const-drop-in-place, r=oli-obk
Unstably constify `ptr::drop_in_place` and related methods

Tracking: rust-lang/rust#109342
Supercedes: rust-lang/rust#145725

Makes methods const:

* `core::ptr::drop_in_place`
* `core::mem::ManuallyDrop::drop`
* `core::mem::MaybeUninit::assume_init_drop`
* `<[core::mem::MaybeUninit<_>]>::assume_init_drop`
* `<*mut _>::drop_in_place`
* `core::ptr::NonNull::drop_in_place`
2025-10-14 19:47:28 +02:00
bors
844264adda Auto merge of #147675 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 6d4b23478d.

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

r? `@ghost`
2025-10-14 17:45:05 +00:00
Jana Dönszelmann
43d915c426
remove span calls from deprecated attribute checking 2025-10-14 18:44:22 +02:00
Jana Dönszelmann
047c37cf23
convert rustc_main to the new attribute parsing infrastructure 2025-10-14 17:55:00 +02:00
bjorn3
cf0256008b Add comment to AllocatorKind and AllocatorMethod 2025-10-14 15:53:40 +00:00
Samuel Moelius
1bd8cad5a2 Allow explicit_write in tests 2025-10-14 11:52:54 -04:00
Jana Dönszelmann
a51a793472
only check duplicates on old/unparsed attributes 2025-10-14 17:32:05 +02:00
Paul Murphy
4945d21ed9 Implement ppc/ppc64 preserves_flags option for inline asm
Implemented preserves_flags on powerpc by making it do
nothing. This prevents having two different ways to mark
`cr0` as clobbered. clang and gcc alias `cr0` to `cc`.

The gcc inline documentation does not state what this does
on powerpc* targets, but inspection of the source shows
it is equivalent to condition register field `cr0`, so it
should not be added.
2025-10-14 10:05:07 -05:00
Laurențiu Nicola
7d93599fb1 Add new_zeroed_alloc to rust-analyzer ALLOW_FEATURES 2025-10-14 17:58:51 +03:00
Paul Murphy
3c09d4a582 Allow vector-scalar (vs) registers in ppc inline assembly
Where supported, VSX is a 64x128b register set which encompasses
both the floating point and vector registers.

In the type tests, xvsqrtdp is used as it is the only two-argument
vsx opcode supported by all targets on llvm. If you need to copy
a vsx register, the preferred way is "xxlor xt, xa, xa".
2025-10-14 09:52:56 -05:00
yukang
c00b4ba5ef Fix ICE caused by associated_item_def_ids on wrong type in resolve diag 2025-10-14 22:39:10 +08:00
Jana Dönszelmann
7a368c8abb
Use span from parsed attribute 2025-10-14 16:17:36 +02:00
Jana Dönszelmann
3941b42993
return spans out of is_doc_comment to reduce reliance on .span() on attrs 2025-10-14 15:36:09 +02:00
bors
e100792918 Auto merge of #147662 - Zalathar:rollup-j8ci0f2, r=Zalathar
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#146277 (Enable `u64` limbs in `core::num::bignum`)
 - rust-lang/rust#146976 (constify basic Clone impls)
 - rust-lang/rust#147249 (Do two passes of `handle_opaque_type_uses_next`)
 - rust-lang/rust#147266 (fix 2 search graph bugs)
 - rust-lang/rust#147497 (`proc_macro` cleanups (3/N))
 - rust-lang/rust#147546 (Suppress unused_parens for labeled break)
 - rust-lang/rust#147548 (Fix ICE for never pattern as closure parameters)
 - rust-lang/rust#147594 (std: implement `pal::os::exit` for VEXos)
 - rust-lang/rust#147596 (Adjust the Arm targets in CI to reflect latest changes)
 - rust-lang/rust#147607 (GVN: Invalidate derefs at loop headers)
 - rust-lang/rust#147620 (Avoid redundant UB check in RangeFrom slice indexing)
 - rust-lang/rust#147647 (Hide vendoring and copyright in GHA group)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-14 12:32:31 +00:00
Laurențiu Nicola
34b19c274e
Merge pull request #20840 from lnicola/fix-lockfile
minor: Fix lockfile
2025-10-14 11:45:52 +00:00
Jana Dönszelmann
37fa60bbf1
pretty print u128 with display 2025-10-14 13:43:50 +02:00
Laurențiu Nicola
0634661796 Fix lockfile 2025-10-14 14:34:14 +03:00
Laurențiu Nicola
a4b486ae37
Merge pull request #20839 from lnicola/rustc-pull
minor: sync from downstream
2025-10-14 11:05:18 +00:00
Laurențiu Nicola
cd101ef80e Bump rustc crates a little 2025-10-14 13:34:47 +03:00
Laurențiu Nicola
0430ba2085 Merge ref 'fb24b04b09' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: fb24b04b09
Filtered ref: 8d328b994c70dfeed12717a13a915703ec939cfc
Upstream diff: 3369e82c6b...fb24b04b09

This merge was created using https://github.com/rust-lang/josh-sync.
2025-10-14 13:31:56 +03:00
Laurențiu Nicola
78bbc598b8 Prepare for merging from rust-lang/rust
This updates the rust-version file to fb24b04b09.
2025-10-14 13:27:01 +03:00
joboet
fe1238e696
miri: shim pthread_cond_timedwait_relative_np 2025-10-14 11:57:50 +02:00
joboet
8a145efc70
std: improve handling of timed condition variable waits on macOS 2025-10-14 11:57:50 +02:00
lcnr
4dfbf11644 cleanup ErrorGuaranteed handling 2025-10-14 11:31:32 +02:00
bors
2f7620a5cc Auto merge of #146414 - GuillaumeGomez:run-test-with-gcc-backend, r=Kobzol
Add a CI job that runs a subset of UI tests with the GCC backend

Part of https://github.com/rust-lang/compiler-team/issues/891.

r? `@Kobzol`
2025-10-14 09:21:23 +00:00
Shoyu Vanilla (Flint)
63f364601a
Merge pull request #20673 from A4-Tacks/break-value
Add break value completion support
2025-10-14 08:59:29 +00:00
A4-Tacks
1d2c84d57e
Add break value completion support
```rust
fn foo() -> i32 {
    loop {
        $0
    }
}
```

**Before this PR**:

```rust
fn foo() -> i32 {
    loop {
        break;
    }
}
```

**After this PR**:

```rust
fn foo() -> i32 {
    loop {
        break $0;
    }
}
```
2025-10-14 16:37:32 +08:00
cyrgani
18d1b69c92
fix missing link to std::char in std docs 2025-10-14 10:23:29 +02:00
Shoyu Vanilla (Flint)
4794fb9562
Merge pull request #20772 from A4-Tacks/fix-nested-pull-assign-up
Fix not applicable match inside if for pull_assignment_up
2025-10-14 07:58:34 +00:00
Shoyu Vanilla (Flint)
0ebc92abd2
Merge pull request #20758 from A4-Tacks/guarded-if-let-else
Add else-block support for convert_to_guarded_return
2025-10-14 07:51:59 +00:00
Shoyu Vanilla (Flint)
f4beb80f33
Merge pull request #20838 from A4-Tacks/conv-to-guard-ret-exist-else
Fix applicable on let-else for convert_to_guarded_return
2025-10-14 07:40:17 +00:00
A4-Tacks
1597162eea
Fix applicable on let-else for convert_to_guarded_return
Example
---
```rust
fn foo() -> bool {
    let$0 Some(x) = Some(2) else { return false };
}
```

**Before this PR**:

```rust
fn foo() -> bool {
    let Some(Some(x)) = Some(2) else { return };
}
```

**After this PR**:

Assist not applicable
2025-10-14 14:47:08 +08:00
Kivooeo
714843dc57 replace manual implementation with carrying_mul_add 2025-10-14 06:13:22 +00:00
Nicholas Nethercote
8386278866 Factor out a recurring pattern as count_ones. 2025-10-14 16:35:56 +11:00
Stuart Cook
0f6fe9112a
Rollup merge of #147647 - Noratrieb:bootstrap-groups, r=Zalathar
Hide vendoring and copyright in GHA group

These two steps are currently the most verbose steps in a dist-linux build, which makes it harder to find more interesting parts. Hide them in a group like most things.

For example, see https://github.com/rust-lang/rust/actions/runs/18462295959/job/52596384752
2025-10-14 16:31:03 +11:00
Stuart Cook
4a67c015bd
Rollup merge of #147620 - saethlin:RangeFrom-noubcheck, r=scottmcm
Avoid redundant UB check in RangeFrom slice indexing

I noticed this while picking through the IR we generate for https://github.com/rust-lang/rust/pull/134938. I think we just forgot to apply this trick to `RangeFrom`?
2025-10-14 16:31:02 +11:00
Stuart Cook
4fc3a05e54
Rollup merge of #147607 - dianqk:gvn-deref-loop, r=cjgillot
GVN: Invalidate derefs at loop headers

Fix a miscompiled case I found when re-reviewing rust-lang/rust#132527.

r? cjgillot
r? oli-obk
2025-10-14 16:31:02 +11:00
Stuart Cook
2ad61521d7
Rollup merge of #147596 - thejpster:build-new-arm-tier2-targets, r=Mark-Simulacrum
Adjust the Arm targets in CI to reflect latest changes

* Adds build of `armv7a-none-eabihf` (https://github.com/rust-lang/rust/pull/146522)
* Adds build of `armv8r-none-eabihf` (https://github.com/rust-lang/rust/pull/146520)
* Drops build of `armeb*-none-*` (https://github.com/rust-lang/rust/pull/146523)

I wasn't sure why `armv7a-none-eabihf` was missing from the build-manifest program, but `armv8r-none-eabihf` was there, as they were both Tier 3 targets up until very recently. So, I added it, but that might be wrong.
2025-10-14 16:31:01 +11:00
Stuart Cook
a594163d6d
Rollup merge of #147594 - vexide:vexos-exit-impl, r=joboet
std: implement `pal::os::exit` for VEXos

This PR provides a more "proper" implementation of process exiting in VEXos programs by going through `vexSystemExitRequest` rather than calling `intrinsics::abort`, which exits using an undefined instruction trap. This matches the existing implementation of `rt::abort_internal` and therefore makes `std::process::exit` have the same behavior as returning from main on VEXos targets.
2025-10-14 16:31:00 +11:00
Stuart Cook
0a7f159111
Rollup merge of #147548 - chenyukang:yukang-fix-ice-141592, r=jackh726
Fix ICE for never pattern as closure parameters

Fixes rust-lang/rust#141592

`diverge` is set here for never pattern in parameter:
https://github.com/rust-lang/rust/blob/master/compiler/rustc_hir_typeck/src/check.rs#L87-L90

the assertion is too strict, I set it delay as bug for later error.
2025-10-14 16:31:00 +11:00
Stuart Cook
a49246a614
Rollup merge of #147546 - chenyukang:yukang-fix-break-label-147542, r=jackh726
Suppress unused_parens for labeled break

Fixes rust-lang/rust#147542
2025-10-14 16:30:59 +11:00
Stuart Cook
428be2fbc9
Rollup merge of #147497 - cyrgani:proc-macro-cleanups-3, r=petrochenkov
`proc_macro` cleanups (3/N)

Followup to rust-lang/rust#147386, which removed the old `Decode` trait.
Can be reviewed commit by commit.
2025-10-14 16:30:58 +11:00
Stuart Cook
4321adfbe0
Rollup merge of #147266 - lcnr:fix-search_graph, r=BoxyUwU
fix 2 search graph bugs

wooooooooops, i should really run the fuzzer even when not changing the structure of the search graph as a whole :3 fixes the `ml-kem` ICE in the next-solver crater run

r? ````@BoxyUwU````
2025-10-14 16:30:58 +11:00
Stuart Cook
3a80521ad2
Rollup merge of #147249 - jackh726:opaque-type-fallback, r=lcnr
Do two passes of `handle_opaque_type_uses_next`

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/240

Also did a little bit of cleanup, can squash the commits if decided.

r? lcnr
2025-10-14 16:30:57 +11:00
Stuart Cook
ed290fdd5c
Rollup merge of #146976 - npmccallum:clone, r=scottmcm
constify basic Clone impls
2025-10-14 16:30:56 +11:00
Stuart Cook
6e07b25bf0
Rollup merge of #146277 - Kivooeo:u64-unlock, r=scottmcm
Enable `u64` limbs in `core::num::bignum`

Since `u128` is stable now, I guess, we can safely add this, not sure if this requires tests or anything

cc https://github.com/rust-lang/rust/issues/137887
2025-10-14 16:30:56 +11:00
bors
fb24b04b09 Auto merge of #147353 - the8472:nondrop-array-iter, r=scottmcm
only call polymorphic array iter drop machinery when the type requires it

I saw a bunch of dead, empty  `<[core::mem::maybe_uninit::MaybeUninit<T>; N] as core::array::iter::iter_inner::PartialDrop>::partial_drop` functions when compiling with more than 1 CGU.

Let's see if we can help optimizations to eliminate stuff earlier.

r? ghost
2025-10-14 05:29:24 +00:00