Skip to content

Implement or fix a bunch of unsafe binders things - #163515

Draft
jackh726 wants to merge 30 commits into
rust-lang:mainfrom
jackh726:unsafe-binders-impl
Draft

jackh726 wants to merge 30 commits into
rust-lang:mainfrom
jackh726:unsafe-binders-impl

Conversation

@jackh726

@jackh726 jackh726 commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Supersedes #153458, #156373, #154524, #158856

First test adds many tests covering (expected) implementation behavior of unsafe binders. Many of these need further design discussion, but the point here is to figure out some behavior that we can pin an implementation to for testing.

Remaining commits fix broken tests one by one (mostly), and should be fairly independent.

@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 29, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/unsafe-binder-arguments.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/unsafe-binder-arguments.rs:12:11: error: CHECK: expected string not found in input
// CHECK: define noundef nonnull ptr @bare(ptr noundef nonnull %x)
          ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/unsafe-binder-arguments/unsafe-binder-arguments.ll:1:1: note: scanning from here
; ModuleID = 'unsafe_binder_arguments.9c7560d2fb88559c-cgu.0'
^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/unsafe-binder-arguments/unsafe-binder-arguments.ll:7:11: note: possible intended match here
define dso_local noundef nonnull ptr @bare(ptr noundef nonnull %x) unnamed_addr #0 !guid !1 {
          ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/unsafe-binder-arguments/unsafe-binder-arguments.ll
Check file: /checkout/tests/codegen-llvm/unsafe-binder-arguments.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: ; ModuleID = 'unsafe_binder_arguments.9c7560d2fb88559c-cgu.0' 
check:12'0    {                                                                search range start (exclusive)
check:12'1                                                                     error: no match found in search range
            2: source_filename = "unsafe_binder_arguments.9c7560d2fb88559c-cgu.0" 
            3: target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20" 
            4: target triple = "wasm32-unknown-wasip1" 
            5:  
            6: ; Function Attrs: nounwind 
            7: define dso_local noundef nonnull ptr @bare(ptr noundef nonnull %x) unnamed_addr #0 !guid !1 { 
check:12'2               ?                                                                                     possible intended match
            8: start: 
            9:  ret ptr %x 
           10: } 
           11:  
           12: ; Function Attrs: nounwind 
           13: define dso_local void @bare_mut(ptr noundef nonnull %_x) unnamed_addr #0 !guid !2 { 
           14: start: 
           15:  ret void 
           16: } 
           17:  
           18: ; Function Attrs: nounwind 
           19: define dso_local void @pair(ptr noalias nofree noundef readonly align 4 captures(address, read_provenance) dereferenceable(4) %_x.0, ptr noalias nofree noundef readonly align 8 captures(address, read_provenance) dereferenceable(8) %_x.1) unnamed_addr #0 !guid !3 { 
           20: start: 
           21:  ret void 
           22: } 
           23:  
           24: attributes #0 = { nounwind "target-cpu"="generic" } 
           25:  
           26: !llvm.ident = !{!0} 
           27:  
           28: !0 = !{!"rustc version 1.101.0-nightly (8a601c4b9 2026-09-29)"} 
           29: !1 = !{i64 -6384715683809327994} 
           30: !2 = !{i64 8387859167154692804} 
           31: !3 = !{i64 4859215404959254835} 
check:12'3                                     } search range end (exclusive)
>>>>>>

------------------------------------------

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/unsafe-binder-arguments/unsafe-binder-arguments.ll" "/checkout/tests/codegen-llvm/unsafe-binder-arguments.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/unsafe-binder-arguments.rs:12:11: error: CHECK: expected string not found in input
// CHECK: define noundef nonnull ptr @bare(ptr noundef nonnull %x)
          ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/unsafe-binder-arguments/unsafe-binder-arguments.ll:1:1: note: scanning from here
; ModuleID = 'unsafe_binder_arguments.9c7560d2fb88559c-cgu.0'
^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/unsafe-binder-arguments/unsafe-binder-arguments.ll:7:11: note: possible intended match here
define dso_local noundef nonnull ptr @bare(ptr noundef nonnull %x) unnamed_addr #0 !guid !1 {
          ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/unsafe-binder-arguments/unsafe-binder-arguments.ll
Check file: /checkout/tests/codegen-llvm/unsafe-binder-arguments.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: ; ModuleID = 'unsafe_binder_arguments.9c7560d2fb88559c-cgu.0' 
check:12'0    {                                                                search range start (exclusive)
check:12'1                                                                     error: no match found in search range
            2: source_filename = "unsafe_binder_arguments.9c7560d2fb88559c-cgu.0" 
            3: target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20" 
            4: target triple = "wasm32-unknown-wasip1" 
            5:  
            6: ; Function Attrs: nounwind 
            7: define dso_local noundef nonnull ptr @bare(ptr noundef nonnull %x) unnamed_addr #0 !guid !1 { 
check:12'2               ?                                                                                     possible intended match
            8: start: 
            9:  ret ptr %x 
           10: } 
           11:  
           12: ; Function Attrs: nounwind 
           13: define dso_local void @bare_mut(ptr noundef nonnull %_x) unnamed_addr #0 !guid !2 { 
           14: start: 
           15:  ret void 
           16: } 
           17:  
           18: ; Function Attrs: nounwind 
           19: define dso_local void @pair(ptr noalias nofree noundef readonly align 4 captures(address, read_provenance) dereferenceable(4) %_x.0, ptr noalias nofree noundef readonly align 8 captures(address, read_provenance) dereferenceable(8) %_x.1) unnamed_addr #0 !guid !3 { 
           20: start: 
           21:  ret void 
           22: } 
           23:  
           24: attributes #0 = { nounwind "target-cpu"="generic" } 
           25:  
           26: !llvm.ident = !{!0} 
           27:  
           28: !0 = !{!"rustc version 1.101.0-nightly (8a601c4b9 2026-09-29)"} 
           29: !1 = !{i64 -6384715683809327994} 
           30: !2 = !{i64 8387859167154692804} 
           31: !3 = !{i64 4859215404959254835} 
check:12'3                                     } search range end (exclusive)
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/unsafe-binder-arguments.rs stdout end ----

This branch has not been deployed

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

Labels

PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. 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.

3 participants