Commit graph

307938 commits

Author SHA1 Message Date
Rémy Rakic
68080de4e3 ignore boring locals when explaining borrow due to drop
Polonius liveness has to contain boring locals, and we ignore them in
diagnostics to match NLL diagnostics, since they doesn't contain boring locals.

We ignored these when explaining why a loan contained a point due to
a use of a live var, but not when it contained a point due to a drop of
a live var.
2025-10-15 15:47:44 +00:00
bors
4f08307f6e Auto merge of #147619 - nnethercote:union-ne-check, r=Zalathar
Add a `!=` check to `ChunkedBitSet::union`.

It's a big speed win for `cranelift-codegen-0.119.0`.

r? `@Zalathar`
2025-10-15 10:04:49 +00:00
bors
5413f7d39c Auto merge of #147715 - matthiaskrgr:rollup-611b4x4, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#146841 (Stabilise `rotate_left` and `rotate_right` in `[_]` as `const fn` items.)
 - rust-lang/rust#146949 (Add vsx register support for ppc inline asm, and implement preserves_flag option)
 - rust-lang/rust#147539 (resolve: Use primitives for conditional mutability more consistently)
 - rust-lang/rust#147685 (remove span calls from deprecated attribute checking)
 - rust-lang/rust#147699 (Clairify docs for `AttributeKind::DocComment`)
 - rust-lang/rust#147706 (Add myself to review rotation)
 - rust-lang/rust#147711 (Clarify that UB will occur, not can/may in GlobalAlloc docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-15 05:45:37 +00:00
Matthias Krüger
ed6077ab18
Rollup merge of #147711 - saethlin:GlobalAlloc-safety, r=Amanieu
Clarify that UB will occur, not can/may in GlobalAlloc docs

These doc comments start out very clear by saying the caller "must" or "has to" ensure something, but the end with some form of "otherwise undefined behavior may result" which sounds like it is implementation-defined and seems to conflict with the way the paragraph starts. Consistent phrasing makes it clearer that when the safety precondition is violated, UB is encountered.

Some of the phrasing here is a bit awkward to me, I don't think we usually say "the behavior is undefined" `@RalfJung` right? But in either case I'm trying to be surgical in my edit here.

r? Amanieu
2025-10-15 07:09:57 +02:00
Matthias Krüger
6f6a1ce4d8
Rollup merge of #147706 - madsmtm:review-rotation, r=chenyukang
Add myself to review rotation

I'll try it out for a while, and see if I can keep up with things

r? compiler
2025-10-15 07:09:57 +02:00
Matthias Krüger
e389ffa763
Rollup merge of #147699 - aDotInTheVoid:doc-comment-doc-comment, r=jdonszelmann
Clairify docs for `AttributeKind::DocComment`

Makes it clear that this represents `#[doc = "content"]`, but not `#[doc(hidden)]` (or other uses of the `#[doc(...)]` attribute).

r? `@jdonszelmann`
2025-10-15 07:09:56 +02:00
Matthias Krüger
72030511bb
Rollup merge of #147685 - jdonszelmann:deprecated-no-span, r=JonathanBrouwer
remove span calls from deprecated attribute checking

r? `@JonathanBrouwer`
2025-10-15 07:09:56 +02:00
Matthias Krüger
33b1e92d4f
Rollup merge of #147539 - petrochenkov:cmresolve, r=eholk
resolve: Use primitives for conditional mutability more consistently

No bare `(Ref)Cell`s remain in `rustc_resolve`, only `Cm(Ref)Cell`s checking that nothing is modified during speculative resolution, and `Cache(Ref)Cell` aliases for cells that need to be migrated to mutexes/atomics.

cc `@LorrensP-2158466`
2025-10-15 07:09:55 +02:00
Matthias Krüger
041ecb124a
Rollup merge of #146949 - pmur:murp/improve-ppc-inline-asm, r=Amanieu
Add vsx register support for ppc inline asm, and implement preserves_flag option

This should address the last(?) missing pieces of inline asm for ppc:

* Explicit VSX register support. ISA 2.06 (POWER7) added a 64x128b register overlay extending the fpr's to 128b, and unifies them with the vmx (altivec) registers. Implementations details within gcc/llvm percolate up, and require using the `x` template modifier. I have updated the inline asm to implicitly include this for vsx arguments which do not specify it. ~~Support for the gcc codegen backend is still a todo.~~

* Implement the `preserves_flags` option. All ABI's, and all ISAs store their flags in `cr`, and the carry bit lives inside `xer`. The other status registers hold sticky bits or control bits which do not affect branch instructions.

There is some interest in the e500 (powerpcspe) port. Architecturally, it has a very different FP ISA, and includes a simd extension called SPR (which is not IBM's cell SPE). Notably, it does not have altivec/fpr/vsx registers. It also has an SPE accumulator register which its ABI marks as volatile, but I am not sure if the compiler uses it.
2025-10-15 07:09:54 +02:00
Matthias Krüger
8509756f46
Rollup merge of #146841 - bjoernager:const-slice-rotate, r=Amanieu
Stabilise `rotate_left` and `rotate_right` in `[_]` as `const fn` items.

Tracking issue: rust-lang/rust#143812

Closes: rust-lang/rust#143812

This PR stabilises the `const_slice_rotate` feature:

```rust
impl<T> [T] {
    pub const fn rotate_left(&mut self, mid: usize);

    pub const fn rotate_right(&mut self, k: usize);
}
```

No blockers or unresolved questions. FCP required.

Courtesy of `@okaneco.`
2025-10-15 07:09:54 +02:00
Nicholas Nethercote
60481827f6 Add a != check to ChunkedBitSet::union.
It's a big speed win for cranelift-codegen-0.119.0.
2025-10-15 13:49:38 +11:00
Nicholas Nethercote
facb9aca79 Refactor some ChunkedBitSet operations.
For less indentation, mostly.
2025-10-15 13:49:05 +11:00
Ben Kimock
72396d9f18 Clarify that UB will occur, not can/may in GlobalAlloc docs 2025-10-14 21:12:11 -04:00
Mads Marquart
efd7c8dd61 Add myself (madsmtm) to review rotation 2025-10-15 00:13:29 +02:00
bors
235a4c083e Auto merge of #147692 - matthiaskrgr:rollup-bqhlwyw, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#146187 (Unstably constify `ptr::drop_in_place` and related methods)
 - rust-lang/rust#146503 (std: improve handling of timed condition variable waits on macOS)
 - rust-lang/rust#147526 (Move computation of allocator shim contents to cg_ssa)
 - rust-lang/rust#147630 (Bitset cleanups)
 - rust-lang/rust#147638 (bpf: return results larger than one register indirectly)
 - rust-lang/rust#147666 (Replace manual implementation with `carrying_mul_add`)
 - rust-lang/rust#147669 (fix missing link to `std::char` in `std` docs)
 - rust-lang/rust#147673 (pretty print u128 with display)
 - rust-lang/rust#147677 (Fewer exceptions in `span()` on parsed attributes)
 - rust-lang/rust#147680 (Fix ICE caused by associated_item_def_ids on wrong type in resolve diag)
 - rust-lang/rust#147682 (convert `rustc_main` to the new attribute parsing infrastructure)
 - rust-lang/rust#147683 (only check duplicates on old/unparsed attributes)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-14 20:56:53 +00:00
Alona Enraght-Moony
ff95799e09 Clairify docs for AttributeKind::DocComment
Makes it clear that this represents `#[doc = "content"]`, but not
`#[doc(hidden)]` (or other uses of the `#[doc(...)]` attribute).
2025-10-14 19:47:58 +00:00
Matthias Krüger
545ee6fe6b
Rollup merge of #147683 - jdonszelmann:less-duplicate-checking, r=JonathanBrouwer
only check duplicates on old/unparsed attributes

r? ``@JonathanBrouwer``

This was effectively already what we were doing, but this was implicit because `.name()` etc were just returning None when dealing with a parsed attribute.... this makes it explicit
2025-10-14 19:47:35 +02:00
Matthias Krüger
ea0c8d8e73
Rollup merge of #147682 - jdonszelmann:convert-rustc-main, r=JonathanBrouwer
convert `rustc_main` to the new attribute parsing infrastructure

r? ``@JonathanBrouwer``
2025-10-14 19:47:34 +02:00
Matthias Krüger
3856d0b4fd
Rollup merge of #147680 - chenyukang:yukang-fix-ice-147325, r=estebank
Fix ICE caused by associated_item_def_ids on wrong type in resolve diag

Fixes rust-lang/rust#147325

r? ``@estebank``
2025-10-14 19:47:34 +02:00
Matthias Krüger
783307c4c3
Rollup merge of #147677 - jdonszelmann:fewer-span-exceptions, r=WaffleLapkin
Fewer exceptions in `span()` on parsed attributes

r? ``@JonathanBrouwer``
2025-10-14 19:47:33 +02:00
Matthias Krüger
5a2c639a23
Rollup merge of #147673 - jdonszelmann:u128-pp, r=JonathanBrouwer
pretty print u128 with display

r? ```@JonathanBrouwer```
2025-10-14 19:47:33 +02:00
Matthias Krüger
2ab43c2f91
Rollup merge of #147669 - cyrgani:cyrgani-patch-1, r=joboet
fix missing link to `std::char` in `std` docs

Missed this in rust-lang/rust#147373.
2025-10-14 19:47:32 +02:00
Matthias Krüger
49be94c392
Rollup merge of #147666 - Kivooeo:full_mud_add-followup, r=scottmcm
Replace manual implementation with `carrying_mul_add`

cc https://github.com/rust-lang/rust/pull/146277#discussion_r2427778317

r? scottmcm
2025-10-14 19:47:31 +02:00
Matthias Krüger
10e535a163
Rollup merge of #147638 - alessandrod:indirect-res, r=wesleywiser
bpf: return results larger than one register indirectly

Fixes triggering the "only small returns supported" error in the BPF target.
2025-10-14 19:47:30 +02:00
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
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
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
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