Commit Graph

27523 Commits

Author SHA1 Message Date
Jonathan Brouwer 6b42067e18 Rollup merge of #153485 - RalfJung:float-macros-const, r=tgross35
libcore float tests: replace macro shadowing by const-compatible macro

This lets us avoid https://github.com/rust-lang/rust/issues/153478.
However this means we generate 3 function items per assertion -- or rather, 3*8, since every assertion gets duplicated 8 times (4 float types, each in a const and a non-const variant). That's a lot; is it enough to be concerned about?
coretest already takes forever to build. In a quick test, build time increased from 29.8s to 30.8s, but that may also entirely be noise.

r? @tgross35
2026-03-06 18:49:48 +01:00
Jonathan Brouwer 4e50a44530 Rollup merge of #153174 - Trivo25:fix-wasm64-sync-cfg, r=joboet
std: add wasm64 to sync::Once and thread_parking atomics cfg guards

When targeting `wasm64-unknown-unknown` with atomics enabled, `std::sync::Once` and `thread_parking` fall through to the `no_threads`/`unsupported` implementations because the cfg guards only check for `wasm32`. This causes worker threads to panic with `unreachable` at runtime. The underlying futex implementations already handle both wasm32 and wasm64 correctly, only the cfg guards were missing wasm64.

I tested this manually with a multithreaded wasm64 application ([o1js](https://github.com/o1-labs/o1js/)) compiled with `-Z build-std=panic_abort,std` and `-C target-feature=+atomics,+bulk-memory,+mutable-globals`

Related: rust-lang/rust#83879 rust-lang/rust#77839

Happy to adjust anything based on feedback
2026-03-06 18:49:47 +01:00
Ralf Jung 0fd3ac4c97 libcore float tests: replace macro shadowing by const-compatible macro 2026-03-06 12:07:25 +01:00
Florian 6a950e74b7 add wasm64 to sync::Once and thread_parking atomics cfg guard
Update library/std/src/sys/sync/once/mod.rs

Update library/std/src/sys/sync/thread_parking/mod.rs

Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2026-03-06 13:15:05 +03:00
Jonathan Brouwer 082d0cacd7 Rollup merge of #153399 - bend-n:constify-into-raw-parts, r=Amanieu
constify `Vec::{into, from}_raw_parts{_in|_alloc}`

due to Vec::drop not being const this is kinda necessary to make use of `const_heap`.
2026-03-05 19:41:57 +01:00
bors 64b72a1fa5 Auto merge of #150447 - WaffleLapkin:maybe-dangling-semantics, r=RalfJung
Implement `MaybeDangling` compiler support



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



cc @RalfJung
2026-03-05 12:21:27 +00:00
Waffle Lapkin 8aafa53504 add semantics to MaybeDangling 2026-03-05 11:53:38 +01:00
bendn 1f1a0bcbb0 constify Vec::{into, from}_raw_parts{_in|_alloc} 2026-03-05 16:01:40 +07:00
Jonathan Brouwer 2feb90a5e3 Rollup merge of #153369 - cuviper:unstable-libtest, r=Kobzol
library/test: always enable unstable features for miri

The unstable features of the `test` crate used to be default-enabled,
and manually disabled when building the beta and stable channels. Commit
dae8ea92a7 flipped that to default-disabled, only enabled for nightly
and dev channels.

However, this broke miri testing on the beta/stable channels, because it
also uses unstable features -- which should be fine to enable just for
its own sysroot build. Now the `test` build script makes that happen by
noticing the `MIRI_CALLED_FROM_SETUP` environment variable.
2026-03-05 06:31:36 +01:00
Jonathan Brouwer ed9d77216f Rollup merge of #153204 - xtqqczze:must-use-map, r=Amanieu,joboet
Add `#[must_use]` attribute to `HashMap` and `HashSet` constructors

- `new_in`
- `with_capacity_and_hasher`
- `with_capacity_and_hasher_in`
- `with_hasher`
- `with_hasher_in`

See also: https://github.com/rust-lang/rust/issues/89692
2026-03-04 19:30:37 +01:00
Jonathan Brouwer 5ff104c0b2 Rollup merge of #153196 - MikkelPaulson:const-path-separators, r=joboet
Update path separators to be available in const context

Tracking issue: rust-lang/rust#153106

This makes platform-dependent secondary path separators available in const context (ie. at compile time). The platform definitions have also been consolidated behind a common macro to prevent transcription errors, whereas previously they were defined 3-4 times per platform.

### Questions

I've manually verified that this compiles against each platform. It seems like no unit tests should be required for this change; is that correct?
2026-03-04 19:30:37 +01:00
Jonathan Brouwer 1c44dbd580 Rollup merge of #152164 - mu001999-contrib:lint/unused_features, r=JonathanBrouwer
Lint unused features

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152164)*

Fixes rust-lang/rust#44232
Fixes rust-lang/rust#151752

---

This PR records used features through query side effect, then reports unsued features finally.
2026-03-04 19:30:36 +01:00
Mikkel Paulson 098b1b98f5 make path separators available in const context
* consolidate various representations of separators in std::sys::path
  into a single macro_rules invocation per platform to save
  transcription errors
* make `std::path::is_separator()` const
* new constants `std::path::{SEPARATORS, SEPARATORS_STR}`
2026-03-04 12:03:06 -05:00
Mikkel Paulson 72de815eb2 reference local MAIN_SEPARATOR_STR
Change reference to imported MAIN_SEP_STR to local MAIN_SEPARATOR_STR,
removing an unnecessary import.
2026-03-04 10:01:43 -05:00
Matthias Krüger d70f5bdcca Rollup merge of #153341 - joboet:xous_params, r=tgross35
std: refactor Xous startup code

To facilitate rust-lang/rust#117276 I'm moving all non-path-related code out of `sys::pal::os` (see also rust-lang/rust#153130). This is particularly involved for Xous as `pal::os` also contains the `_start` entry function and the parameter block handling. This PR moves both out into the main `sys::pal` module and also simplifies the parameter block initialisation code slightly.

CC @xobs
2026-03-04 09:49:01 +01:00
Stuart Cook 49966fedd6 Rollup merge of #153295 - biscuitrescue:fix-panicking-docs, r=tgross35
update panicking() docs for panic=abort

fixes rust-lang/rust#151458

The documentation for `std::thread::panicking()` has not been changed since v1.0, even though panic hooks were added in v1.10.
Current documentation is misleading for `panic=abort`

`panicking()` can return `true` in 2 different cases:
1. Thread unwinds due to panic
2. Panic hook is executing with `panic=abort`

r? @SpriteOvO
2026-03-04 11:54:11 +11:00
Stuart Cook b5f3ca196a Rollup merge of #153272 - wmmc88:add-path-absolute-method, r=tgross35
Add `Path::absolute` method as alias for `std::path::absolute`

`Path::canonicalize()` is an alias for `fs::canonicalize()`, but there's no equivalent `Path::absolute()` for `path::absolute()`. This adds one.

Discussed in https://github.com/rust-lang/rust/issues/92750#issuecomment-2867636150, Chris [said](https://github.com/rust-lang/rust/issues/92750#issuecomment-2904002333) a PR would be welcome.

Tracking issue: rust-lang/rust#153328
2026-03-04 11:54:10 +11:00
Stuart Cook 54bb7b8212 Rollup merge of #153358 - eggyal:duration-flop-boundary-tests, r=tgross35
Boundary tests for various Duration-float operations

As requested in https://github.com/rust-lang/rust/pull/150933#discussion_r2875490030

r? tgross35
2026-03-04 11:54:09 +11:00
mu001999 7ffaa41662 Remove unused features in library tests 2026-03-04 08:06:44 +08:00
Josh Stone 30d7ed4c47 library/test: always enable unstable features for miri
The unstable features of the `test` crate used to be default-enabled,
and manually disabled when building the beta and stable channels. Commit
dae8ea92a7 flipped that to default-disabled, only enabled for nightly
and dev channels.

However, this broke miri testing on the beta/stable channels, because it
also uses unstable features -- which should be fine to enable just for
its own sysroot build. Now the `test` build script makes that happen by
noticing the `MIRI_CALLED_FROM_SETUP` environment variable.
2026-03-03 13:42:00 -08:00
biscuitrescue 014344b0c3 update panicking() docs for panic=abort
rephrasing and grammar
2026-03-04 01:38:06 +05:30
Alan Egerton d96ec37d7e Boundary tests for various Duration-float operations 2026-03-03 19:01:53 +00:00
Melvin Wang bde5b584a6 Add Path::absolute method as alias for path::absolute
Add a convenience method Path::absolute() that delegates to the
existing free function std::path::absolute(), mirroring the pattern of
Path::canonicalize() delegating to fs::canonicalize().

Tracking issue: https://github.com/rust-lang/rust/issues/153328
2026-03-03 10:40:19 -08:00
Jonathan Brouwer f4810cb4a3 Rollup merge of #152911 - nxsaken:stable_control_flow_ok, r=dtolnay
Stabilize `control_flow_ok`

Feature: `control_flow_ok`
Tracking issue: rust-lang/rust#140266

r? @dtolnay
2026-03-03 19:11:49 +01:00
Jonathan Brouwer f3f04699c1 Rollup merge of #153319 - DanielEScherzer:ie-dots, r=jhpratt
Comments and docs: add missing periods to "ie."

"i.e." is short for the Latin "id est" and thus both letters should be followed by periods.
2026-03-03 13:08:45 +01:00
Jonathan Brouwer 8b1ebb3e3a Rollup merge of #153336 - folkertdev:stdarch-sync-2026-03-03, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to https://github.com/rust-lang/stdarch/commit/d4a226dc06f5f3a89607747038a994e956ae724b.

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

r? @ghost
2026-03-03 13:08:42 +01:00
joboet a598ccfc38 std: refactor Xous startup code 2026-03-03 12:26:21 +01:00
Jonathan Brouwer 8845cc0c67 Rollup merge of #153297 - Gelbpunkt:hermitcore-hermit, r=joboet
Update the name of the Hermit operating system

The HermitCore name was dropped a while ago, the project is now simply called "Hermit". See for example [the website](https://hermit-os.org/).

cc @stlankes @mkroening
2026-03-03 07:14:17 +01:00
Jonathan Brouwer c4384629c0 Rollup merge of #153265 - asder8215:intersperse_changes, r=jhpratt
Clarified doc comments + added tests confirming current behavior for intersperse/intersperse_with

This PR builds on top of rust-lang/rust#152855. I just added clarifying comments to `intersperse`/`intersperse_with` about its guarantees for fused iterators (and how behavior for non-fused iterators are subject to change). I also added in tests for non-fused iterators demonstrating its current behavior; fused iterators are already tested for in existing tests for `intersperse`/`intersperse_with`.
2026-03-03 07:14:12 +01:00
Daniel Scherzer 158ac1a10b Comments and docs: add missing periods to "ie."
"i.e." is short for the Latin "id est" and thus both letters should be followed
by periods.
2026-03-02 18:11:13 -08:00
Mahdi Ali-Raihan c8d343e5c8 Added guarantee and non-guarantee comments + tests for intersperse/intersperse_with regarding fused/non-fused iterators 2026-03-02 19:44:15 -05:00
Jonathan Brouwer b2dfd76fff Rollup merge of #153293 - Gelbpunkt:skip-process-tests-hermit, r=joboet
library: std: process: skip tests on Hermit

Hermit does not yet support spawning processes.
2026-03-02 20:10:37 +01:00
Jonathan Brouwer 671dc27f69 Rollup merge of #153273 - DanielEScherzer:patch-2, r=joboet
vec/mod.rs: add missing period in "ie." in docs

"i.e." is short for the Latin "id est" and thus both letters should be followed by periods.
2026-03-02 20:10:36 +01:00
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
Aelin Reidel cc64a37912 library: std: hermit: Update name of the Hermit operating system
The HermitCore name was dropped a while ago, the project is now simply
called "Hermit".
2026-03-02 17:26:44 +01:00
Aelin Reidel f1a4d0cd37 library: std: process: skip tests on Hermit
Hermit does not yet support spawning processes.
2026-03-02 15:50:41 +01:00
Waffle Lapkin 7cefcb41ff add an adt flag for MaybeDangling 2026-03-02 14:42:53 +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
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
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
Daniel Scherzer f538526724 vec/mod.rs: add missing period in "ie." in docs
"i.e." is short for the Latin "id est" and thus both letters should be followed
by periods.
2026-03-01 21:47:52 -08:00
joboet 95e571ded1 update references to Atomic in diagnostics
... and remove some unused diagnostic items.
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
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 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
mu001999 17ba37fe89 Recover feature lang_items for emscripten 2026-03-01 18:57:52 +08:00
Scott McMurray 2c6ec51564 Update __rust_[rd]ealloc to take NonNull<u8> instead of *mut u8
Passing null to it is [already UB](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=8dcd25a549c11de72adc94a668277779) anyway.
2026-02-28 23:49:31 -08:00
Lewis McClelland 04f6a493e4 Re-export unsupported Dir from fs impl on vexos 2026-03-01 01:19:04 -05:00
Peter Jaszkowiak bc4ceaddcd stabilize new RangeToInclusive type
stabilizes `core::range::RangeToInclusive`
add missing trait impls for new RangeToInclusive
add missing trait impls for new RangeFrom
2026-02-28 21:44:18 -07:00