Commit Graph

9393 Commits

Author SHA1 Message Date
Ralf Jung
c2e16cbcb4 UnsafePinned::raw_get: sync signature with get 2025-08-19 08:25:09 +02:00
Stuart Cook
f44f963b03 Rollup merge of #145563 - Kobzol:remove-from-from-prelude, r=petrochenkov
Remove the `From` derive macro from prelude

The new `#[derive(From)]` functionality (implemented in https://github.com/rust-lang/rust/pull/144922) caused name resolution ambiguity issues (https://github.com/rust-lang/rust/issues/145524). The reproducer looks e.g. like this:

```rust
mod foo {
    pub use derive_more::From;
}

use foo::*;

#[derive(From)] // ERROR: `From` is ambiguous
struct S(u32);
```

It's pretty unfortunate that it works like this, but I guess that there's not much to be done here, and we'll have to wait for the next edition to put the `From` macro into the prelude. That will probably require https://github.com/rust-lang/rust/pull/139493 to land.

I created a new module in core (and re-exported it in std) called `from`, where I re-exported the `From` macro. I *think* that since this is a new module, it should not have the same backwards incompatibility issue.

Happy to hear suggestions about the naming - maybe it would make sense as `core::macros::from::From`? But we already had a precedent in the `core::assert_matches` module, so I just followed suit.

Fixes: https://github.com/rust-lang/rust/issues/145524

r? ``@petrochenkov``
2025-08-19 14:18:27 +10:00
Stuart Cook
0671b2fe49 Rollup merge of #142871 - chenyukang:yukang-fix-doc-for-transpose, r=ibraheemdev
Trivial improve doc for transpose

When I saw old doc, I felt a little confused.
Seems it would be clearer this way.
2025-08-19 14:18:17 +10:00
Stuart Cook
027c7a5d85 Rollup merge of #141744 - GrigorenkoPV:ip_from, r=Amanieu
Stabilize `ip_from`

Tracking issue: rust-lang/rust#131360

Stabilizes and const-stabilizes the following APIs:
```rust
// core::net
impl Ipv4Addr {
    pub const fn from_octets(octets: [u8; 4]) -> Ipv4Addr;
}
impl Ipv6Addr {
    pub const fn from_octets(octets: [u8; 16]) -> Ipv6Addr;
    pub const fn from_segments(segments: [u16; 8]) -> Ipv6Addr;
}
```

Closes rust-lang/rust#131360

```@rustbot``` label +needs-fcp
2025-08-19 14:18:15 +10:00
Jakub Beránek
a6a760edaf Remove the From derive macro from prelude
To avoid backwards compatibility problems.
2025-08-18 13:12:19 +02:00
Alexandre Courbot
73d3d28bed Implement feature int_lowest_highest_one for integer and NonZero types
Implement the accepted ACP for methods that find the index of the least
significant (lowest) and most significant (highest) set bit in an
integer for signed, unsigned, and NonZero types.

Also add unit tests for all these types.
2025-08-18 18:59:44 +09:00
bors
425a9c0a0e Auto merge of #145284 - nnethercote:type_name-print-regions, r=lcnr
Print regions in `type_name`.

Currently they are skipped, which is a bit weird, and it sometimes causes malformed output like `Foo<>` and `dyn Bar<, A = u32>`.

Most regions are erased by the time `type_name` does its work. So all regions are now printed as `'_` in non-optional places. Not perfect, but better than the status quo.

`c_name` is updated to trim lifetimes from MIR pass names, so that the `PASS_NAMES` sanity check still works. It is also renamed as `simplify_pass_type_name` and made non-const, because it doesn't need to be const and the non-const implementation is much shorter.

The commit also renames `should_print_region` as `should_print_optional_region`, which makes it clearer that it only applies to some regions.

Fixes rust-lang/rust#145168.

r? `@lcnr`
2025-08-17 10:24:20 +00:00
bors
99ba556567 Auto merge of #144081 - RalfJung:const-ptr-fragments, r=oli-obk
const-eval: full support for pointer fragments

This fixes https://github.com/rust-lang/const-eval/issues/72 and makes `swap_nonoverlapping` fully work in const-eval by enhancing per-byte provenance tracking with tracking of *which* of the bytes of the pointer this one is. Later, if we see all the same bytes in the exact same order, we can treat it like a whole pointer again without ever risking a leak of the data bytes (that encode the offset into the allocation). This lifts the limitation that was discussed quite a bit in https://github.com/rust-lang/rust/pull/137280.

For a concrete piece of code that used to fail and now works properly consider this example doing a byte-for-byte memcpy in const without using intrinsics:
```rust
use std::{mem::{self, MaybeUninit}, ptr};

type Byte = MaybeUninit<u8>;

const unsafe fn memcpy(dst: *mut Byte, src: *const Byte, n: usize) {
    let mut i = 0;
    while i < n {
        *dst.add(i) = *src.add(i);
        i += 1;
    }
}

const _MEMCPY: () = unsafe {
    let ptr = &42;
    let mut ptr2 = ptr::null::<i32>();
    // Copy from ptr to ptr2.
    memcpy(&mut ptr2 as *mut _ as *mut _, &ptr as *const _ as *const _, mem::size_of::<&i32>());
    assert!(*ptr2 == 42);
};
```
What makes this code tricky is that pointers are "opaque blobs" in const-eval, we cannot just let people look at the individual bytes since *we don't know what those bytes look like* -- that depends on the absolute address the pointed-to object will be placed at. The code above "breaks apart" a pointer into individual bytes, and then puts them back together in the same order elsewhere. This PR implements the logic to properly track how those individual bytes relate to the original pointer, and to recognize when they are in the right order again.

We still reject constants where the final value contains a not-fully-put-together pointer: I have no idea how one could construct an LLVM global where one byte is defined as "the 3rd byte of a pointer to that other global over there" -- and even if LLVM supports this somehow, we can leave implementing that to a future PR. It seems unlikely to me anyone would even want this, but who knows.^^

This also changes the behavior of Miri, by tracking the order of bytes with provenance and only considering a pointer to have valid provenance if all bytes are in the original order again. This is related to https://github.com/rust-lang/unsafe-code-guidelines/issues/558. It means one cannot implement XOR linked lists with strict provenance any more, which is however only of theoretical interest. Practically I am curious if anyone will show up with any code that Miri now complains about - that would be interesting data. Cc `@rust-lang/opsem`
2025-08-17 04:33:31 +00:00
Karl Meakin
c9ce45cb1e Optimize char::encode_utf8
Save a few instructions in `encode_utf8_raw_unchecked` by performing
manual CSE.
2025-08-17 01:22:48 +01:00
Pascal S. de Kloe
1f77424a79 fmt::DisplayInt abstraction obsolete with better macro 2025-08-16 18:33:20 +02:00
bors
2e2642e641 Auto merge of #145304 - m-ou-se:simplify-panic, r=oli-obk
Revert "Partially outline code inside the panic! macro".

This reverts https://github.com/rust-lang/rust/pull/115670

Without any tests/benchmarks that show some improvement, it's hard to know whether the change had any positive effect. (And if it did, whether that effect is still achieved today.)
2025-08-16 10:15:46 +00:00
Jacob Pratt
2a9bb562ff Rollup merge of #145462 - Kivooeo:stabilize-const_exposed_provenance, r=RalfJung
Stabilize `const_exposed_provenance` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/144538) and stabilises `fn with_exposed_provenance` and `fn with_exposed_provenance_mut` in const
2025-08-15 18:13:32 -04:00
Jacob Pratt
2776a21a4f Rollup merge of #144963 - rossmacarthur-forks:stabilize-core-iter-chain, r=jhpratt
Stabilize `core::iter::chain`

Closes rust-lang/rust#125964
2025-08-15 18:13:29 -04:00
Jacob Pratt
2b1a288dfc Rollup merge of #144922 - Kobzol:derive-from, r=nnethercote
Implement `#[derive(From)]`

Implements the `#[derive(From)]` feature ([tracking issue](https://github.com/rust-lang/rust/issues/144889), [RFC](https://github.com/rust-lang/rfcs/pull/3809)).

It allows deriving the `From` impl on structs and tuple structs with exactly one field. Some implementation notes:
- I wasn't exactly sure which spans to use in the derive generating code, so I just used `span` everywhere. I don't know if it's the Right Thing To Do. In particular the errors when `#[derive(From)]` is used on a struct with an unsized field are weirdly duplicated.
- I had to solve an import stability problem, where if I just added the unstable `macro From` to `core::convert`, previously working code like `use std::convert::From` would suddenly require an unstable feature gate, because rustc would think that you're trying to import the unstable macro. `@petrochenkov` suggested that I add the macro the the core prelude instead. This has worked well, although it only works in edition 2021+. Not sure if I botched the prelude somehow and it should live elsewhere (?).
- I had to add `Ty::AstTy`, because the `from` function receives an argument with the type of the single field, and the existing variants of the `Ty` enum couldn't represent an arbitrary type.
2025-08-15 18:13:28 -04:00
Jacob Pratt
7a05f26a3b Rollup merge of #144054 - jsimmons:stabilize-as-array-of-cells, r=tgross35
Stabilize as_array_of_cells

This PR stabilizes

```rust
impl<T, const N: usize> Cell<[T; N]> {
    pub const fn as_array_of_cells(&self) -> &[Cell<T>; N];
}
```

Stabilization report: https://github.com/rust-lang/rust/issues/88248#issuecomment-3082986863
Closes: https://github.com/rust-lang/rust/issues/88248
2025-08-15 18:13:27 -04:00
Kivooeo
b951b5dca1 stabilize strict provenance atomic ptr 2025-08-15 16:56:11 +00:00
Kivooeo
5ee2224daa stabilize const exposed provenance 2025-08-15 16:19:19 +00:00
Jakub Beránek
e935a155c2 Create unstable From builtin macro and register it 2025-08-15 12:06:20 +02:00
Stuart Cook
14e2886028 Rollup merge of #145322 - LorrensP-2158466:early-prelude-processing, r=petrochenkov
Resolve the prelude import in `build_reduced_graph`

This pr tries to resolve the prelude import at the `build_reduced_graph` stage.
Part of batched import resolution in rust-lang/rust#145108 (cherry picked commit) and maybe needed for rust-lang/rust#139493.

r? petrochenkov
2025-08-15 16:16:39 +10:00
Stuart Cook
65e2a8b6d8 Rollup merge of #144947 - tautschnig:remove-stray-checked_div-comment, r=Mark-Simulacrum
Fix description of unsigned `checked_exact_div`

Like its signed counterpart, this function does not panic. Also, fix the examples to document how it returns Some/None.
2025-08-15 16:16:33 +10:00
Stuart Cook
e3a178234d Rollup merge of #142640 - Sa4dUs:ad-intrinsic, r=ZuseZ4
Implement autodiff using intrinsics

This PR aims to move autodiff logic to `autodiff` intrinsic. Allowing us to delete a great part of our frontend code and overall, simplify the compilation pipeline of autodiff functions.
2025-08-15 16:16:30 +10:00
Stuart Cook
324bf2b9fd Rollup merge of #118087 - GrigorenkoPV:refcell_try_map, r=Mark-Simulacrum
Add Ref/RefMut try_map method

Tracking issue:  rust-lang/rust#143801

A more generalized version of [`filter_map`](https://doc.rust-lang.org/stable/core/cell/struct.Ref.html#method.filter_map), which allows to return some data on failure.

## Safety

As far as I can tell, `E` cannot contain any `'b` data, so it is impossible to duplicate the `&'b [mut]` reference into the `RefCell`'s  data.

Other than this `E`, everything is analogous to the already stable `filter_map`.

## `Try` / `Residual`

I have considered generalizing this to use the `Try` & `Residual` just like rust-lang/rust#79711 does for `array::try_map`, but it does not seem to be possible: we want to essentially `.map_err(|e| (orig, e))` but this does not seem to be supported with `Try`. (Plus I am not even sure if it is possible to express the fact that `&U` in `Try::Output` would have to have the same lifetime as the `&T` input of `F`.)

## ACP

~As far as I can tell, this [is not mandatory](https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html#suitability-for-the-standard-library), and the implementation is small enough to probably be smaller than the doc I would have to write.~

~https://github.com/rust-lang/libs-team/issues/341~

https://github.com/rust-lang/libs-team/issues/586
2025-08-15 16:16:29 +10:00
Jakub Beránek
01bd889098 Rollup merge of #145233 - joshtriplett:cfg-select-expr, r=jieyouxu
cfg_select: Support unbraced expressions

Tracking issue for `cfg_select`: rust-lang/rust#115585

When operating on expressions, `cfg_select!` can now handle expressions
without braces. (It still requires braces for other things, such as
items.)

Expand the test coverage and documentation accordingly.

---

I'm not sure whether deciding to extend `cfg_select!` in this way is T-lang or T-libs-api. I've labeled for both, with the request that both teams don't block on each other. :)
2025-08-14 21:48:42 +02:00
Marcelo Domínguez
250d77e5d7 Complete functionality and general cleanup 2025-08-14 16:30:15 +00:00
Marcelo Domínguez
5c631041aa Basic implementation of autodiff intrinsic 2025-08-14 16:29:58 +00:00
bors
be00ea1968 Auto merge of #144542 - sayantn:stabilize-sse4a-tbm, r=Amanieu,traviscross
Stabilize `sse4a` and `tbm` target features

This PR stabilizes the feature flag `sse4a_target_feature` and `tbm_target_feature` (tracking issue rust-lang/rust#44839).

# Public API
The 2 `x86` target features `sse4a` and `tbm`

Also, these were added in LLVM2.6 and LLVM3.4-rc1, respectively, and as the minimum LLVM required for rustc is LLVM19, we are safe in that front too!

As all of the required tasks have been done (adding the target features to rustc, implementing their runtime detection in std_detect and implementing the associated intrinsics in core_arch), these target features can be stabilized now. The intrinsics were stabilized *long* ago, in 1.27.0

Reference PR:

- https://github.com/rust-lang/reference/pull/1949

cc `@rust-lang/lang`

`@rustbot` label I-lang-nominated
r? lang
2025-08-14 14:01:12 +00:00
LorrensP-2158466
ff560d3c9a resolve prelude import at build_reduced_graph phase 2025-08-14 15:28:35 +02:00
Nicholas Nethercote
8296ad0456 Print regions in type_name.
Currently they are skipped, which is a bit weird, and it sometimes
causes malformed output like `Foo<>` and `dyn Bar<, A = u32>`.

Most regions are erased by the time `type_name` does its work. So all
regions are now printed as `'_` in non-optional places. Not perfect, but
better than the status quo.

`c_name` is updated to trim lifetimes from MIR pass names, so that the
`PASS_NAMES` sanity check still works. It is also renamed as
`simplify_pass_type_name` and made non-const, because it doesn't need
to be const and the non-const implementation is much shorter.

The commit also renames `should_print_region` as
`should_print_optional_region`, which makes it clearer that it only
applies to some regions.

Fixes #145168.
2025-08-14 21:13:06 +10:00
Guillaume Gomez
31d8277abe Rollup merge of #144515 - scottmcm:ptr_cast_array, r=Mark-Simulacrum
Implement `ptr_cast_array`

ACP: https://github.com/rust-lang/libs-team/issues/602
Tracking Issue: https://github.com/rust-lang/rust/issues/144514
2025-08-14 11:39:34 +02:00
sayantn
100d19ce5b Stabilize sse4a and tbm target features
- remove some stabilized target features from `gate.rs`
2025-08-14 02:07:40 +05:30
ltdk
c855a2f4d6 Hide docs for core::unicode 2025-08-13 12:27:44 -04:00
Jakub Beránek
8cb78fe3b6 Rollup merge of #145325 - clarfonthey:cast-init, r=scottmcm
Add `cast_init` and `cast_uninit` methods for pointers

ACP: rust-lang/libs-team#627
Tracking issue: rust-lang/rust#145036

This includes an incredibly low-effort search to find uses that could be switched to using these methods. I only searched for `cast::<\w>` and `cast::<MaybeUninit` because there would otherwise be way too much to look through, and I also didn't modify anything inside submodules/subtrees.
2025-08-13 07:03:52 +02:00
Jakub Beránek
b60d5b3672 Rollup merge of #145308 - giltho:dangling-doc, r=scottmcm
Adjust documentation of `dangling`

I believe the current doc of `dangling` is slightly off as it indicates:
`Note that the pointer value may potentially represent a valid pointer to a T`

The returned pointer has no provenance, so it may not be a valid pointer (except in the case of ZSTs, but I don't think this is what the documentation is trying to warn about).

See: https://rust-lang.zulipchat.com/#narrow/channel/136281-t-opsem/topic/Dangling.20pointers.3A.20definition

The value returned by dangling may never be used to dereference a value that isn't a ZST, even if address equality is detected with that of a valid pointer.
This is a minor fix, but this doc still got me confused for a second
2025-08-13 07:03:51 +02:00
Jakub Beránek
fb9cd24d2e Rollup merge of #143467 - ChaiTRex:ascii_char_is_ascii, r=tgross35
Add ASCII-related methods from `u8` and `MIN`/`MAX` to `core::ascii::Char`

* Add ASCII-related methods from `u8` to `core::ascii::Char`.
* Add `core::ascii::Char::MIN` and `core::ascii::Char::MAX`.
2025-08-13 07:03:46 +02:00
ltdk
d6945f6d8c Add cast_init and cast_uninit methods for pointers 2025-08-12 16:57:56 -04:00
Sacha Ayoun
427be23b22 Address dangling doc
Signed-off-by: Sacha Ayoun <sachaayoun@gmail.com>
2025-08-12 13:18:48 +01:00
Mara Bos
08acba3071 Revert "Partially outline code inside the panic! macro".
Without any tests/benchmarks that show some improvement, it's hard to
know whether the change had any positive effect at all. (And if it did,
whether that effect is still achieved today.)
2025-08-12 12:52:39 +02:00
Ada Alakbarova
5e4f465655 fix typo 2025-08-12 09:43:17 +02:00
Jakub Stasiak
2f796d9021 Make a James Bond reference 2025-08-11 16:42:09 +02:00
Jakub Stasiak
fb04c5e471 dec2flt: Provide more valid inputs examples
I was just looking at the specifics of how the parsing is handled here
and I wasn't sure if the examples were incomplete or the grammar below was
misleading.

The grammar was correct so I figured I'd add these examples to clarify.
2025-08-11 16:33:41 +02:00
Stuart Cook
2c314f93d3 Rollup merge of #144330 - gewitternacht:document-clone-eq, r=Amanieu
document assumptions about `Clone` and `Eq` traits

Most standard library collections break if `Clone` has a non-standard implementation which violates `x.clone() == x`. [Here](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=b7fc6dfa8410cbb673eb8d38393d81de) the resulting broken behaviour of different collections is shown. I originally created an issue at https://github.com/rust-lang/hashbrown/issues/629, but the conclusion there was that `x.clone()` resulting in an object that compares equal to the original one is probably a very universal assumption. However, this assumption is (to my knowledge) not documented anywhere.

I propose to make this assumption explicit in the `Clone` trait documentation. The property that seems the most reasonable to me is the following: When implementing both `Clone` and `PartialEq`, then
```text
x == x -> x.clone() == x
```
is expected to hold. This way, when also implementing `Eq`, it automatically follows that `x.clone() == x` has to hold, which should be enough for the collections to not break. At the same time, the property also works for the "normal" elements of a type with `PartialEq`. For the wording, I tried to follow the [`Hash` and `Eq`](https://doc.rust-lang.org/std/hash/trait.Hash.html#hash-and-eq) documentation.

As I am fairly new to Rust, it might well be that this property cannot be generally expected – it seems reasonable to me, but any counter-examples or critique, both content- and wording-wise, would be very welcome. If the property turns out to be too general, I would suggest to at least document the assumption of `x.clone() == x` for the collections somehow.

An additional thought of mine:
If it is indeed generally expected that `x == x -> x.clone() == x`, then, for the sake of completeness, one could also define that `x != x -> y != y for y = x.clone()` should hold, i.e., that an object that did not compare equal to itself before cloning, should also not compare equal to itself afterwards.
2025-08-11 12:21:07 +10:00
Stuart Cook
d06b3b432f Rollup merge of #143949 - clarfonthey:const-arith-ops, r=Amanieu
Constify remaining traits/impls for `const_ops`

Tracking issue: rust-lang/rust#143802

This is split into two commits for ease of reviewability:

1. Updates the `forward_ref_*` macros to accept multiple attributes (in anticipation of needing `rust_const_unstable` attributes) and also *require* attributes in these macros. Since the default attribute only helps for the initial implementations, it means it's easy to get wrong for future implementations, as shown for the saturating implementations which were incorrect before.
2. Actually constify the traits/impls.

A few random other notes on the implementation specifically:

* I unindented the attributes that were passed to the `forward_ref_*` macro calls because in some places rustfmt wanted them to be unindented, and in others it was allowed because they were themselves inside of macro bodies. I chose the consistent indenting even though I (personally) think it looks worse.

----

As far as the actual changes go, this constifies the following additional traits:

* `Neg`
* `Not`
* `BitAnd`
* `BitOr`
* `BitXor`
* `Shl`
* `Shr`
* `AddAssign`
* `SubAssign`
* `MulAssign`
* `DivAssign`
* `RemAssign`
* `BitAndAssign`
* `BitOrAssign`
* `BitXorAssign`
* `ShlAssign`
* `ShrAssign`

In terms of constified implementations of these traits, it adds the reference-forwarded versions of all the arithmetic operators, which are defined by the macros in `library/core/src/internal_macros.rs`. I'm not going to fully enumerate these because we'd be here all day, but sufficed to say, it effectively allows adding an `&` to one or both sides of an operator for primitives.

Additionally, I constified the implementations for `Wrapping`, `Saturating`, and `NonZero` as well, since all of them forward to already-const-stable methods. (potentially via intrinsics, to avoid extra overhead)

There are three "non-primitive" types which implement these traits, listed below. Note that I put "non-primitive" in quotes since I'm including `Wrapping`, `Saturating`, and `NonZero`, which are just wrappers over primitives.

* `Duration` (arithmetic operations)
* `SystemTime` (arithmetic operations)
* `Ipv4Addr` (bit operations)
* `Ipv6Addr` (bit operations)

Additionally, because the methods on `SystemTime` needed to make these operations const were not marked const, a separate tracking issue for const-stabilising those methods is rust-lang/rust#144517.

Stuff left out of this PR:

* `Assume` (this could trivially be made const, but since the docs indicate this is still under heavy design, I figured I'd leave it out)
* `Instant` (this could be made const, but cannot reasonably be constructed at constant time, so, isn't useful)
* `SystemTime` (will submit separate PR)
* SIMD types (I'm tackling these all at once later; see rust-lang/portable-simd#467)

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_CONCERN-ISSUE_START -->

> [!NOTE]
> # Concerns (0 active)
>
> - ~~[May break Clippy](https://github.com/rust-lang/rust/pull/143949#issuecomment-3081466077)~~ resolved in [this comment](https://github.com/rust-lang/rust/pull/143949#issuecomment-3083628215)
>
> *Managed by ```@rustbot`—see`` [help](https://forge.rust-lang.org/triagebot/concern.html) for details.*

<!-- TRIAGEBOT_CONCERN-ISSUE_END -->
<!-- TRIAGEBOT_END -->
2025-08-11 12:21:06 +10:00
Josh Triplett
38df15805b cfg_select: Support unbraced expressions
When operating on expressions, `cfg_select!` can now handle expressions
without braces. (It still requires braces for other things, such as
items.)

Expand the test coverage and documentation accordingly.
2025-08-10 16:18:01 -07:00
gewitternacht
fadc961d99 mention Hash and Ord; refine description of derive 2025-08-11 00:05:47 +02:00
Stuart Cook
c15c2f0a42 Rollup merge of #145135 - Kivooeo:stabilize-duration_constructors_lite, r=ChrisDenton
Stabilize `duration_constructors_lite` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/140881) and stabilises `Duration::from_hours` and `Duration::from_mins` while not touching a `duration_constructors` feature from the related [tracking issue (2)](https://github.com/rust-lang/rust/issues/120301)
2025-08-10 19:45:51 +10:00
ltdk
bb32e31e65 Constify remaining operators 2025-08-10 01:11:45 -04:00
ltdk
f604dd117d Let forward_ref_* macros accept multiple attributes, and require attributes explicitly 2025-08-10 01:09:56 -04:00
Kivooeo
b5e2ba6775 Stabilize feature 2025-08-09 13:31:53 +05:00
Stuart Cook
2a7354e03e Rollup merge of #145027 - Kmeakin:km/optimize-char-is-alphanumeric, r=scottmcm
Optimize `char::is_alphanumeric`

Avoid an unnecessary call to `unicode::Alphabetic` when `self` is an ASCII digit (ie `0..=9`).
2025-08-09 13:58:47 +10:00
bors
ffb9d94dcf Auto merge of #145126 - tgross35:rollup-6w87usd, r=tgross35
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#139451 (Add `target_env = "macabi"` and `target_env = "sim"`)
 - rust-lang/rust#144039 (Use `tcx.short_string()` in more diagnostics)
 - rust-lang/rust#144192 (atomicrmw on pointers: move integer-pointer cast hacks into backend)
 - rust-lang/rust#144545 (In rustc_pattern_analysis, put `true` witnesses before `false` witnesses)
 - rust-lang/rust#144579 (Implement declarative (`macro_rules!`) attribute macros (RFC 3697))
 - rust-lang/rust#144649 (Account for bare tuples and `Pin` methods in field searching logic)
 - rust-lang/rust#144775 (more strongly dissuade use of `skip_binder`)
 - rust-lang/rust#144987 (Enable f16 and f128 on targets that were fixed in LLVM21)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-08 20:53:33 +00:00