Commit Graph

18772 Commits

Author SHA1 Message Date
Ralf Jung
a7400a8b90 update intrinsics/mod.rs comment about const intrinsics 2025-04-07 19:06:34 +02:00
Stuart Cook
9209c5eb60
Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obk
Remove support for `extern "rust-intrinsic"` blocks

Part of rust-lang/rust#132735

Looked manageable and there didn't appear to have been progress in the last two weeks,
so decided to give it a try.
2025-04-07 22:29:20 +10:00
bors
25a615bf82 Auto merge of #138951 - jwnrt:alloc-raw-vec-strict-prov, r=Noratrieb
Replace last `usize` -> `ptr` transmute in `alloc` with strict provenance API

This replaces the `usize -> ptr` transmute in `RawVecInner::new_in` with a strict provenance API (`NonNull::without_provenance`).

The API is changed to take an `Alignment` which encodes the non-null constraint needed for `Unique` and allows us to do the construction safely.

Two internal-only APIs were added to let us avoid UB-checking in this hot code: `Layout::alignment` to get the `Alignment` type directly rather than as a `usize`, and `Unique::from_non_null` to create `Unique` in const context without a transmute.
2025-04-06 23:07:48 +00:00
bors
2fa8b11f09 Auto merge of #136077 - rust-lang:cargo_update, r=clubby789
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt

compiler & tools dependencies:
     Locking 11 packages to latest compatible versions
    Updating blake3 v1.8.0 -> v1.8.1
    Updating ctrlc v3.4.5 -> v3.4.6
    Updating env_logger v0.11.7 -> v0.11.8
    Updating errno v0.3.10 -> v0.3.11
    Updating flate2 v1.1.0 -> v1.1.1
    Updating indexmap v2.8.0 -> v2.9.0
    Updating miniz_oxide v0.8.5 -> v0.8.7
    Updating openssl-sys v0.9.106 -> v0.9.107
    Updating redox_syscall v0.5.10 -> v0.5.11
    Updating smallvec v1.14.0 -> v1.15.0
    Updating tokio v1.44.1 -> v1.44.2
note: pass `--verbose` to see 40 unchanged dependencies behind latest

library dependencies:
     Locking 1 package to latest compatible version
    Updating miniz_oxide v0.8.5 -> v0.8.7
note: pass `--verbose` to see 4 unchanged dependencies behind latest

rustbook dependencies:
     Locking 30 packages to latest compatible versions
    Updating cc v1.2.17 -> v1.2.18
    Updating clap v4.5.32 -> v4.5.35
    Updating clap_builder v4.5.32 -> v4.5.35
    Updating darling v0.20.10 -> v0.20.11
    Updating darling_core v0.20.10 -> v0.20.11
    Updating darling_macro v0.20.10 -> v0.20.11
    Updating env_logger v0.11.7 -> v0.11.8
    Updating errno v0.3.10 -> v0.3.11
    Updating flate2 v1.1.0 -> v1.1.1
    Updating iana-time-zone v0.1.61 -> v0.1.63
    Updating icu_locid_transform_data v1.5.0 -> v1.5.1
    Updating icu_normalizer_data v1.5.0 -> v1.5.1
    Updating icu_properties_data v1.5.0 -> v1.5.1
    Updating indexmap v2.8.0 -> v2.9.0
    Updating log v0.4.26 -> v0.4.27
    Updating miniz_oxide v0.8.5 -> v0.8.7
    Updating once_cell v1.21.1 -> v1.21.3
    Updating pest v2.7.15 -> v2.8.0
    Updating pest_derive v2.7.15 -> v2.8.0
    Updating pest_generator v2.7.15 -> v2.8.0
    Updating pest_meta v2.7.15 -> v2.8.0
    Updating redox_syscall v0.5.10 -> v0.5.11
    Updating rustix v1.0.3 -> v1.0.5
    Updating smallvec v1.14.0 -> v1.15.0
    Updating string_cache v0.8.8 -> v0.8.9
    Updating windows-core v0.52.0 -> v0.61.0
      Adding windows-implement v0.60.0
      Adding windows-interface v0.59.1
      Adding windows-result v0.3.2
      Adding windows-strings v0.4.0
```
2025-04-06 19:57:47 +00:00
Bennet Bleßmann
6dfb29624c
update docs
- src\doc\nomicon\src\ffi.md should also have its ABI list updated
2025-04-06 21:41:47 +02:00
Guillaume Gomez
ed81e347f1
Rollup merge of #139367 - GuillaumeGomez:proc-macro-values, r=Urgau
Add `*_value` methods to proc_macro lib

This is the (re-)implementation of https://github.com/rust-lang/libs-team/issues/459.

It allows to get the actual value (unescaped) of the different string literals.

It was originally done in https://github.com/rust-lang/rust/pull/136355 but it broke the artifacts build so we decided to move the crate to crates.io to go around this limitation.

Part of https://github.com/rust-lang/rust/issues/136652.

Considering this is a copy-paste of the originally approved PR, no need to go through the whole process again. \o/

r? `@Urgau`
2025-04-06 18:08:10 +02:00
Guillaume Gomez
d1da78b201
Rollup merge of #139072 - nickkuk:align_to_uninit_mut, r=Mark-Simulacrum
Add `slice::align_to_uninit_mut`

Add new `slice::align_to_uninit_mut` method.

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

ACP: https://github.com/rust-lang/libs-team/issues/564
2025-04-06 18:08:10 +02:00
Guillaume Gomez
962fa98eeb
Rollup merge of #138876 - thaliaarchi:trusty-stdio, r=Noratrieb
Trusty: Implement `write_vectored` for stdio

Currently, `write` for stdout and stderr on Trusty is implemented with the semantics of `write_all`. Instead, call the underlying syscall only once in `write` and use the default implementation of `write_all` like other platforms. Also, implement `write_vectored` by adding support for `IoSlice`.

Refactor stdin to reuse the unsupported type like https://github.com/rust-lang/rust/pull/136769.

It requires #138875 to fix the build for Trusty, though they do not conflict and can merge in either order.

cc `@randomPoison`
2025-04-06 18:08:09 +02:00
Guillaume Gomez
7bd89b90e8
Rollup merge of #138562 - kornelski:nth-panic, r=Noratrieb
Optimize slice {Chunks,Windows}::nth

I've noticed that the `nth` functions on slice iters had non-optimized-out bounds checks.

The new implementation even generates branchless code.
2025-04-06 18:08:08 +02:00
Stuart Cook
fededb9906
Rollup merge of #139123 - thaliaarchi:core-alloc-test-paths, r=bjorn3
tidy: Fix paths to `coretests` and `alloctests`

Following `#135937` and `#136642`, tests for core and alloc are in coretests and alloctests. Fix tidy to lint for the new paths. Also, update comments referring to the old locations.

Some context for changes which don't match that pattern:
- `library/std/src/thread/local/dynamic_tests.rs` and `library/std/src/sync/mpsc/sync_tests.rs` were moved under `library/std/tests/` in 332fb7e6f1 (Move std::thread_local unit tests to integration tests, 2025-01-17) and b8ae372e48 (Move std::sync unit tests to integration tests, 2025-01-17), respectively, so are no longer special cases.
- There never was a `library/core/tests/fmt.rs` file. That comment previously referred to `src/test/ui/ifmt.rs`, which was folded into `library/alloc/tests/fmt.rs` in 949c96660c (move format! interface tests, 2020-09-08).

Now, the only matches for `(alloc|core)/tests` are in `compiler/rustc_codegen_{cranelift,gcc}/patches`. I don't know why CI hasn't broken because those patches can't apply. Or maybe they somehow still can apply?

r? `@bjorn3`
2025-04-06 16:21:02 +10:00
github-actions
d1eebd4b8c cargo update
compiler & tools dependencies:
     Locking 11 packages to latest compatible versions
    Updating blake3 v1.8.0 -> v1.8.1
    Updating ctrlc v3.4.5 -> v3.4.6
    Updating env_logger v0.11.7 -> v0.11.8
    Updating errno v0.3.10 -> v0.3.11
    Updating flate2 v1.1.0 -> v1.1.1
    Updating indexmap v2.8.0 -> v2.9.0
    Updating miniz_oxide v0.8.5 -> v0.8.7
    Updating openssl-sys v0.9.106 -> v0.9.107
    Updating redox_syscall v0.5.10 -> v0.5.11
    Updating smallvec v1.14.0 -> v1.15.0
    Updating tokio v1.44.1 -> v1.44.2
note: pass `--verbose` to see 40 unchanged dependencies behind latest

library dependencies:
     Locking 1 package to latest compatible version
    Updating miniz_oxide v0.8.5 -> v0.8.7
note: pass `--verbose` to see 4 unchanged dependencies behind latest

rustbook dependencies:
     Locking 30 packages to latest compatible versions
    Updating cc v1.2.17 -> v1.2.18
    Updating clap v4.5.32 -> v4.5.35
    Updating clap_builder v4.5.32 -> v4.5.35
    Updating darling v0.20.10 -> v0.20.11
    Updating darling_core v0.20.10 -> v0.20.11
    Updating darling_macro v0.20.10 -> v0.20.11
    Updating env_logger v0.11.7 -> v0.11.8
    Updating errno v0.3.10 -> v0.3.11
    Updating flate2 v1.1.0 -> v1.1.1
    Updating iana-time-zone v0.1.61 -> v0.1.63
    Updating icu_locid_transform_data v1.5.0 -> v1.5.1
    Updating icu_normalizer_data v1.5.0 -> v1.5.1
    Updating icu_properties_data v1.5.0 -> v1.5.1
    Updating indexmap v2.8.0 -> v2.9.0
    Updating log v0.4.26 -> v0.4.27
    Updating miniz_oxide v0.8.5 -> v0.8.7
    Updating once_cell v1.21.1 -> v1.21.3
    Updating pest v2.7.15 -> v2.8.0
    Updating pest_derive v2.7.15 -> v2.8.0
    Updating pest_generator v2.7.15 -> v2.8.0
    Updating pest_meta v2.7.15 -> v2.8.0
    Updating redox_syscall v0.5.10 -> v0.5.11
    Updating rustix v1.0.3 -> v1.0.5
    Updating smallvec v1.14.0 -> v1.15.0
    Updating string_cache v0.8.8 -> v0.8.9
    Updating windows-core v0.52.0 -> v0.61.0
      Adding windows-implement v0.60.0
      Adding windows-interface v0.59.1
      Adding windows-result v0.3.2
      Adding windows-strings v0.4.0
2025-04-06 00:23:40 +00:00
Thalia Archibald
3af666ea91 tidy: Fix paths to coretests and alloctests
Following `#135937` and `#136642`, tests for core and alloc are in
coretests and alloctests. Fix tidy to lint for the new paths. Also,
update comments referring to the old locations.

Some context for changes which don't match that pattern:
* library/std/src/thread/local/dynamic_tests.rs and
  library/std/src/sync/mpsc/sync_tests.rs were moved under
  library/std/tests/ in 332fb7e6f1 (Move std::thread_local unit tests
  to integration tests, 2025-01-17) and b8ae372e48 (Move std::sync unit
  tests to integration tests, 2025-01-17), respectively, so are no
  longer special cases.
* There never was a library/core/tests/fmt.rs file. That comment
  previously referred to src/test/ui/ifmt.rs, which was folded into
  library/alloc/tests/fmt.rs in 949c96660c (move format! interface
  tests, 2020-09-08).
2025-04-05 12:15:49 -07:00
Matthias Krüger
527725b025
Rollup merge of #139121 - thaliaarchi:rename-thread_local-statik, r=Noratrieb
Rename internal module from `statik` to `no_threads`

This module is named in reference to the keyword, but the term is somewhat overloaded. Rename it to more clearly describe it and avoid the misspelling.
2025-04-05 19:40:24 +02:00
Matthias Krüger
0b342873e3
Rollup merge of #136877 - Sky9x:const-inherent-ptr-replace, r=jhpratt
Fix missing const for inherent pointer `replace` methods

`ptr::replace` (the free fn) is already const stable. However, there are inherent convenience methods on `*mut T` and `NonNull<T>`, allowing you to write eg. `unsafe { foo.replace(bar) }` where `foo` is `*mut T` or `NonNull<T>`.

It seems const was never added to the inherent method (likely oversight), so this PR adds it.
I don't believe this needs another[^1] FCP as the inherent methods are already stable and `ptr::replace` is already const stable, so this adds no new API.

Original tracking issue: #83164
`ptr::replace` constified in #83091
`ptr::replace` const stabilized in #130954

[^1]: `const_replace` FCP completed: https://github.com/rust-lang/rust/issues/83164#issuecomment-2385670050
2025-04-05 19:40:23 +02:00
Matthias Krüger
a64ccf4a46
Rollup merge of #139092 - thaliaarchi:move-fd-pal, r=joboet
Move `fd` into `std::sys`

Move platform definitions of `fd` into `std::sys`, as part of https://github.com/rust-lang/rust/issues/117276.

Unlike other modules directly under `std::sys`, this is only available on some platforms and I have not provided a fallback abstraction for unsupported platforms. That is similar to how `std::os::fd` is gated to only supported platforms.

Also, fix the `unsafe_op_in_unsafe_fn` lint, which was allowed for the Unix fd impl. Since macro expansions from `std::sys::pal::unix::weak` trigger this lint, fix it there too.

cc `@joboet,` `@ChrisDenton`

try-job: x86_64-gnu-aux
2025-04-05 10:18:04 +02:00
Matthias Krüger
56ffb43629
Rollup merge of #138381 - thaliaarchi:bstr-sliceindex, r=joshtriplett
Implement `SliceIndex` for `ByteStr`

Implement `Index` and `IndexMut` for `ByteStr` in terms of `SliceIndex`. Implement it for the same types that `&[u8]` supports (a superset of those supported for `&str`, which does not have `usize` and `ops::IndexRange`).

At the same time, move compare and index traits to a separate file in the `bstr` module, to give it more space to grow as more functionality is added (e.g., iterators and string-like ops). Order the items in `bstr/traits.rs` similarly to `str/traits.rs`.

cc `@joshtriplett`

`ByteStr`/`ByteString` tracking issue: https://github.com/rust-lang/rust/issues/134915
2025-04-05 10:18:03 +02:00
Thalia Archibald
9b889e9198 Rename internal module from statik to no_threads
This module is named in reference to the keyword, but the term is
somewhat overloaded. Rename it to more clearly describe it and avoid the
misspelling.
2025-04-04 20:31:15 -07:00
Thalia Archibald
3ab22fabf1 Fix unsafe_op_in_unsafe_fn for Unix fd and weak 2025-04-04 20:11:08 -07:00
Thalia Archibald
4085af0183 Move fd into sys 2025-04-04 20:11:08 -07:00
Stuart Cook
e31ce50698
Rollup merge of #139389 - mejrs:hidden, r=workingjubilee
make `Arguments::as_statically_known_str` doc(hidden)

Fixes `as_statically_known_str` being [visible](https://doc.rust-lang.org/nightly/std/fmt/struct.Arguments.html#method.as_statically_known_str) ([Rendered](https://github.com/user-attachments/assets/45482d9f-2ec5-4610-be9c-b231bd2850c6))

This snuck in with https://github.com/rust-lang/rust/pull/138650, cc `@thaliaarchi`

This is also visible in the beta docs.

`@rustbot` label +beta-nominated
2025-04-05 13:18:17 +11:00
Stuart Cook
338b8787b9
Rollup merge of #138546 - GuillaumeGomez:integer-to-string-tests, r=Amanieu
Add integer to string formatting tests

As discussed in https://github.com/rust-lang/rust/pull/136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :)

r? `````@Mark-Simulacrum`````
2025-04-05 13:18:14 +11:00
Stuart Cook
a038028eca
Rollup merge of #138024 - reitermarkus:unicode-panic-optimization, r=ibraheemdev
Allow optimizing out `panic_bounds_check` in Unicode checks.

Allow optimizing out `panic_bounds_check` in Unicode checks.

For context, see https://github.com/japaric/ufmt/issues/52#issuecomment-2699207241.
2025-04-05 13:18:14 +11:00
Stuart Cook
92bb7261c4
Rollup merge of #137897 - xTachyon:tls-fix, r=thomcc,jieyouxu
fix pthread-based tls on apple targets

Tries to fix #127773.
2025-04-05 13:18:13 +11:00
Stuart Cook
2e4e196a5b
Rollup merge of #136457 - calder:master, r=tgross35
Expose algebraic floating point intrinsics

# Problem

A stable Rust implementation of a simple dot product is 8x slower than C++ on modern x86-64 CPUs. The root cause is an inability to let the compiler reorder floating point operations for better vectorization.

See https://github.com/calder/dot-bench for benchmarks. Measurements below were performed on a i7-10875H.

### C++: 10us 

With Clang 18.1.3 and `-O2 -march=haswell`:
<table>
<tr>
    <th>C++</th>
    <th>Assembly</th>
</tr>
<tr>
<td>
<pre lang="cc">
float dot(float *a, float *b, size_t len) {
    #pragma clang fp reassociate(on)
    float sum = 0.0;
    for (size_t i = 0; i < len; ++i) {
        sum += a[i] * b[i];
    }
    return sum;
}
</pre>
</td>
<td>
<img src="https://github.com/user-attachments/assets/739573c0-380a-4d84-9fd9-141343ce7e68" />
</td>
</tr>
</table>

### Nightly Rust: 10us 

With rustc 1.86.0-nightly (8239a37f9) and `-C opt-level=3 -C target-feature=+avx2,+fma`:
<table>
<tr>
    <th>Rust</th>
    <th>Assembly</th>
</tr>
<tr>
<td>
<pre lang="rust">
fn dot(a: &[f32], b: &[f32]) -> f32 {
    let mut sum = 0.0;
    for i in 0..a.len() {
        sum = fadd_algebraic(sum, fmul_algebraic(a[i], b[i]));
    }
    sum
}
</pre>
</td>
<td>
<img src="https://github.com/user-attachments/assets/9dcf953a-2cd7-42f3-bc34-7117de4c5fb9" />
</td>
</tr>
</table>

### Stable Rust: 84us 

With rustc 1.84.1 (e71f9a9a9) and `-C opt-level=3 -C target-feature=+avx2,+fma`:
<table>
<tr>
    <th>Rust</th>
    <th>Assembly</th>
</tr>
<tr>
<td>
<pre lang="rust">
fn dot(a: &[f32], b: &[f32]) -> f32 {
    let mut sum = 0.0;
    for i in 0..a.len() {
        sum += a[i] * b[i];
    }
    sum
}
</pre>
</td>
<td>
<img src="https://github.com/user-attachments/assets/936a1f7e-33e4-4ff8-a732-c3cdfe068dca" />
</td>
</tr>
</table>

# Proposed Change

Add `core::intrinsics::f*_algebraic` wrappers to `f16`, `f32`, `f64`, and `f128` gated on a new `float_algebraic` feature.

# Alternatives Considered

https://github.com/rust-lang/rust/issues/21690 has a lot of good discussion of various options for supporting fast math in Rust, but is still open a decade later because any choice that opts in more than individual operations is ultimately contrary to Rust's design principles.

In the mean time, processors have evolved and we're leaving major performance on the table by not supporting vectorization. We shouldn't make users choose between an unstable compiler and an 8x performance hit.

# References

* https://github.com/rust-lang/rust/issues/21690
* https://github.com/rust-lang/libs-team/issues/532
* https://github.com/rust-lang/rust/issues/136469
* https://github.com/calder/dot-bench
* https://www.felixcloutier.com/x86/vfmadd132ps:vfmadd213ps:vfmadd231ps

try-job: x86_64-gnu-nopt
try-job: x86_64-gnu-aux
2025-04-05 13:18:12 +11:00
Calder Coalson
8ff70529f2 Expose algebraic floating point intrinsics 2025-04-04 16:13:57 -07:00
Guillaume Gomez
2e3a161871 Update rustc-literal-escaper version to 0.0.2 2025-04-04 22:26:10 +02:00
Guillaume Gomez
2b533e6b49 bootstrap: Only add rustc_randomized_layouts if the crate has it 2025-04-04 22:26:10 +02:00
Matthias Krüger
fa7d66eaaa
Rollup merge of #139366 - RalfJung:ToSocketAddrs, r=jieyouxu
ToSocketAddrs: fix typo

It's "a function", never "an function".

I noticed the same typo somewhere in the compiler sources so figured I'd fix it there as well.
2025-04-04 21:54:59 +02:00
mejrs
cfcc47ea54 make Arguments::as_statically_known_str doc(hidden) 2025-04-04 21:43:03 +02:00
Kornel
9f2f1aa083
Optimize setting the slice to empty in slice Iter
This avoids generating extra instructions that needlessly modify the slice's pointer
2025-04-04 15:57:41 +01:00
Kornel
89477aff04
Optimize slice Windows::nth
Generates branchless code
2025-04-04 15:52:34 +01:00
Kornel
e649867086
Optimize slice Iter::nth 2025-04-04 15:52:33 +01:00
Guillaume Gomez
13400c2c10 Add _value methods to proc_macro lib 2025-04-04 15:04:17 +02:00
Ralf Jung
0f12a2c4ad ToSocketAddrs: fix typo 2025-04-04 14:47:04 +02:00
bors
b8ff7b682e Auto merge of #139213 - bjorn3:cg_clif_test_coretests, r=jieyouxu
Run coretests and alloctests with cg_clif in CI

Part of https://github.com/rust-lang/rustc_codegen_cranelift/issues/1290
2025-04-04 11:59:59 +00:00
Matthias Krüger
f701a5cc38
Rollup merge of #139295 - JakeWharton:jw.duplicate-anon-pipe.2025-04-02, r=joboet
Remove creation of duplicate `AnonPipe`

The `File` is unwrapped to a `Handle` into an `AnonPipe`, and then that `AnonPipe` was unwrapped to a `Handle` into another `AnonPipe`. The second operation is entirely redundant.
2025-04-04 08:02:06 +02:00
Matthias Krüger
ff8f2eff3a
Rollup merge of #139068 - a1phyr:less_uninit, r=joboet
io: Avoid marking some bytes as uninit

These bytes were marked as uninit, which would cause them to be initialized multiple times even though it was not necessary.
2025-04-03 21:18:31 +02:00
bors
82eb03ec62 Auto merge of #139301 - matthiaskrgr:rollup-sa6ali8, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #139080 (Experimental feature gate for `super let`)
 - #139145 (slice: Remove some uses of unsafe in first/last chunk methods)
 - #139149 (unstable book: document import_trait_associated_functions)
 - #139273 (Apply requested API changes to `cell_update`)
 - #139282 (rustdoc: make settings checkboxes always square)
 - #139283 (Rustc dev guide subtree update)
 - #139294 (Fix the `f16`/`f128` feature gates on integer literals)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-03 15:31:20 +00:00
bjorn3
fde54c2c03 Fix testing with randomized layouts enabled 2025-04-03 15:30:01 +00:00
bjorn3
13970949d1 Run coretests and alloctests with cg_clif in CI 2025-04-03 12:07:14 +00:00
bors
e0883a2a6c Auto merge of #137738 - Daniel-Aaron-Bloom:const_slice_make_iter, r=dtolnay
Make slice iterator constructors unstably const

See [tracking issue](https://github.com/rust-lang/rust/issues/137737) for justification.

try-job: aarch64-apple
try-job: x86_64-gnu
2025-04-03 08:57:46 +00:00
Matthias Krüger
184e4baf1b
Rollup merge of #139273 - tgross35:cell-update-changes, r=jhpratt
Apply requested API changes to `cell_update`

Do the following:

* Switch to `impl FnOnce` rather than a generic `F`.
* Change `update` to return nothing.

This was discussed at a libs-api meeting [1].

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

[1]: https://github.com/rust-lang/rust/pull/134446#issuecomment-2770842949
2025-04-03 07:39:07 +02:00
Matthias Krüger
e332aa89a7
Rollup merge of #139145 - okaneco:safe_splits, r=Amanieu
slice: Remove some uses of unsafe in first/last chunk methods

Remove unsafe `split_at_unchecked` and `split_at_mut_unchecked` in some slice `split_first_chunk`/`split_last_chunk` methods.
Replace those calls with the safe `split_at` and `split_at_checked` where applicable.

Add codegen tests to check for no panics when calculating the last chunk index using `checked_sub` and `split_at`.

Better viewed with whitespace disabled in diff view

---

The unchecked calls are mostly manual implementations of the safe methods, but with the safety condition negated from `mid <= len` to `len < mid`.
```rust
if self.len() < N {
    None
} else {
    // SAFETY: We manually verified the bounds of the split.
    let (first, tail) = unsafe { self.split_at_unchecked(N) };
    // Or for the last_chunk methods
    let (init, last) = unsafe { self.split_at_unchecked(self.len() - N) };
```

Unsafe is still needed for the pointer array casts. Their safety comments are unmodified.
2025-04-03 07:39:05 +02:00
Jake Wharton
0d8c33f6f1 Remove creation of duplicate AnonPipe
The File is unwrapped to a Handle into an AnonPipe, and then that AnonPipe was unwrapped to a Handle into another AnonPipe. The second operation is entirely redundant.
2025-04-02 23:03:55 -04:00
Trevor Gross
072aa9e66f Apply requested API changes to cell_update
Do the following:

* Switch to `impl FnOnce` rather than a generic `F`.
* Change `update` to return nothing.

This was discussed at a libs-api meeting [1].

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

[1]: https://github.com/rust-lang/rust/pull/134446#issuecomment-2770842949
2025-04-02 18:18:50 +00:00
Daniel Bloom
20417a9522 Make slice iterator constructors unstably const 2025-04-02 10:39:14 -07:00
Takayuki Maeda
5df0c684f4
Rollup merge of #139215 - clubby789:std-size-tweaks, r=joboet
Add `opt-level = "s"` for more std symbolication crates

This reduces the size of a hello world binary built by stage 1 in release by a few kilobytes
2025-04-02 22:52:46 +09:00
bors
79de6c0bbe Auto merge of #138848 - clubby789:cargo-update, r=Mark-Simulacrum
Update dependencies

#136077 needs manual tweaking
```
    compiler and tools dependencies
        Updating anyhow v1.0.95 -> v1.0.97
        Updating basic-toml v0.1.9 -> v0.1.10
        Updating bitflags v2.8.0 -> v2.9.0
        Updating blake3 v1.5.5 -> v1.8.0
        Updating bumpalo v3.16.0 -> v3.17.0
        Removing byteorder v1.5.0
        Updating bytes v1.9.0 -> v1.10.1
        Updating cargo_metadata v0.19.1 -> v0.19.2
        Updating chrono v0.4.39 -> v0.4.40
        Updating chrono-tz v0.10.1 -> v0.10.3
        Updating chrono-tz-build v0.4.0 -> v0.4.1
        Updating clap v4.5.26 -> v4.5.35
        Updating clap_builder v4.5.26 -> v4.5.35
        Updating clap_derive v4.5.24 -> v4.5.35
        Updating console v0.15.10 -> v0.15.11
        Updating cpufeatures v0.2.16 -> v0.2.17
        Updating curl-sys v0.4.78+curl-8.11.0 -> v0.4.80+curl-8.12.1
        Updating darling v0.20.10 -> v0.20.11
        Updating darling_core v0.20.10 -> v0.20.11
        Updating darling_macro v0.20.10 -> v0.20.11
        Updating deranged v0.3.11 -> v0.4.1
        Updating dissimilar v1.0.9 -> v1.0.10
        Updating either v1.13.0 -> v1.15.0
        Updating elsa v1.11.0 -> v1.11.2
        Updating env_logger v0.11.6 -> v0.11.7
        Updating equivalent v1.0.1 -> v1.0.2
        Updating flate2 v1.0.35 -> v1.1.0
        Updating foldhash v0.1.4 -> v0.1.5
        Updating getrandom v0.3.1 -> v0.3.2
        Updating globset v0.4.15 -> v0.4.16
     Downgrading html5ever v0.29.2 -> v0.29.1 (available: v0.30.0)
        Updating humantime v2.1.0 -> v2.2.0
        Updating icu_list_data v1.5.0 -> v1.5.1
        Updating icu_locid_transform_data v1.5.0 -> v1.5.1
        Updating icu_normalizer_data v1.5.0 -> v1.5.1
        Updating icu_properties_data v1.5.0 -> v1.5.1
        Updating indexmap v2.7.0 -> v2.8.0
        Updating indicatif v0.17.9 -> v0.17.11
        Updating inout v0.1.3 -> v0.1.4
        Updating itoa v1.0.14 -> v1.0.15
          Adding jiff v0.2.5
          Adding jiff-static v0.2.5
        Updating jobserver v0.1.32 -> v0.1.33
        Updating lexopt v0.3.0 -> v0.3.1
          Adding leb128fmt v0.1.0
        Updating libc v0.2.169 -> v0.2.171
        Updating libz-sys v1.1.21 -> v1.1.22
        Updating linux-raw-sys v0.4.15 -> v0.9.3
        Updating litemap v0.7.4 -> v0.7.5
        Updating log v0.4.25 -> v0.4.27
     Downgrading markup5ever v0.15.0 -> v0.14.1
        Updating miniz_oxide v0.8.3 -> v0.8.5
        Updating once_cell v1.20.2 -> v1.21.3
        Updating openssl-probe v0.1.5 -> v0.1.6
        Updating openssl-sys v0.9.104 -> v0.9.106
        Updating pest v2.7.15 -> v2.8.0
        Updating pest_derive v2.7.15 -> v2.8.0
        Updating pest_generator v2.7.15 -> v2.8.0
        Updating pest_meta v2.7.15 -> v2.8.0
        Updating pkg-config v0.3.31 -> v0.3.32
        Updating portable-atomic v1.10.0 -> v1.11.0
          Adding portable-atomic-util v0.2.4
        Updating ppv-lite86 v0.2.20 -> v0.2.21
        Updating proc-macro2 v1.0.93 -> v1.0.94
        Updating quote v1.0.38 -> v1.0.40
          Adding r-efi v5.2.0
        Updating rand_core v0.9.0 -> v0.9.3
        Updating redox_syscall v0.5.8 -> v0.5.10
        Updating rustc-stable-hash v0.1.1 -> v0.1.2
        Updating rustc_tools_util v0.4.0 -> v0.4.2
        Updating rustix v0.38.43 -> v1.0.5
        Updating rustversion v1.0.19 -> v1.0.20
        Updating ryu v1.0.18 -> v1.0.20
        Updating semver v1.0.24 -> v1.0.26
        Updating serde v1.0.217 -> v1.0.219
        Updating serde_derive v1.0.217 -> v1.0.219
        Updating serde_json v1.0.135 -> v1.0.140
        Updating similar v2.6.0 -> v2.7.0
        Updating smallvec v1.13.2 -> v1.14.0
        Updating socket2 v0.5.8 -> v0.5.9
        Updating stacker v0.1.18 -> v0.1.20
        Updating string_cache v0.8.8 -> v0.8.9
        Updating syn v2.0.96 -> v2.0.100
        Updating tar v0.4.43 -> v0.4.44
        Updating tempfile v3.15.0 -> v3.19.1
        Updating thin-vec v0.2.13 -> v0.2.14
        Updating thiserror v2.0.11 -> v2.0.12
        Updating thiserror-impl v2.0.11 -> v2.0.12
        Updating time v0.3.37 -> v0.3.41
        Updating time-core v0.1.2 -> v0.1.4
        Updating time-macros v0.2.19 -> v0.2.22
        Updating tinyvec v1.8.1 -> v1.9.0
        Updating tokio v1.43.0 -> v1.44.1
        Updating typenum v1.17.0 -> v1.18.0
        Updating unicode-ident v1.0.14 -> v1.0.18
        Updating uuid v1.12.0 -> v1.16.0
        Updating wasi v0.13.3+wasi-0.2.2 -> v0.14.2+wasi-0.2.4
        Removing wasm-encoder v0.219.1
        Removing wasm-encoder v0.223.0
          Adding wasm-encoder v0.219.2 (available: v0.227.1)
          Adding wasm-encoder v0.223.1
          Adding wasm-encoder v0.228.0
        Updating wasm-metadata v0.223.0 -> v0.223.1
        Removing wasmparser v0.219.1
        Removing wasmparser v0.222.0
        Removing wasmparser v0.223.0
          Adding wasmparser v0.219.2 (available: v0.227.1)
          Adding wasmparser v0.222.1
          Adding wasmparser v0.223.1
          Adding wasmparser v0.228.0
        Updating wast v223.0.0 -> v228.0.0
        Updating wat v1.223.0 -> v1.228.0
        Updating windows-core v0.52.0 -> v0.61.0
          Adding windows-implement v0.60.0
        Updating windows-interface v0.59.0 -> v0.59.1
          Adding windows-link v0.1.1
        Updating windows-result v0.3.0 -> v0.3.2
        Updating windows-strings v0.3.0 -> v0.3.1
          Adding windows-strings v0.4.0
        Updating wit-bindgen-rt v0.33.0 -> v0.39.0
        Updating wit-component v0.223.0 -> v0.223.1
        Updating wit-parser v0.223.0 -> v0.223.1
        Updating xattr v1.4.0 -> v1.5.0
        Updating zerocopy v0.8.14 -> v0.8.24
        Updating zerocopy-derive v0.8.14 -> v0.8.24
        Updating zerofrom v0.1.5 -> v0.1.6
        Updating zerofrom-derive v0.1.5 -> v0.1.6
```
2025-04-02 06:58:57 +00:00
clubby789
4c92418610 Add opt-level = "s" for more std symbolication crates 2025-04-01 20:50:19 +00:00
clubby789
23667ada6d compiler and tools dependencies
Updating anyhow v1.0.95 -> v1.0.97
    Updating basic-toml v0.1.9 -> v0.1.10
    Updating bitflags v2.8.0 -> v2.9.0
    Updating blake3 v1.5.5 -> v1.8.0
    Updating bumpalo v3.16.0 -> v3.17.0
    Removing byteorder v1.5.0
    Updating bytes v1.9.0 -> v1.10.1
    Updating cargo_metadata v0.19.1 -> v0.19.2
    Updating chrono v0.4.39 -> v0.4.40
    Updating chrono-tz v0.10.1 -> v0.10.3
    Updating chrono-tz-build v0.4.0 -> v0.4.1
    Updating clap v4.5.26 -> v4.5.35
    Updating clap_builder v4.5.26 -> v4.5.35
    Updating clap_derive v4.5.24 -> v4.5.32
    Updating console v0.15.10 -> v0.15.11
    Updating cpufeatures v0.2.16 -> v0.2.17
    Updating curl-sys v0.4.78+curl-8.11.0 -> v0.4.80+curl-8.12.1
    Updating darling v0.20.10 -> v0.20.11
    Updating darling_core v0.20.10 -> v0.20.11
    Updating darling_macro v0.20.10 -> v0.20.11
    Updating deranged v0.3.11 -> v0.4.0
    Updating dissimilar v1.0.9 -> v1.0.10
    Updating either v1.13.0 -> v1.15.0
    Updating elsa v1.11.0 -> v1.11.2
    Updating env_logger v0.11.6 -> v0.11.7
    Updating equivalent v1.0.1 -> v1.0.2
    Updating flate2 v1.0.35 -> v1.1.0
    Updating foldhash v0.1.4 -> v0.1.5
    Updating getrandom v0.3.1 -> v0.3.2
    Updating globset v0.4.15 -> v0.4.16
 Downgrading html5ever v0.29.2 -> v0.29.1 (available: v0.30.0)
    Updating humantime v2.1.0 -> v2.2.0
    Updating iana-time-zone v0.1.61 -> v0.1.63
    Updating icu_list_data v1.5.0 -> v1.5.1
    Updating icu_locid_transform_data v1.5.0 -> v1.5.1
    Updating icu_normalizer_data v1.5.0 -> v1.5.1
    Updating icu_properties_data v1.5.0 -> v1.5.1
    Updating indexmap v2.7.0 -> v2.8.0
    Updating indicatif v0.17.9 -> v0.17.11
    Updating inout v0.1.3 -> v0.1.4
    Updating itoa v1.0.14 -> v1.0.15
      Adding jiff v0.2.5
      Adding jiff-static v0.2.5
    Updating jobserver v0.1.32 -> v0.1.33
      Adding leb128fmt v0.1.0
    Updating lexopt v0.3.0 -> v0.3.1
    Updating libc v0.2.169 -> v0.2.171
    Updating libz-sys v1.1.21 -> v1.1.22
    Updating linux-raw-sys v0.4.15 -> v0.9.3
    Updating litemap v0.7.4 -> v0.7.5
    Updating log v0.4.25 -> v0.4.27
 Downgrading markup5ever v0.15.0 -> v0.14.1
    Updating miniz_oxide v0.8.3 -> v0.8.5
    Updating once_cell v1.20.2 -> v1.21.3
    Updating openssl-probe v0.1.5 -> v0.1.6
    Updating openssl-sys v0.9.104 -> v0.9.106
    Updating pest v2.7.15 -> v2.8.0
    Updating pest_derive v2.7.15 -> v2.8.0
    Updating pest_generator v2.7.15 -> v2.8.0
    Updating pest_meta v2.7.15 -> v2.8.0
    Updating pkg-config v0.3.31 -> v0.3.32
    Updating portable-atomic v1.10.0 -> v1.11.0
      Adding portable-atomic-util v0.2.4
    Updating ppv-lite86 v0.2.20 -> v0.2.21
    Updating proc-macro2 v1.0.93 -> v1.0.94
    Updating quote v1.0.38 -> v1.0.40
      Adding r-efi v5.2.0
    Updating rand_core v0.9.0 -> v0.9.3
    Updating redox_syscall v0.5.8 -> v0.5.10
    Updating rustc-stable-hash v0.1.1 -> v0.1.2
    Updating rustc_tools_util v0.4.0 -> v0.4.2
    Updating rustix v0.38.43 -> v1.0.5
    Updating rustversion v1.0.19 -> v1.0.20
    Updating ryu v1.0.18 -> v1.0.20
    Updating semver v1.0.24 -> v1.0.26
    Updating serde v1.0.217 -> v1.0.219
    Updating serde_derive v1.0.217 -> v1.0.219
    Updating serde_json v1.0.135 -> v1.0.140
    Updating similar v2.6.0 -> v2.7.0
    Updating smallvec v1.13.2 -> v1.14.0
    Updating socket2 v0.5.8 -> v0.5.9
    Updating stacker v0.1.18 -> v0.1.20
    Updating string_cache v0.8.8 -> v0.8.9
    Updating syn v2.0.96 -> v2.0.100
    Updating tar v0.4.43 -> v0.4.44
    Updating tempfile v3.15.0 -> v3.19.1
    Updating thin-vec v0.2.13 -> v0.2.14
    Updating thiserror v2.0.11 -> v2.0.12
    Updating thiserror-impl v2.0.11 -> v2.0.12
    Updating time v0.3.37 -> v0.3.41
    Updating time-core v0.1.2 -> v0.1.4
    Updating time-macros v0.2.19 -> v0.2.22
    Updating tinyvec v1.8.1 -> v1.9.0
    Updating tokio v1.43.0 -> v1.44.1
    Updating typenum v1.17.0 -> v1.18.0
    Updating unicode-ident v1.0.14 -> v1.0.18
    Updating uuid v1.12.0 -> v1.16.0
    Updating wasi v0.13.3+wasi-0.2.2 -> v0.14.2+wasi-0.2.4
    Removing wasm-encoder v0.219.1
    Removing wasm-encoder v0.223.0
      Adding wasm-encoder v0.219.2 (available: v0.228.0)
      Adding wasm-encoder v0.223.1
      Adding wasm-encoder v0.228.0
    Updating wasm-metadata v0.223.0 -> v0.223.1
    Removing wasmparser v0.219.1
    Removing wasmparser v0.222.0
    Removing wasmparser v0.223.0
      Adding wasmparser v0.219.2 (available: v0.228.0)
      Adding wasmparser v0.222.1
      Adding wasmparser v0.223.1
      Adding wasmparser v0.228.0
    Updating wast v223.0.0 -> v228.0.0
    Updating wat v1.223.0 -> v1.228.0
    Updating windows-core v0.52.0 -> v0.61.0
      Adding windows-implement v0.60.0
    Updating windows-interface v0.59.0 -> v0.59.1
      Adding windows-link v0.1.1
    Updating windows-result v0.3.0 -> v0.3.2
    Removing windows-strings v0.3.0
      Adding windows-strings v0.3.1
      Adding windows-strings v0.4.0
    Updating wit-bindgen-rt v0.33.0 -> v0.39.0
    Updating wit-component v0.223.0 -> v0.223.1
    Updating wit-parser v0.223.0 -> v0.223.1
    Updating xattr v1.4.0 -> v1.5.0
    Removing zerocopy v0.7.35
    Removing zerocopy v0.8.14
      Adding zerocopy v0.8.24
    Removing zerocopy-derive v0.7.35
    Removing zerocopy-derive v0.8.14
      Adding zerocopy-derive v0.8.24
    Updating zerofrom v0.1.5 -> v0.1.6
    Updating zerofrom-derive v0.1.5 -> v0.1.6

library dependencies
    Updating dlmalloc v0.2.7 -> v0.2.8
    Updating miniz_oxide v0.8.3 -> v0.8.5
    Updating proc-macro2 v1.0.93 -> v1.0.94
    Updating quote v1.0.38 -> v1.0.40
    Updating rand_core v0.9.0 -> v0.9.3
    Updating syn v2.0.98 -> v2.0.100
    Updating unicode-ident v1.0.16 -> v1.0.18
    Updating zerocopy v0.8.17 -> v0.8.24
    Updating zerocopy-derive v0.8.17 -> v0.8.24

rustbook dependencies
    Updating anyhow v1.0.95 -> v1.0.97
    Updating bitflags v2.8.0 -> v2.9.0
    Removing byteorder v1.5.0
    Updating cc v1.2.10 -> v1.2.17
    Updating chrono v0.4.39 -> v0.4.40
    Updating clap v4.5.27 -> v4.5.32
    Updating clap_builder v4.5.27 -> v4.5.32
    Updating clap_complete v4.5.43 -> v4.5.47
    Updating clap_derive v4.5.24 -> v4.5.32
    Updating env_logger v0.11.6 -> v0.11.7
    Updating equivalent v1.0.1 -> v1.0.2
    Updating flate2 v1.0.35 -> v1.1.0
    Updating getrandom v0.2.15 -> v0.3.2
    Updating handlebars v6.3.0 -> v6.3.2
    Removing humantime v2.1.0
    Updating indexmap v2.7.1 -> v2.8.0
    Updating itoa v1.0.14 -> v1.0.15
      Adding jiff v0.2.5
      Adding jiff-static v0.2.5
    Updating libc v0.2.169 -> v0.2.171
    Updating linux-raw-sys v0.4.15 -> v0.9.3
    Updating litemap v0.7.4 -> v0.7.5
    Updating log v0.4.25 -> v0.4.26
    Updating mdbook-i18n-helpers v0.3.5 -> v0.3.6
    Updating miniz_oxide v0.8.3 -> v0.8.5
    Updating once_cell v1.20.2 -> v1.21.1
    Removing phf_generator v0.10.0
    Removing phf_shared v0.10.0
    Updating pkg-config v0.3.31 -> v0.3.32
      Adding portable-atomic v1.11.0
      Adding portable-atomic-util v0.2.4
    Removing ppv-lite86 v0.2.20
    Updating proc-macro2 v1.0.93 -> v1.0.94
    Removing pulldown-cmark v0.11.3
    Updating pulldown-cmark-to-cmark v15.0.1 -> v20.0.1
    Updating quote v1.0.38 -> v1.0.40
      Adding r-efi v5.2.0
    Removing rand_chacha v0.3.1
    Updating redox_syscall v0.5.8 -> v0.5.10
    Updating rustix v0.38.44 -> v1.0.3
    Updating rustversion v1.0.19 -> v1.0.20
    Updating ryu v1.0.19 -> v1.0.20
    Updating semver v1.0.25 -> v1.0.26
    Updating serde v1.0.217 -> v1.0.219
    Updating serde_derive v1.0.217 -> v1.0.219
    Updating serde_json v1.0.138 -> v1.0.140
    Removing siphasher v0.3.11
    Updating smallvec v1.13.2 -> v1.14.0
    Updating string_cache v0.8.7 -> v0.8.8
    Updating string_cache_codegen v0.5.2 -> v0.5.4
    Updating syn v2.0.96 -> v2.0.100
    Updating tempfile v3.15.0 -> v3.19.1
    Updating terminal_size v0.4.1 -> v0.4.2
    Updating textwrap v0.16.1 -> v0.16.2
    Updating thiserror v2.0.11 -> v2.0.12
    Updating thiserror-impl v2.0.11 -> v2.0.12
    Updating toml v0.8.19 -> v0.8.20
    Updating toml_edit v0.22.22 -> v0.22.24
    Updating typenum v1.17.0 -> v1.18.0
    Updating unicode-ident v1.0.16 -> v1.0.18
    Updating wasi v0.11.0+wasi-snapshot-preview1 -> v0.14.2+wasi-0.2.4
      Adding windows-link v0.1.1
    Updating winnow v0.6.25 -> v0.7.4
      Adding wit-bindgen-rt v0.39.0
    Removing zerocopy v0.7.35
    Removing zerocopy-derive v0.7.35
    Updating zerofrom v0.1.5 -> v0.1.6
    Updating zerofrom-derive v0.1.5 -> v0.1.6
2025-04-01 20:48:17 +00:00