Skip to content

Rollup of 8 pull requests - #161311

Closed
JonathanBrouwer wants to merge 23 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-gb0AoFz
Closed

Rollup of 8 pull requests#161311
JonathanBrouwer wants to merge 23 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-gb0AoFz

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

Embers-of-the-Fire and others added 23 commits May 21, 2026 15:14
Signed-off-by: Embers-of-the-Fire <stellarishs@163.com>
Add focused Miri coverage for the if-let closure capture change, demonstrating UB at closure construction when partial pattern capture reborrows dangling references.

Assisted-by: OpenAI:gpt-5.5
Signed-off-by: Embers-of-the-Fire <stellarishs@163.com>
… orphan check

`emit_orphan_check_error` already special-cases non-local types that
appear in a foreign trait's own parameter position (as opposed to
Self): for Slice, Array, and Tuple, the label reads "this is
not defined in the current crate because this is a foreign trait"
instead of naming the type. The Adt arm and the primitive/catch-all
arm never checked this and always named the type instead, even in the
same non-Self position.

This produced a confusing diagnostic for impls like

    impl PartialEq for u32 {}

where Rhs defaults to Self (u32), so both the Self label and
the Rhs label read `u32` is not defined in the current crate,
with the second one visually landing under PartialEq since the
defaulted Rhs has no span of its own.

Extend the existing is_foreign check to the Adt and catch-all arms
so all four cases behave consistently.

Addresses rust-lang#160648
This was already possible via `./x fix -- --allow-dirty`, but forwarding the
argument from bootstrap is more user-friendly.
This commit is an initial implementation of the `FnPtr` trait as
described in the `fn_static` tracking issue, which consists of moving
the internally unstable `core::marker::FnPtr` to `core::ops::FnPtr`, as
well as changing the API. Because `NonNull` is used in the new `as_ptr`
signature, it was also turned into a proper lang item.
…full-capture, r=Nadrieril

fix: fix the capture behavior of `if let` in closures

Closes rust-lang#153982.
**TL;DR** This patch adds the missing capture behavior change for `if let` statements introduced in RFC 2229.

This patch converts
```rust
self.walk_local(init, pat, None, || self.borrow_expr(init, BorrowKind::Immutable))?;
```
into
```rust
self.walk_local(init, pat, None, || Ok(()))?;
```
so that `if let` now behaves like `let`.
…=jackh726

Initial implementation of `FnPtr` trait

This commit is an initial implementation of the `FnPtr` trait as described in the `fn_static` tracking issue, which consists of moving the internally unstable `core::marker::FnPtr` to `core::ops::FnPtr`, as well as changing the API. Because `NonNull` is used in the new `as_ptr` signature, it was also turned into a proper lang item.

Part of `fn_static`: rust-lang#148768
…x, r=petrochenkov

Unify E0117 foreign-trait label for ADT/primitive types with existing Slice/Array/Tuple handling

### What this does

`emit_orphan_check_error` (in `compiler/rustc_hir_analysis/src/coherence/orphan.rs`) already has an `is_foreign` flag, true whenever a non-local type sits in one of the *trait's own* parameter positions rather than `Self`. The `Slice`, `Array`, and `Tuple` arms already use it to switch their label to a generic "this is not defined in the current crate because this is a foreign trait" message instead of naming the type. The `Adt` arm and the catch-all `_` arm (covering primitives) never checked `is_foreign` and always named the type, even in the same non-Self position.

This PR extends the same `is_foreign` branch to those two arms, so all four are consistent. No new types or subdiagnostics reuses the existing `OnlyCurrentTraitsForeign` struct already used a few lines above.

LLM use :
I used LLM to explore the project and find where code that tags labels

### Before / after

```rust
impl PartialEq for u32 {
    fn eq(&self, _other: &Self) -> bool { todo!() }
}
```
Before :
```Plaintext
   |      |             `u32` is not defined in the current crate
   |      `u32` is not defined in the current crate
```

After :
```Plaintext
   |      |       `u32` is not defined in the current crate
   |      this is not defined in the current crate because this is a foreign trait
```
Addresses rust-lang#160648

r? compiler
…ejrs

Adding diagnostic item markers for multiple fs functions and structs

A couple months ago there were a good number of TOCTOU/other filesystem lint issues created by @estebank in the clippy repo such as:

* [`Path::metdata` after `Path::exists`](rust-lang/rust-clippy#17158)
* [opening multiple files under a directory without using `open_at`](rust-lang/rust-clippy#17156)
* [File deletion followed by file creation](rust-lang/rust-clippy#17153)
* [File path comparison without canonicalizing](rust-lang/rust-clippy#17155)
* [File creation followed by setting permissions](rust-lang/rust-clippy#17154)

(There are more TOCTOU/filesystem bug lints that could be made aside from the list above, e.g. with symlinks).

I was particularly interested in working on the last issue on file creation followed by setting permissions. However, I don't think I could start working on it without diagnostic items on filesystem functions like `fs::set_permissions` or `fs::create_dir_all`. I decided to put diagnostic item attributes on all the filesystem functions and a couple of the structs because they may be useful in creating clippy lints against TOCTOU bugs or other relevant filesystem operation bugs.
bootstrap: Allow `./x fix --allow-dirty`

- Extracted from rust-lang#160417, as `./x fix compiler` was fixed separately.
---

This PR forwards `--allow-dirty` from bootstrap to cargo, making `./x fix` more convenient.

This was already possible via `./x fix -- --allow-dirty`, but forwarding the argument from bootstrap is more user-friendly.

r? Kobzol (or bootstrap)
Rename `ProjectionPredicate` and `TraitPredicate`

Part of rust-lang#107250

This deviates from the plan I described in rust-lang#107250 (comment). The reason is that I kept getting into the awkward situation where I would go into a function dealing with multiple predicate/clause kinds, and need to rename only the variables referring with the particular kind I was renaming. So now, the plan is to first rename only the types (this PR), and afterwards go into functions and rename all the variables in them at once. That would also allow splitting the work better, e.g. tackling one crate/subtree at a time.

r? @oli-obk
…ks, r=petrochenkov

Enable overflow checks in `rustc_thread_pool`

For CI run, maybe it will work (it seems like it worked).

Fixes rust-lang#90227.

r? @petrochenkov
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Aug 18, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows PG-exploit-mitigations Project group: Exploit mitigations labels Aug 18, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Aug 18, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors r+ p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple-1,aarch64-apple-2,x86_64-mingw-1,i686-msvc-1,i686-msvc-2

@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 44e28d9 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 18, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 18, 2026
Rollup of 8 pull requests


try-job: dist-various-1
try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple-1
try-job: aarch64-apple-2
try-job: x86_64-mingw-1
try-job: i686-msvc-1
try-job: i686-msvc-2
@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

⌛ Testing commit 44e28d9 with merge 3762736...

Workflow: https://github.com/rust-lang/rust/actions/runs/32164451005

rust-bors Bot pushed a commit that referenced this pull request Aug 18, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #154210 (fix: fix the capture behavior of `if let` in closures)
 - #156176 (Initial implementation of `FnPtr` trait)
 - #160767 (Unify E0117 foreign-trait label for ADT/primitive types with existing Slice/Array/Tuple handling)
 - #160489 (Adding diagnostic item markers for multiple fs functions and structs)
 - #161220 (bootstrap: Allow `./x fix --allow-dirty`)
 - #161291 (Rename `ProjectionPredicate` and `TraitPredicate`)
 - #161296 (Enable overflow checks in `rustc_thread_pool`)
 - #161304 (Rename test so it matches the issue)
@cuviper

cuviper commented Aug 18, 2026

Copy link
Copy Markdown
Member

@bors yield Yield priority to the stable release.

@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #161313.

@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 746fcbb (746fcbbc4a8356ef4d0ae1e3ca7401788d28b579)
Base parent: e71c0f1 (e71c0f1e3395b10a8c331317be1a5c107bdf7b2e)

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 18, 2026
@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved due to being closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows PG-exploit-mitigations Project group: Exploit mitigations rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants