9672 Commits

Author SHA1 Message Date
Matthias Krüger
5591d7e134
Rollup merge of #148285 - nxsaken:const_control_flow_1, r=Mark-Simulacrum
Constify `ControlFlow` methods with unstable bounds

Feature: `const_control_flow`
Tracking issue: rust-lang/rust#148739

This PR constifies the methods on `ControlFlow` with a dependency on rust-lang/rust#143874.
2025-11-09 20:59:53 +01:00
Matthias Krüger
5598d535da
Rollup merge of #148248 - nxsaken:const_control_flow, r=Mark-Simulacrum
Constify `ControlFlow` methods without unstable bounds

Feature: `min_const_control_flow`
Tracking issue: rust-lang/rust#148738

This PR constifies some of the methods on `ControlFlow`.
2025-11-09 20:59:52 +01:00
Matthias Krüger
e5a69bb215
Rollup merge of #148683 - fmease:rm-const_trait-attr, r=fee1-dead
Remove `#[const_trait]`

Remove `#[const_trait]` since we now have `const trait`. Update all structured diagnostics that still suggested the attribute.

r? ```@rust-lang/project-const-traits```
2025-11-09 17:37:05 +01:00
nxsaken
d05133f3a4 Update feature name, add tracking issue number 2025-11-09 13:36:35 +04:00
nxsaken
3175799208 Add tracking issue number 2025-11-09 13:33:47 +04:00
nxsaken
852bd86d17 Constify ControlFlow methods (unstable bounds) 2025-11-09 13:30:59 +04:00
bors
20f1c045c4 Auto merge of #148721 - Zalathar:rollup-398va3y, r=Zalathar
Rollup of 22 pull requests

Successful merges:

 - rust-lang/rust#128666 (Add `overflow_checks` intrinsic)
 - rust-lang/rust#146305 (Add correct suggestion for multi-references for self type in method)
 - rust-lang/rust#147179 ([DebugInfo] Fix container types failing to find template args)
 - rust-lang/rust#147743 (Show packed field alignment in mir_transform_unaligned_packed_ref)
 - rust-lang/rust#148079 (Rename `downcast_[ref|mut]_unchecked` -> `downcast_unchecked_[ref|mut]`)
 - rust-lang/rust#148084 (Optimize path components iteration on platforms that don't have prefixes)
 - rust-lang/rust#148126 (Fix rust stdlib build failing for VxWorks)
 - rust-lang/rust#148204 (Modify contributor email entries in .mailmap)
 - rust-lang/rust#148279 (rustc_builtin_macros: rename bench parameter to avoid collisions with user-defined function names)
 - rust-lang/rust#148333 (constify result unwrap unchecked)
 - rust-lang/rust#148539 (Add Allocator proxy impls for Box, Rc, and Arc)
 - rust-lang/rust#148601 (`invalid_atomic_ordering`: also lint `update` & `try_update`)
 - rust-lang/rust#148612 (Add note for identifier with attempted hygiene violation)
 - rust-lang/rust#148613 (Switch hexagon targets to rust-lld)
 - rust-lang/rust#148619 (Enable std locking functions on AIX)
 - rust-lang/rust#148644 ([bootstrap] Make `--open` option work with `doc src/tools/error_index_generator`)
 - rust-lang/rust#148649 (don't completely reset `HeadUsages`)
 - rust-lang/rust#148673 (Remove a remnant of `dyn*` from the parser)
 - rust-lang/rust#148675 (Remove eslint-js from npm dependencies)
 - rust-lang/rust#148680 (Recover `[T: N]` as `[T; N]`)
 - rust-lang/rust#148688 (Remove unused argument `features` from `eval_config_entry`)
 - rust-lang/rust#148711 (Use the current lint note id when parsing `cfg!()`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-09 08:27:35 +00:00
Stuart Cook
020dd317db
Rollup merge of #148333 - bend-n:const_result_unwrap_unchecked, r=mark-simulacrum
constify result unwrap unchecked

constifies unwrap unchecked on result
will make tracking issue if good
2025-11-09 13:22:29 +11:00
Stuart Cook
f424eb908e
Rollup merge of #148079 - taj-p:master, r=Mark-Simulacrum
Rename `downcast_[ref|mut]_unchecked` -> `downcast_unchecked_[ref|mut]`

## Intent

Renames `downcast_[ref|mut]_unchecked` to `downcast_unchecked_[ref|mut]` because we want to emphasise that it is the downcast that is unsafe, not the aliasing per:

https://github.com/rust-lang/rust/issues/90850#issuecomment-2749035832

## Tracking Issue: https://github.com/rust-lang/rust/issues/90850#issuecomment-3437027607

cc `@marc0246`
2025-11-09 13:22:26 +11:00
Stuart Cook
d3475140ee
Rollup merge of #128666 - pitaj:intrinsic-overflow_checks, r=BoxyUwU
Add `overflow_checks` intrinsic

This adds an intrinsic which allows code in a pre-built library to inherit the overflow checks option from a crate depending on it. This enables code in the standard library to explicitly change behavior based on whether `overflow_checks` are enabled, regardless of the setting used when standard library was compiled.

This is very similar to the `ub_checks` intrinsic, and refactors the two to use a common mechanism.

The primary use case for this is to allow the new `RangeFrom` iterator to yield the maximum element before overflowing, as requested [here](https://github.com/rust-lang/rust/issues/125687#issuecomment-2151118208). This PR includes a working `IterRangeFrom` implementation based on this new intrinsic that exhibits the desired behavior.

[Prior discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Ability.20to.20select.20code.20based.20on.20.60overflow_checks.60.3F)
2025-11-09 13:22:23 +11:00
bendn
edd7d8a2fd
constify result unwrap unchecked 2025-11-09 04:17:15 +07:00
Peter Jaszkowiak
cc8b95cc54 add overflow_checks intrinsic 2025-11-08 10:57:35 -07:00
Matthias Krüger
9ccff4ae27
Rollup merge of #147686 - vrtgs:non-zero-isolate, r=joboet
update isolate_highest_one for NonZero<T>

## Rationale
Let `x = self` and
`m = (((1 as $Int) << (<$Int>::BITS - 1)).wrapping_shr(self.leading_zeros()))`
Then the previous code computed `NonZero::new_unchecked(x & m)`.
Since `m` has exactly one bit set (the most significant 1-bit of `x`), `(x & m) == m`.
Therefore, the masking step was redundant.

The shift is safe and does not need wrapping because:
* `self.leading_zeros() < $Int::BITS` because `self` is non-zero.
* The result of `unchecked_shr` is non-zero, satisfying the `NonZero` invariant. if wrapping happens we would be violating `NonZero` invariants.

why this micro optimization?
the old code was suboptimal it duplicated `$Int`’s isolate_highest_one logic instead of delegating to it. Since the type already wraps `$Int`, either delegation should be used for clarity or, if keeping a custom implementation, it should be optimized as above.
2025-11-08 15:42:22 +01:00
Matthias Krüger
da2e3aabca
Rollup merge of #147540 - bjoernager:slice-as-array, r=Amanieu
Stabilise `as_array` in `[_]` and `*const [_]`; stabilise `as_mut_array` in `[_]` and `*mut [_]`.

Tracking issue: rust-lang/rust#133508

Closes: rust-lang/rust#133508

This PR stabilises the `as_array` and `as_mut_array` associated functions from the `core_slice_as_array` feature gate:

```rust
// core::slice

impl<T> [T] {
    pub const fn as_array<const N: usize>(&self) -> Option<&[T; N]>;

    pub const fn as_mut_array<const N: usize>(&mut self) -> Option<&mut [T; N]>;
}

// core::ptr

impl<T> *const [T] {
    pub const fn as_array<const N: usize>(self) -> Option<*const [T; N]>;
}

impl<T> *mut [T] {
    pub const fn as_mut_array<const N: usize>(self) -> Option<*mut [T; N]>;
}
```

It also updates the feature gates and tracking issues for all items associated with the previous `slice_as_array` tracking issue (including these four that are being stabilised).

~~FCP missing.~~
2025-11-08 15:42:22 +01:00
bors
bbb6f68e28 Auto merge of #147803 - jsgf:move-copy-codegen, r=madsmtm,saethlin
Add -Zannotate-moves for profiler visibility of move/copy operations (codegen)

**Note:** this is an alternative implementation of https://github.com/rust-lang/rust/pull/147206; rather than being a MIR transform, it adds the annotations closer to codegen. It's functionally the same but the implementation is lower impact and it could be more correct.

---

This implements a new unstable compiler flag `-Zannotate-moves` that makes move and copy operations visible in profilers by creating synthetic debug information. This is achieved with zero runtime cost by manipulating debug info scopes to make moves/copies appear as calls to `compiler_move<T, SIZE>` and `compiler_copy<T, SIZE>` marker functions in profiling tools.

This allows developers to identify expensive move/copy operations in their code using standard profiling tools, without requiring specialized tooling or runtime instrumentation.

The implementation works at codegen time. When processing MIR operands (`Operand::Move` and `Operand::Copy`), the codegen creates an `OperandRef` with an optional `move_annotation` field containing an `Instance` of the appropriate profiling marker function. When storing the operand, `store_with_annotation()` wraps the store operation in a synthetic debug scope that makes it appear inlined from the marker.

Two marker functions (`compiler_move` and `compiler_copy`) are defined in `library/core/src/profiling.rs`. These are never actually called - they exist solely as debug info anchors.

Operations are only annotated if:
   - We're generating debug info and the feature is enabled.
   - Meets the size threshold (default: 65 bytes, configurable via `-Zannotate-moves=SIZE`), and is non-zero
   - Has a memory representation

This has a very small size impact on object file size. With the default limit it's well under 0.1%, and even with a very small limit of 8 bytes it's still ~1.5%. This could be enabled by default.
2025-11-08 07:57:14 +00:00
León Orell Valerian Liehr
8aedbf12f6
Replace #[const_trait] with const in libcore 2025-11-08 06:40:27 +01:00
Vrtgs
057127cfee update isolate_highest_one for NonZero<T> 2025-11-08 00:22:36 +03:00
Gabriel Bjørnager Jensen
fa8e8649ad
Stabilise 'as_array' in '[_]' and '*const [_]'; Stabilise 'as_mut_array' in '[_]' and '*mut [_]'; Update feature gate and tracking issue for 'alloc_slice_into_array' items; 2025-11-07 15:14:41 +01:00
Jacob Pratt
c932d7c45f
Rollup merge of #148609 - AMDmi3:rsplit_once_example, r=chenyukang
Sync str::rsplit_once example with str::split_once

This adds `"cfg=".rsplit_once('=')` case to `rsplit_once` example, bringing it in sync with example for `split_once`. For consistency and to make life easier for ones who want to ensure bahaviour of this specific edge case.
2025-11-07 00:21:24 -05:00
Jacob Pratt
9d001902ae
Rollup merge of #148578 - WaffleLapkin:equal-alignment-atomic-from-mut-slice, r=m-ou-se
core docs: add notes about availability of `Atomic*::from_mut_slice`

See https://github.com/rust-lang/rust/issues/76314#issuecomment-3496758620

r? libs-api
2025-11-07 00:21:23 -05:00
Jacob Pratt
3d765e3788
Rollup merge of #148520 - sorairolake:update-lowest-highest-one-doctests, r=tgross35
style: Use binary literals instead of hex literals in doctests for `highest_one` and `lowest_one`

For example, I think it's easier to understand that the index of the highest bit set to one in `16` is `4` as `0b10000` than as `0x10`.

```rust
assert_eq!(0x10_u64.highest_one(), Some(4));
```

Instead of:

```rust
assert_eq!(0b10000_u64.highest_one(), Some(4));
```

rust-lang/rust#145203
2025-11-07 00:21:19 -05:00
Jeremy Fitzhardinge
5f29f11a4d Add -Zannotate-moves for profiler visibility of move/copy operations
This implements a new unstable compiler flag `-Zannotate-moves` that makes
move and copy operations visible in profilers by creating synthetic debug
information. This is achieved with zero runtime cost by manipulating debug
info scopes to make moves/copies appear as calls to `compiler_move<T, SIZE>`
and `compiler_copy<T, SIZE>` marker functions in profiling tools.

This allows developers to identify expensive move/copy operations in their
code using standard profiling tools, without requiring specialized tooling
or runtime instrumentation.

The implementation works at codegen time. When processing MIR operands
(`Operand::Move` and `Operand::Copy`), the codegen creates an `OperandRef`
with an optional `move_annotation` field containing an `Instance` of the
appropriate profiling marker function. When storing the operand,
`store_with_annotation()` wraps the store operation in a synthetic debug
scope that makes it appear inlined from the marker.

Two marker functions (`compiler_move` and `compiler_copy`) are defined
in `library/core/src/profiling.rs`. These are never actually called -
they exist solely as debug info anchors.

Operations are only annotated if the type:
   - Meets the size threshold (default: 65 bytes, configurable via
     `-Zannotate-moves=SIZE`)
   - Has a non-scalar backend representation (scalars use registers,
     not memcpy)

This has a very small size impact on object file size. With the default
limit it's well under 0.1%, and even with a very small limit of 8 bytes
it's still ~1.5%. This could be enabled by default.
2025-11-06 15:39:45 -08:00
Dmitry Marakasov
b975c570fa Sync str::rsplit_once example with str::split_once 2025-11-07 01:01:54 +03:00
Waffle Lapkin
893f0d2cff
core docs: add notes about availability of Atomic*::from_mut_slice 2025-11-06 15:23:11 +01:00
Matthias Krüger
f7f128fd48
Rollup merge of #146861 - antonilol:vec_deque_extend_front, r=joboet
add extend_front to VecDeque with specialization like extend

ACP: https://github.com/rust-lang/libs-team/issues/658
Tracking issue: rust-lang/rust#146975

_Text below was written before opening the ACP_

Feature was requested in rust-lang/rust#69939, I recently also needed it so decided to implement it as my first contribution to the Rust standard library. I plan on doing more but wanted to start with a small change.

Some questions I had (both on implementation and design) with answers:
- Q: `extend` allows iterators that yield `&T` where `T` is `Clone`, should extend_front do too?
  A: No, users can use [`copied`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.copied) and/or [`cloned`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.cloned).
- Q: Does this need a whole new trait like Extend or only a method on `VecDeque`?
  A: No, see ACP.
- Q: How do I deal with all the code duplication? Most code is similar to that of `extend`, maybe there is a nice way to factor out the code around `push_unchecked`/`push_front_unchecked`.
  Will come back to this later.
- Q: Why are certain things behind feature gates, `cfg(not(test))` like `vec::IntoIter` here and `cfg(not(no_global_oom_handling))` like `Vec::extend_from_within`? (I am also looking at implementing `VecDeque::extend_from_within`)
  A: See https://github.com/rust-lang/rust/pull/146861#pullrequestreview-3250163369
- Q: Should `extend_front` act like repeated pushes to the front of the queue? This reverses the order of the elements. Doing it different might incur an extra move if the iterator length is not known up front (where do you start placing elements in the buffer?).
  A: `extend_front` acts like repeated pushes, `prepend` preserves the element order, see ACP or tracking issue.
2025-11-06 12:29:57 +01:00
Shun Sakai
d956fa10ce style: Update doctests for highest_one and lowest_one
Use binary literals instead of hex literals.
2025-11-06 20:07:47 +09:00
Stuart Cook
c33d51b9d8
Rollup merge of #147355 - sayantn:masked-loads, r=RalfJung,bjorn3
Add alignment parameter to `simd_masked_{load,store}`

This PR adds an alignment parameter in `simd_masked_load` and `simd_masked_store`, in the form of a const-generic enum `core::intrinsics::simd::SimdAlign`. This represents the alignment of the `ptr` argument in these intrinsics as follows

 - `SimdAlign::Unaligned` - `ptr` is unaligned/1-byte aligned
 - `SimdAlign::Element` - `ptr` is aligned to the element type of the SIMD vector (default behavior in the old signature)
 - `SimdAlign::Vector` - `ptr` is aligned to the SIMD vector type

The main motive for this is stdarch - most vector loads are either fully aligned (to the vector size) or unaligned (byte-aligned), so the previous signature doesn't cut it.

Now, stdarch will mostly use `SimdAlign::Unaligned` and `SimdAlign::Vector`, whereas portable-simd will use `SimdAlign::Element`.

 - [x] `cg_llvm`
 - [x] `cg_clif`
 - [x] `miri`/`const_eval`

## Alternatives

Using a const-generic/"const" `u32` parameter as alignment (and we error during codegen if this argument is not a power of two). This, although more flexible than this, has a few drawbacks

 - If we use an const-generic argument, then portable-simd somehow needs to pass `align_of::<T>()` as the alignment, which isn't possible without GCE
 - "const" function parameters are just an ugly hack, and a pain to deal with in non-LLVM backends

We can remedy the problem with the const-generic `u32` parameter by adding a special rule for the element alignment case (e.g. `0` can mean "use the alignment of the element type), but I feel like this is not as expressive as the enum approach, although I am open to suggestions

cc `@workingjubilee` `@RalfJung` `@BoxyUwU`
2025-11-05 10:59:18 +11:00
Folkert de Vries
1866b3a8cf
assert that #[rustc_pass_indirectly_in_non_rustic_abis] is respected 2025-11-04 09:56:21 +01:00
Stuart Cook
149eb1a36d
Rollup merge of #146057 - Ddystopia:waker-fn, r=dtolnay
feat: add `from_fn_ptr` to `Waker` and `LocalWaker`

Closes: https://github.com/rust-lang/rust/issues/146055
2025-11-04 13:44:49 +11:00
Stuart Cook
22e4575672
Rollup merge of #145915 - coolreader18:stabilize-fmt_from_fn, r=dtolnay
Stabilize `fmt::from_fn`

Resolves rust-lang/rust#146705, pending its FCP.

As discussed in that tracking issue and rust-lang/rust#117729, this splits `fmt::from_fn` out from the `debug_closure_helpers` feature.
2025-11-04 13:44:47 +11:00
David Tolnay
75835fb825
Repoint Waker::from_fn_ptr from feature request issue to tracking issue 2025-11-03 17:17:51 -08:00
sayantn
75de619159
Add alignment parameter to simd_masked_{load,store} 2025-11-04 02:30:59 +05:30
Jieyou Xu
4aeb297064
Revert "unicode_data refactors RUST-147622"
This PR reverts RUST-147622 for several reasons:

1. The RUST-147622 PR would format the generated core library code using
   an arbitrary `rustfmt` picked up from `PATH`, which will cause
   hard-to-debug failures when the `rustfmt` used to format the
   generated unicode data code versus the `rustfmt` used to format the
   in-tree library code.
2. Previously, the `unicode-table-generator` tests were not run under CI
   as part of `coretests`, and since for `x86_64-gnu-aux` job we run
   library `coretests` with `miri`, the generated tests unfortunately
   caused an unacceptably large Merge CI time regression from ~2 hours
   to ~3.5 hours, making it the slowest Merge CI job (and thus the new
   bottleneck).
3. This PR also has an unintended effect of causing a diagnostic
   regression (RUST-148387), though that's mostly an edge case not
   properly handled by `rustc` diagnostics.

Given that these are three distinct causes with non-trivial fixes, I'm
proposing to revert this PR to return us to baseline. This is not
prejudice against relanding the changes with these issues addressed, but
to alleviate time pressure to address these non-trivial issues.
2025-11-03 19:53:11 +08:00
Antoni Spaanderman
5b96677adb
add specialization for extend_front and prepend with copied slice iterator 2025-11-03 12:35:30 +01:00
Matthias Krüger
5f4a90e7a7
Rollup merge of #148402 - folkertdev:stdarch-sync-nov-2025, r=sayantn
stdarch subtree update

Subtree update of `stdarch` to b5c164540c.

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

r? `@sayantn`

---

Only the last 2 commits contain manual changes to some incorrect miri tests. The remainder is mechanical, and just synchronizes changes from stdarch.
2025-11-03 06:54:36 +01:00
Matthias Krüger
4104f80c20
Rollup merge of #148394 - jieyouxu:remark-typeid-no-layout-guarantees, r=scottmcm
Make explicit that `TypeId`'s layout and size are unstable

Or worded differently, explicitly remark non-stable-guarantee of `TypeId` layout and size.

This PR makes no *additional* guarantees or non-guarantees, it only emphasizes that `TypeId`'s size and layout are unstable like any other `#[repr(Rust)]` types.

This was discussed during [#t-compiler/meetings > &#91;weekly&#93; 2025-10-30 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202025-10-30/near/547949347), where the compiler team discussed a request https://github.com/rust-lang/rust/pull/148265 to have the standard library (and language) commit to `TypeId` guaranteeing a size upper bound of 16 bytes. In the meeting, the consensus was:

- We were sympathetic to the use case discussed in the request PR, however we feel like this stability guarantee is premature, given that there are unresolved questions surrounding the intended purpose of `TypeId`, and concerns surrounding its collision-resistance properties https://github.com/rust-lang/rust/issues/10389 and https://github.com/rust-lang/rust/issues/129014. We would prefer not making any of such guarantee until the collision-resistance concerns are resolved.
- Committing to a stability guarantee on the size upper bound now would close the door to making `TypeId` larger (even if unlikely for perf reasons).

Given that we have previously broken people who asserted the size of `TypeId` is 8 bytes, it was also discussed in the meeting that we should *explicitly* note that the size and layout of `TypeId` is not a stable guarantee, and is subject to changes between Rust releases, and thus cannot be relied upon -- if breakage in people's code is due to that assumption, it will be considered a won't-fix.

- So even if `#[repr(Rust)]` types have unstable size and layout, this PR makes it explicit for `TypeId` since this type can feel "special" and users can be lead into thinking its size and layout is something they can rely upon.

r? `@scottmcm` (or libs/libs-api/lang)
2025-11-03 06:54:35 +01:00
Matthias Krüger
01ab3e369b
Rollup merge of #146260 - Qelxiros:146179-sliceindex-wrappers, r=jhpratt
add SliceIndex wrapper types Last and Clamp<Idx>

Tracking issue: rust-lang/rust#146179
2025-11-03 06:54:35 +01:00
bors
c5dabe8cf7 Auto merge of #148412 - matthiaskrgr:rollup-59a302x, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#146573 (Constify Range functions)
 - rust-lang/rust#146699 (Add `is_ascii` function optimized for LoongArch64 for [u8])
 - rust-lang/rust#148026 (std: don't leak the thread closure if destroying the thread attributes fails)
 - rust-lang/rust#148135 (Ignore unix socket related tests for VxWorks)
 - rust-lang/rust#148211 (clippy fixes and code simplification)
 - rust-lang/rust#148395 (Generalize branch references)
 - rust-lang/rust#148405 (Fix suggestion when there were a colon already in generics)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-02 23:12:25 +00:00
Matthias Krüger
7ed1f93e3a
Rollup merge of #148395 - Kobzol:generalize-branch-references, r=marcoieni
Generalize branch references

It should be safe to merge this before the rename, and I'd like to do that, so we can test if beta/stable PRs work.

r? ``@marcoieni``
2025-11-02 20:21:03 +01:00
Matthias Krüger
4228b53618
Rollup merge of #146699 - heiher:is-ascii-lsx, r=Mark-Simulacrum
Add `is_ascii` function optimized for LoongArch64 for [u8]

Similar to x86_64, on LoongArch64 we use the `vmskltz.b` instruction to test the high bit in a lane.

For longer input cases, the performance improvement is significant. For unaligned cases close to 32 bytes in length, there's some regression, but it seems acceptable.

| core benches (MB/s)                                    | Before | After  | %       |
|--------------------------------------------------------|--------|--------|---------|
| ascii::is_ascii::short::case00_libcore                 | 1000   | 1000   | 0.00    |
| ascii::is_ascii::medium::case00_libcore                | 8000   | 8000   | 0.00    |
| ascii::is_ascii::long::case00_libcore                  | 183947 | 436875 | +137.50 |
| ascii::is_ascii::unaligned_head_medium::case00_libcore | 7750   | 2818   | -63.64  |
| ascii::is_ascii::unaligned_head_long::case00_libcore   | 317681 | 436812 | +37.50  |
| ascii::is_ascii::unaligned_tail_medium::case00_libcore | 7750   | 3444   | -55.56  |
| ascii::is_ascii::unaligned_tail_long::case00_libcore   | 155311 | 436812 | +181.25 |
| ascii::is_ascii::unaligned_both_medium::case00_libcore | 7500   | 3333   | -55.56  |
| ascii::is_ascii::unaligned_both_long::case00_libcore   | 174700 | 436750 | +150.00 |
2025-11-02 20:21:01 +01:00
Matthias Krüger
6621bbcfd1
Rollup merge of #146573 - Randl:const-range, r=Mark-Simulacrum
Constify Range functions

Constify various `Range` traits, functions, and implementations
2025-11-02 20:21:00 +01:00
Folkert de Vries
fd76e6dd54
remove unsafe from _mm_pause uses 2025-11-02 17:29:08 +01:00
Matthias Krüger
f985303177
Rollup merge of #147947 - yotamofek:pr/lib/strip-circumfix, r=joboet
Implement `strip_circumfix` lib feature

Tracking issue: rust-lang/rust#147946
2025-11-02 15:56:49 +01:00
Jakub Beránek
d3473f0741
Generalize branch references to HEAD 2025-11-02 11:15:55 +01:00
Jieyou Xu
625b6f5844
TypeId: make unstable layout/size explicit
Or worded differently, explicitly remark non-stable-guarantee of
`TypeId` layout and size.
2025-11-02 17:29:24 +08:00
bors
73e6c9ebd9 Auto merge of #147784 - nxsaken:div_exact_return_option, r=dtolnay
Return `Option` from `exact_div` and inherit overflow checks

According to https://github.com/rust-lang/rust/issues/139911#issuecomment-3404056127, `exact_div` should return `Option::None` if `self % rhs != 0`, panic if `rhs == 0`, and handle overflow conditionally (panic in debug, wrap in release).

rust-lang/rust#147771 should rename `exact_div` to `div_exact`.
2025-11-02 08:05:11 +00:00
Matthias Krüger
3605e1467a
Rollup merge of #148319 - sorairolake:fix-carrying_mul_add-docs, r=Amanieu
docs: Fix argument names for `carrying_mul_add`

Fixes rust-lang/rust#148312
2025-10-31 18:41:51 +01:00
Matthias Krüger
75fbbd32f0
Rollup merge of #147622 - Kmeakin:km/unicode-data/refactors, r=joboet
`unicode_data` refactors

Minor refactors to `unicode_data` that occured to me while trying to reduce the size of the tables. Splitting into a separate PR. NFC
2025-10-31 18:41:48 +01:00
Karl Meakin
0e6131c9aa refactor: make unicode_data tests normal tests
Instead of generating a standalone executable to test `unicode_data`,
generate normal tests in `coretests`. This ensures tests are always
generated, and will be run as part of the normal testsuite.

Also change the generated tests to loop over lookup tables, rather than
generating a separate `assert_eq!()` statement for every codepoint. The
old approach produced a massive (20,000 lines plus) file which took
minutes to compile!
2025-10-31 14:12:17 +00:00
Karl Meakin
9a80731094 refactor: make string formatting more readable
To make the final output code easier to see:
* Get rid of the unnecessary line-noise of `.unwrap()`ing calls to
  `write!()` by moving the `.unwrap()` into a macro.
* Join consecutive `write!()` calls using a single multiline format
  string.
* Replace `.push()` and `.push_str(format!())` with `write!()`.
* If after doing all of the above, there is only a single `write!()`
  call in the function, just construct the string directly with
  `format!()`.
2025-10-31 14:12:14 +00:00