Commit Graph

167095 Commits

Author SHA1 Message Date
Matthias Krüger 91f48d8ba7 Rollup merge of #147000 - moturus:motor-os_stdlib_pr, r=tgross35
std: Add Motor OS std library port

Motor OS was added as a no-std Tier-3 target in
[PR 146848](https://github.com/rust-lang/rust/pull/146848) as x86_64-unknown-motor.

This PR adds the std library for Motor OS.

While the PR may seem large, all it does is proxy
std pal calls to [moto-rt](https://crates.io/crates/moto-rt). Where there is some non-trivial
code (e.g. thread::spawn), it is quite similar, often
identical, to what other platforms do.
2025-10-16 19:35:23 +02:00
bors f5242367f4 Auto merge of #146221 - camsteffen:ast-boxes, r=cjgillot
Remove boxes from ast list elements

Less indirection should be better perf.
2025-10-16 02:31:44 +00:00
Matthias Krüger a4d2811b88 Rollup merge of #147742 - Diggsey:db-fix-miri-whitespace, r=RalfJung
Revert unintentional whitespace changes to rustfmt-excluded file

Accidentally introduced in https://github.com/rust-lang/rust/pull/143548
2025-10-15 23:41:07 +02:00
Matthias Krüger 212826db7d Rollup merge of #147718 - RalfJung:miri-allocator_shim_contents, r=bjorn3
miri: use allocator_shim_contents codegen helper

r? `@bjorn3`

Follow-up to https://github.com/rust-lang/rust/pull/147526, also using that new infrastructure in Miri.
2025-10-15 23:41:05 +02:00
Matthias Krüger c607de5508 Rollup merge of #147676 - jdonszelmann:span-is-doc-comment, r=GuillaumeGomez
Return spans out of `is_doc_comment` to reduce reliance on `.span()` on attributes

r? `@GuillaumeGomez`
2025-10-15 23:41:03 +02:00
Diggory Blake 87e0f43c56 Revert unintentional whitespace changes to rustfmt-excluded file 2025-10-15 21:34:38 +01:00
Ralf Jung 804af99457 miri: use allocator_shim_contents codegen helper 2025-10-15 21:23:14 +02:00
bors 3f2a5921a4 Auto merge of #147730 - Muscraft:update-cargo, r=Muscraft
Update cargo

17 commits in 81c3f77a467359c8be6bc747dc93ec66a6e4ce11..367fd9f213750cd40317803dd0a5a3ce3f0c676d
2025-10-10 18:41:02 +0000 to 2025-10-15 15:01:32 +0000
- test: Don't look for a specfic ANSI color (rust-lang/cargo#16118)
- docs(guide): Clarify where to set config (rust-lang/cargo#16107)
- test(rustfix): re-enable disabled test due to unused variables (rust-lang/cargo#16114)
- Convert the "manifest has no things" warning to annotate_snippets. (rust-lang/cargo#16113)
- doc: make it clearer that `target.<cfg>.linker` is supported (rust-lang/cargo#16112)
- docs(guide): Cover feature-unification (rust-lang/cargo#16108)
- fix(gctx): types are unsupported not unknown (rust-lang/cargo#16109)
- fix(script): Tweak cargo script build-dir / target-dir (rust-lang/cargo#16086)
- docs(gctx): explain Value deserialization step-by-step (rust-lang/cargo#16105)
- docs(guide): Talk about removing unused features (rust-lang/cargo#16085)
- test(config): exercise unsupported TOML types (rust-lang/cargo#16100)
- docs(gctx): a bit more of how config deserialization works (rust-lang/cargo#16094)
- Refactor `Layout` into `BuildDirLayout` and `ArtifactDirLayout` (rust-lang/cargo#16092)
- Add alternative linker to the build performance guide (rust-lang/cargo#15991)
- refactor(gctx): extract error to a module (rust-lang/cargo#16091)
- fix: Fixed nightly tests failing due to unused_variables lint (rust-lang/cargo#16098)
- fix(script): Store cargo script lockfiles in build-dir (rust-lang/cargo#16087)

r? ghost
2025-10-15 17:07:35 +00:00
Scott Schafer b5906362dd Update cargo 2025-10-15 10:07:17 -06:00
bors 28d0a4a205 Auto merge of #143548 - Diggsey:db-limit-extern-crate-usage, r=oli-obk
Restrict sysroot crate imports to those defined in this repo.

It's common to import dependencies from the sysroot via `extern crate` rather than use an explicit cargo dependency, when it's necessary to use the same dependency version as used by rustc itself. However, this is dangerous for crates.io crates, since rustc may not pull in the dependency on some targets, or may pull in multiple versions. In both cases, the `extern crate` fails to resolve.

To address this, re-export all such dependencies from the appropriate `rustc_*` crates, and use this alias from crates which would otherwise need to use `extern crate`.

See https://github.com/rust-lang/rust/pull/143492 for an example of the kind of issue that can occur.
2025-10-15 13:32:03 +00:00
Diggory Blake c6a952159f Restrict sysroot crate imports to those defined in this repo.
It's common to import dependencies from the sysroot via `extern crate`
rather than use an explicit cargo dependency, when it's necessary to use
the same dependency version as used by rustc itself. However, this is
dangerous for crates.io crates, since rustc may not pull in the
dependency on some targets, or may pull in multiple versions. In both
cases, the `extern crate` fails to resolve.

To address this, re-export all such dependencies from the appropriate
`rustc_*` crates, and use this alias from crates which would otherwise
need to use `extern crate`.
2025-10-15 13:17:25 +01: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
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
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](https://github.com/apple-oss-distributions/libpthread/blob/1ebf56b3a702df53213c2996e5e128a535d2577e/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](https://github.com/apple-oss-distributions/libpthread/blob/1ebf56b3a702df53213c2996e5e128a535d2577e/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](https://github.com/apple-oss-distributions/xnu/blob/e3723e1f17661b24996789d8afc084c0c3303b26/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 https://github.com/rust-lang/rust-analyzer/commit/6d4b23478d8e5114e68278c64d4691ee6cf615e4.

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

r? `@ghost`
2025-10-14 17:45:05 +00: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
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 0634661796 Fix lockfile 2025-10-14 14:34:14 +03:00
Laurențiu Nicola cd101ef80e Bump rustc crates a little 2025-10-14 13:34:47 +03:00
Laurențiu Nicola 0430ba2085 Merge ref 'fb24b04b096a' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: fb24b04b09
Filtered ref: 8d328b994c70dfeed12717a13a915703ec939cfc
Upstream diff: https://github.com/rust-lang/rust/compare/3369e82c6bc03c5cdb66f730dba6f738b74c8e1d...fb24b04b096a980bffd80154f6aba22fd07cb3d9

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
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
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
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
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 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
Noratrieb 11977b2e65 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.
2025-10-13 22:00:45 +02:00
bors 4b94758d2b Auto merge of #147640 - matthiaskrgr:rollup-fio3d88, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#144266 (Supress swapping lhs and rhs in equality suggestion in extern macro )
 - rust-lang/rust#147471 (Assert that non-extended temporaries and `super let` bindings have scopes)
 - rust-lang/rust#147533 (Renumber return local after state transform)
 - rust-lang/rust#147566 (rewrite outlives placeholder constraints to outlives static when handling opaque types)
 - rust-lang/rust#147613 (Make logging filters work again by moving EnvFilter into its own layer)
 - rust-lang/rust#147615 (reduce calls to attr.span() in old doc attr parsing)
 - rust-lang/rust#147636 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-13 19:22:06 +00:00
Matthias Krüger 8d2b142a73 Rollup merge of #147636 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/47d656832c90f04ed2732be67fbf3cc161643c8b.

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

r? `@ghost`
2025-10-13 16:54:15 +02:00
Guillaume Gomez 66b7ed5d7a Re-enable libgccjit download in CI 2025-10-13 15:20:49 +02:00
Guillaume Gomez f80a3b0b3d Ignore failing gcc backend testsuite directly in Dockerfile 2025-10-13 15:20:49 +02:00
Guillaume Gomez 478bf434a0 Skip GCC backend-specific test if current backend is already gcc 2025-10-13 15:20:49 +02:00
Guillaume Gomez f072df1836 Ignore coverage tests for GCC 2025-10-13 15:20:49 +02:00
Guillaume Gomez 5b9ca10c75 Disable debug assertions 2025-10-13 15:20:49 +02:00
Guillaume Gomez 287e458dae Run rust tests with GCC backend 2025-10-13 15:20:48 +02:00
Guillaume Gomez 0e6ec72dbe Rollup merge of #147626 - Kobzol:lld-generalize2, r=jieyouxu
Generalize configuring LLD as the default linker in bootstrap

Reopen of https://github.com/rust-lang/rust/pull/147157, because apparently bors can't deal with it for some reason.

r? ``@ghost``
2025-10-13 11:25:25 +02:00
Guillaume Gomez 8ced599ba2 Rollup merge of #147625 - Kobzol:gcc-debug-assertions, r=GuillaumeGomez
Add a warning when running tests with the GCC backend and debug assertions are enabled

Discussed at https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Run.20more.20tests.20for.20rustc_codegen_gcc.20in.20t.E2.80.A6.20compiler-team.23891/with/543701828.

r? ``@GuillaumeGomez``
2025-10-13 11:25:24 +02:00
Ralf Jung 0c2e30bc1a avoid blanket allow(unused) 2025-10-13 10:44:31 +02:00
Ralf Jung aec62f83bd fmt 2025-10-13 10:36:03 +02:00
Ralf Jung 6645d636bb Merge ref '36e4f5d1fe1d' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 36e4f5d1fe
Filtered ref: ebb8df69f0a82b8a19e4f4b3cd32436022de4fa0
Upstream diff: https://github.com/rust-lang/rust/compare/4fd31815524baba0bf368f151f757101f432e3de...36e4f5d1fe1d63953a5bf1758ce2b64172623e2e

This merge was created using https://github.com/rust-lang/josh-sync.
2025-10-13 10:35:08 +02:00
Ralf Jung 1ef88639e7 Prepare for merging from rust-lang/rust
This updates the rust-version file to 36e4f5d1fe.
2025-10-13 10:02:03 +02:00
Jakub Beránek e755d71855 Add a warning when running tests with the GCC backend and debug assertions are enabled 2025-10-13 09:33:44 +02:00