Skip to content

Rustc pull update #2508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 140 commits into from
Jul 17, 2025
Merged

Rustc pull update #2508

merged 140 commits into from
Jul 17, 2025

Conversation

github-actions[bot]
Copy link

Latest update from rustc.

The Miri Cronjob Bot and others added 30 commits May 10, 2025 05:01
Add more comments to libc-fs-with-isolation test
test direct usage of io::{stdout,stderr,stdin}
FileDescription: improve read/write docs
TB: Track permissions on the byte-level
native-lib: allow multiple libraries and/or dirs
use File::lock to implement flock, and add a test for File::lock
TB: Add flag to disable the more precise interior mutability tracking
test_dup: ensure the FDs remain in sync even after dup'ing
native_lib: skip to next .so if function was in dependency of the first
diagnostics: do not repeat the entire message in the span label
bors and others added 24 commits July 14, 2025 19:53
Clippy subtree update

r? `@Manishearth`

Cargo.lock update due to `ui_test` bump and restructure.
core: Add `BorrowedCursor::with_unfilled_buf`

Implementation of rust-lang/libs-team#367.

This mainly adds `BorrowedCursor::with_unfilled_buf`, with enables using the unfilled part of a cursor as a `BorrowedBuf`.

Note that unlike the ACP, `BorrowedCursor::unfilled_buf` was moved to a `From` conversion. This is more consistent with other ways of creating a `BorrowedBuf` and hides a bit this conversion that requires unsafe code to be used correctly.

Cc rust-lang/rust#78485 rust-lang/rust#117693
Drop `./x suggest`

This PR removes the current `./x suggest` implementation (rust-lang/rust#109933, rust-lang/rust#106249) and associated docs for several reasons:

1. Primarily, `./x suggest` is another "flow" in bootstrap that incurs extra complexity and more invariants that bootstrap has to maintain. This causes more friction when trying to investigate and fix staging problems. As far as I know, this flow has not been actively maintained in quite a while, and I'm not aware of interest in maintaining it. Bootstrap really could use less implementation complexity with a very limited maintenance bandwidth.
2. The current `./x suggest` implementation "bypasses" the usual stage defaults for the various check/build/test/etc. flows, and it's not really possible to have a stage default because `./x suggest --run` produces a *sequence* of suggestions like [`./x check`, `./x test library/std`, ..] and then tries to run all of them in sequence, based on which files are modified.
3. We've not seen a lot of interest both in using it or extending static/dynamic test suggestions. Last extensions were rust-lang/rust#117961 and rust-lang/rust#120763. I'm not convinced the extra implementation complexity is worth it. This was discussed in:
    - [#t-infra/bootstrap > Dropping the current `./x suggest` flow implementation](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Dropping.20the.20current.20.60.2E.2Fx.20suggest.60.20flow.20implementation/with/527456699)
    - [#t-compiler > Dropping current `./x suggest` implementation](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Dropping.20current.20.60.2E.2Fx.20suggest.60.20implementation/with/527528696)

Closes rust-lang/rust#109933 (the current implementation is being removed).
Closes rust-lang/rust#143569 (by removing `./x suggest` altogether).
Give all bytes of TypeId provenance

This makes all bytes of TypeId uninspectable at compile-time.

For context see rust-lang/rust#77125 (comment)

r? ``@RalfJung``
Don't panic if WASI_SDK_PATH not set when detecting compiler

The fedora packaging builds the wasm sysroot outside of the rust build system. Fedora applies a couple of patches related to wasm which I think make this possible. Not panicking seems consistent with the detection logic of other targets when they cannot find cc.
Adjust `run_make_support::symbols` helpers

Massage the `symbols` helpers to fill out {match all, match any} x {substring match, exact match}:

|           | Substring match                        | Exact match                   |
|-----------|----------------------------------------|-------------------------------|
| Match any | `object_contains_any_symbol_substring` | `object_contains_any_symbol`  |
| Match all | `object_contains_all_symbol_substring` | `object_contains_all_symbols` |

As I'd like to use `object_contains_all_symbols` for rust-lang/rust#143669.

As part of this:

- Rename `any_symbol_contains` to `object_contains_any_symbol_substring` for accuracy, as `any_symbol_contains` is actually "contains any matching substring".
- Remove `with_symbol_iter`.

Noticed while working on rust-lang/rust#143669.

r? ``@ChrisDenton`` (or compiler)
Port `#[pointee]` to the new attribute parsing infrastructure

Ports `#[pointee]` to the new attribute parsing infrastructure for rust-lang/rust#131229 (comment)

r? ``@jdonszelmann``
Recover and suggest to use `;` to construct array type

Fixes rust-lang/rust#143828

r? compiler
…rk-Simulacrum

core: make `str::split_at_unchecked()` inline

This PR adds `#[inline]` to the method `str::split_at_unchecked()`. This is done for two reasons:

1. The method is tiny, e.g. on AMD-64 (<https://godbolt.org/z/ba68fdfxn>):

   ```asm
   movq    %rdi, %rax
   subq    %rcx, %rdx
   movq    %rsi, (%rdi)
   addq    %rcx, %rsi
   movq    %rcx, 8(%rdi)
   movq    %rsi, 16(%rdi)
   movq    %rdx, 24(%rdi)
   retq
   ```

2. More importantly, inlining the method enables further automatic optimizations. E.g. if you split at index 3, then in the compiler (rustc, llvm or both) knows that this code cannot fail, and the panicking path is omitted in the generated code:

   ```rust
   pub fn punctuation(i: &str) -> Result<(), ()> {
       const THREE_CHARS: &[[u8; 3]] = &[*b"<<=", *b">>=", *b"...", *b"..="];

       if let Some((head, _)) = i.split_at_checked(3)
           && THREE_CHARS.contains(&head.as_bytes().try_into().unwrap())
       {
           Ok(())
       } else {
           Err(())
       }
   }
   ```

   <details>
   <summary>Without PR</summary>

   <https://play.rust-lang.org/?version=stable&mode=release&edition=2024&gist=0234de8158f467eebd73286f20d6e27a>

   ```asm
   playground::punctuation:
           subq    $40, %rsp
           movq    %rsi, %rdx
           movq    %rdi, %rsi
           movb    $1, %al
           cmpq    $3, %rdx
           ja      .LBB2_2
           je      .LBB2_3
   .LBB2_11:
           addq    $40, %rsp
           retq
   .LBB2_2:
           cmpb    $-64, 3(%rsi)
           jl      .LBB2_11
   .LBB2_3:
           leaq    8(%rsp), %rdi
           movl    $3, %ecx
           callq   *core::str::<impl str>::split_at_unchecked@GOTPCREL(%rip)
           movq    8(%rsp), %rcx
           movb    $1, %al
           testq   %rcx, %rcx
           je      .LBB2_11
           cmpq    $3, 16(%rsp)
           jne     .LBB2_12
           movzwl  (%rcx), %edx
           movzbl  2(%rcx), %ecx
           shll    $16, %ecx
           orl     %edx, %ecx
           cmpl    $4013115, %ecx
           jg      .LBB2_8
           cmpl    $3026478, %ecx
           je      .LBB2_10
           cmpl    $4009518, %ecx
           je      .LBB2_10
           jmp     .LBB2_11
   .LBB2_8:
           cmpl    $4013630, %ecx
           je      .LBB2_10
           cmpl    $4013116, %ecx
           jne     .LBB2_11
   .LBB2_10:
           xorl    %eax, %eax
           addq    $40, %rsp
           retq
   .LBB2_12:
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.2(%rip), %rdi
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.1(%rip), %rcx
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.6(%rip), %r8
           leaq    7(%rsp), %rdx
           movl    $43, %esi
           callq   *core::result::unwrap_failed@GOTPCREL(%rip)
   ```
   </details>

   <details>
   <summary>With PR</summary>

   <https://play.rust-lang.org/?version=stable&mode=release&edition=2024&gist=5d4058c79ce0f6cb1a434190427d2055>

   ```asm
   playground::punctuation:
           movb    $1, %al
           cmpq    $3, %rsi
           ja      .LBB0_2
           je      .LBB0_3
   .LBB0_9:
           retq
   .LBB0_2:
           cmpb    $-64, 3(%rdi)
           jl      .LBB0_9
   .LBB0_3:
           movzwl  (%rdi), %eax
           movzbl  2(%rdi), %ecx
           shll    $16, %ecx
           orl     %eax, %ecx
           movb    $1, %al
           cmpl    $4013115, %ecx
           jg      .LBB0_6
           cmpl    $3026478, %ecx
           je      .LBB0_8
           cmpl    $4009518, %ecx
           je      .LBB0_8
           jmp     .LBB0_9
   .LBB0_6:
           cmpl    $4013630, %ecx
           je      .LBB0_8
           cmpl    $4013116, %ecx
           jne     .LBB0_9
   .LBB0_8:
           xorl    %eax, %eax
           retq
   ```
   </details>
Add experimental `backtrace-trace-only` std feature

This experimentally allows building std with backtrace but without symbolisation. It does not affect stable and requires build-std to use. This doesn't change the backtrace crate itself so relies on the optimizer to remove the unused parts.

Example usage:

```toml
# .cargo/config.toml
[unstable]
build-std = ["core", "alloc", "panic_unwind", "std"]
build-std-features = ["backtrace", "backtrace-trace-only", "panic-unwind"]
```

```toml
# Cargo.toml
[profile.release]
opt-level = 3
lto = "thin"
codegen-units = 1
```

Ideally we should split the backtrace feature into `backtrace-trace` and `backtrace-symbolize` (with the latter dependent on the former) because Cargo features tend to work better when they're positive rather than negative. But I'm keen for this experiment not to break existing users.

cc ``@joshtriplett``
Preserve constness in trait objects up to hir ty lowering

r? ``@compiler-errors``

While we don't support `dyn const Trait`, we can at least also inform the user that `const Trait` is only legal for `#[const_trait] trait Trait {}`
rustc_type_ir/walk: move docstring to `TypeWalker` itself

having it on the impl block is a bit weird imo
Update books

## rust-lang/book

3 commits in ef1ce8f87a8b18feb1b6a9cf9a4939a79bde6795..b2d1a0821e12a676b496d61891b8e3d374a8e832
2025-07-08 17:24:41 UTC to 2025-07-02 21:30:57 UTC

- Chapter 16 from tech review (rust-lang/book#4438)
- WIP ch 17 edits after tech review (rust-lang/book#4319)
- Chapter 15 from tech review (rust-lang/book#4433)

## rust-embedded/book

1 commits in 41f688a598a5022b749e23d37f3c524f6a0b28e1..fe88fbb68391a465680dd91109f0a151a1676f3e
2025-07-08 18:54:25 UTC to 2025-07-08 18:54:25 UTC

- Clarify usage of #[interrupt] attribute and recommend device crate re… (rust-embedded/book#386)

## rust-lang/nomicon

3 commits in 8b61acfaea822e9ac926190bc8f15791c33336e8..3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15
2025-07-05 07:34:22 UTC to 2025-07-05 07:13:51 UTC

- Add build script part to FFI chapter for more clear and smooth learn … (rust-lang/nomicon#440)
- Cleanups for tree example of splitting borrows (rust-lang/nomicon#443)
- Handle drop zst (rust-lang/nomicon#425)

## rust-lang/reference

17 commits in e9fc99f107840813916f62e16b3f6d9556e1f2d8..1f45bd41fa6c17b7c048ed6bfe5f168c4311206a
2025-07-11 23:15:51 UTC to 2025-07-01 16:49:33 UTC

- mention an important use for the naked attribute (rust-lang/reference#1929)
- Array expression repeat operands can be const blocks. (rust-lang/reference#1928)
- Document (tuple) struct pattern namespace behavior (rust-lang/reference#1925)
- Replace set of en dashes with set of em dashes (rust-lang/reference#1926)
- Update `should_panic` to use the attribute template (rust-lang/reference#1882)
- const-eval.const-expr.borrows: mention indirect places (rust-lang/reference#1865)
- associated-items.md: remove redundant word (rust-lang/reference#1874)
- introduction.md: replace hard-to-read example (rust-lang/reference#1873)
- typo (rust-lang/reference#1924)
- Update `ignore` to use the attribute template (rust-lang/reference#1881)
- Update `test` to use the attribute template (rust-lang/reference#1880)
- Update `cfg_attr` to use the attribute template (rust-lang/reference#1879)
- Update `cfg` to use the attribute template (rust-lang/reference#1878)
- allow constants to refer to mutable/external memory, but reject such constants as patterns (rust-lang/reference#1859)
- Remove outdated comment about non-copy unions (rust-lang/reference#1872)
- Add a template for documenting attributes (rust-lang/reference#1877)
- Switch enum grammar to use "variant" (rust-lang/reference#1876)

## rust-lang/rust-by-example

1 commits in 288b4e4948add43f387cad35adc7b1c54ca6fe12..e386be5f44af711854207c11fdd61bb576270b04
2025-07-04 23:17:15 UTC to 2025-07-04 23:17:15 UTC

- Update Chinese translations (rust-lang/rust-by-example#1943)
update `cfg_select!` documentation

tracking issue: rust-lang/rust#115585

After rust-lang/rust#143461, and with an eye on a soon(ish) stabilization, I think the docs need some work.

The existing text read more like a motivation for the feature existing to me, so I've tried to now be a bit more descriptive. Still, suggestions are very welcome.

I also added a test for an empty `select! {}` because it's just the sort of thing that might break.

r? ``@traviscross``
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#142301 (tests: Fix duplicated-path-in-error fail with musl)
 - rust-lang/rust#143630 (Drop `./x suggest`)
 - rust-lang/rust#143736 (Give all bytes of TypeId provenance)
 - rust-lang/rust#143752 (Don't panic if WASI_SDK_PATH not set when detecting compiler)
 - rust-lang/rust#143837 (Adjust `run_make_support::symbols` helpers)
 - rust-lang/rust#143878 (Port `#[pointee]` to the new attribute parsing infrastructure)
 - rust-lang/rust#143905 (Recover and suggest to use `;` to construct array type)
 - rust-lang/rust#143907 (core: make `str::split_at_unchecked()` inline)
 - rust-lang/rust#143910 (Add experimental `backtrace-trace-only` std feature)
 - rust-lang/rust#143927 (Preserve constness in trait objects up to hir ty lowering)
 - rust-lang/rust#143935 (rustc_type_ir/walk: move docstring to `TypeWalker` itself)
 - rust-lang/rust#143938 (Update books)
 - rust-lang/rust#143941 (update `cfg_select!` documentation)

Failed merges:

 - rust-lang/rust#143926 (Remove deprecated fields in bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
Add tracing spans to borrow tracker functions
`std::vec`: Add UB check for `set_len`, `from_raw_parts_in`, and etc.

Closes rust-lang/rust#143813

I noticed that `from_parts_in` do the similar things like `from_raw_parts_in`, so I add the UB check in the last commit. If it is not appropriate, I will remove it.

And I fix a typo in the first commit.

r? `@scottmcm`
This updates the rust-version file to fd2eb391d032181459773f3498c17b198513e0d0.
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: fd2eb391d032181459773f3498c17b198513e0d0
Filtered ref: 1ea8d5f

This merge was created using https://github.com/rust-lang/josh-sync.
@rustbot
Copy link
Collaborator

rustbot commented Jul 17, 2025

Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using r? rustc-dev-guide or r? <username>.

@rustbot rustbot added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Jul 17, 2025
@rustbot rustbot closed this Jul 17, 2025
@rustbot rustbot reopened this Jul 17, 2025
@rustbot rustbot removed the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Jul 17, 2025
@tshepang tshepang merged commit 809650a into master Jul 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.