Skip to content

splat-fn-ptr-ptr-tuple.rs: add let to avoid UB - #161403

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
TimNN:splat-ub
Aug 21, 2026
Merged

splat-fn-ptr-ptr-tuple.rs: add let to avoid UB#161403
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
TimNN:splat-ub

Conversation

@TimNN

@TimNN TimNN commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #161323.

Miri previously reported UB when running this test, and LLVM 24 treated it as UB.

r? @teor2345

I'm not sure what exactly is getting tested here, but based on your comment on the issue I assume that moving these to a let binding is fine.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 20, 2026
@rustbot

rustbot commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Error: Failed to set assignee to teor2345: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@TimNN

TimNN commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot reroll

@teor2345

Copy link
Copy Markdown
Contributor

This test makes sure that rustc doesn't panic when compiling splats within function pointers, see #158603. It also tests the codegen correctly tuples the caller's arguments.

//! Test using `#[rustc_splat]` on tuple arguments of pointers to pointers to simple functions.

I have to comment before anyone can assign me, that should hopefully be fixed soon. But I can't approve for merge, so you'll need someone else to review it anyway.

@rustbot label +F-splat

@rustbot rustbot added the F-splat `#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629 label Aug 20, 2026

@teor2345 teor2345 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

This adds a simple extra binding, to stop the casted function pointer being dropped before use.

View changes since this review

@fee1-dead

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 9da8a55 has been approved by fee1-dead

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 21, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 21, 2026
splat-fn-ptr-ptr-tuple.rs: add `let` to avoid UB

Fixes rust-lang#161323.

Miri previously reported UB when running this test, and LLVM 24 treated it as UB.

r? @teor2345

I'm not sure what _exactly_ is getting tested here, but based on your comment on the issue I assume that moving these to a `let` binding is fine.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 21, 2026
splat-fn-ptr-ptr-tuple.rs: add `let` to avoid UB

Fixes rust-lang#161323.

Miri previously reported UB when running this test, and LLVM 24 treated it as UB.

r? @teor2345

I'm not sure what _exactly_ is getting tested here, but based on your comment on the issue I assume that moving these to a `let` binding is fine.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 21, 2026
splat-fn-ptr-ptr-tuple.rs: add `let` to avoid UB

Fixes rust-lang#161323.

Miri previously reported UB when running this test, and LLVM 24 treated it as UB.

r? @teor2345

I'm not sure what _exactly_ is getting tested here, but based on your comment on the issue I assume that moving these to a `let` binding is fine.
rust-bors Bot pushed a commit that referenced this pull request Aug 21, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #161259 (move some attribute related structs out of rustc_attr_ir)
 - #160853 (delegation: simplify matches on `FnKind`, minor refactorings)
 - #159899 ( `GenericArgs::types` triage + possible fixes)
 - #160459 (Use attribute parser for `deprecated` attribute checking)
 - #160813 (Optimize linked list iterator performance)
 - #161271 (doc: document safety requirements for core WTF-8)
 - #161317 (LLVM 24: configure float-abi via module flag)
 - #161320 (Only suggest `RUST_MIN_STACK` if maybe stack overflow)
 - #161369 (Add regression test for confusing lifetime error message issue)
 - #161393 (Configure LLM policy URL for triagebot)
 - #161403 (splat-fn-ptr-ptr-tuple.rs: add `let` to avoid UB)
 - #161409 (Add back `tests/rustdoc-gui/notable-trait.goml` test)
 - #161410 (Fix rustdoc remapping `documentation` scope documentation)
 - #161415 (Update expect messages in path docs to better follow guidelines)
 - #161438 (Change triagebot backport to ping T-libs-fcp)
 - #161442 (Add regression test for dead code on type alias used in impl self type)

Failed merges:

 - #160509 (Remove `RegionExt`; move methods to `Region` in `rustc_type_ir`)
rust-bors Bot pushed a commit that referenced this pull request Aug 21, 2026
Rollup of 20 pull requests

Successful merges:

 - #161259 (move some attribute related structs out of rustc_attr_ir)
 - #160853 (delegation: simplify matches on `FnKind`, minor refactorings)
 - #161161 (proc_macro: add support for 16-bit targets)
 - #159899 ( `GenericArgs::types` triage + possible fixes)
 - #160459 (Use attribute parser for `deprecated` attribute checking)
 - #160536 (Inline `String::into_raw_parts` and reuse `from_utf16` optimization)
 - #160563 (Make `BorrowedCursor<'a, T>` covariant in `'a` and drop an indirection)
 - #160595 (Clarify `str::split_at` docs)
 - #160813 (Optimize linked list iterator performance)
 - #161271 (doc: document safety requirements for core WTF-8)
 - #161317 (LLVM 24: configure float-abi via module flag)
 - #161320 (Only suggest `RUST_MIN_STACK` if maybe stack overflow)
 - #161369 (Add regression test for confusing lifetime error message issue)
 - #161393 (Configure LLM policy URL for triagebot)
 - #161403 (splat-fn-ptr-ptr-tuple.rs: add `let` to avoid UB)
 - #161409 (Add back `tests/rustdoc-gui/notable-trait.goml` test)
 - #161410 (Fix rustdoc remapping `documentation` scope documentation)
 - #161415 (Update expect messages in path docs to better follow guidelines)
 - #161438 (Change triagebot backport to ping T-libs-fcp)
 - #161442 (Add regression test for dead code on type alias used in impl self type)

Failed merges:

 - #160509 (Remove `RegionExt`; move methods to `Region` in `rustc_type_ir`)
@rust-bors
rust-bors Bot merged commit c258e82 into rust-lang:main Aug 21, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 21, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 21, 2026
Rollup merge of #161403 - TimNN:splat-ub, r=fee1-dead

splat-fn-ptr-ptr-tuple.rs: add `let` to avoid UB

Fixes #161323.

Miri previously reported UB when running this test, and LLVM 24 treated it as UB.

r? @teor2345

I'm not sure what _exactly_ is getting tested here, but based on your comment on the issue I assume that moving these to a `let` binding is fine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-splat `#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629 S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

splat-fn-ptr-ptr-tuple.rs fails under miri and crashes under LLVM 24

4 participants