Skip to content

Do not deduce parameters for #[naked] and functions whose body may be swapped out at link-time - #164490

Draft
saethlin wants to merge 2 commits into
rust-lang:mainfrom
saethlin:no-deduction-for-inexact
Draft

saethlin wants to merge 2 commits into
rust-lang:mainfrom
saethlin:no-deduction-for-inexact

Conversation

@saethlin

@saethlin saethlin commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Per #164037 (comment), this is addressing a different problem with parameter deduction. #164037 fixes an issue where we just analyzed the wrong MIR body, this PR addresses the case where we look up the right DefId, but the function implementation can be swapped out later.

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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. labels Oct 17, 2026
@saethlin
saethlin marked this pull request as ready for review October 17, 2026 21:08
@rustbot

rustbot commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_ir

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 17, 2026
@rustbot

rustbot commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

r? @Enselic

rustbot has assigned @Enselic.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 77 candidates
  • Random selection from 20 candidates

@Enselic

Enselic commented Oct 20, 2026

Copy link
Copy Markdown
Member

This makes sense, especially if performance looks ok. Let's start with checking performance.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 20, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 20, 2026
Do not deduce parameters for #[naked] and functions whose body may be swapped out at link-time
@rust-bors

rust-bors Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 2889f76 (2889f768d9d352ca8e09387e5dd102d87788e0ca)
Base parent: a7c37f9 (a7c37f9f0ee5e93396106e9de20f4a86b4154e63)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2889f76): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (secondary 0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results (primary -0.2%, secondary -1.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.9% [2.9%, 2.9%] 1
Regressions ❌
(secondary)
1.7% [1.0%, 2.4%] 2
Improvements ✅
(primary)
-3.2% [-3.2%, -3.2%] 1
Improvements ✅
(secondary)
-2.4% [-6.7%, -0.6%] 6
All ❌✅ (primary) -0.2% [-3.2%, 2.9%] 2

Binary size

Results (primary -0.0%, secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 1
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 1
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 1

Bootstrap: 491.717s -> 488.371s (-0.68%)
Artifact size: 408.99 MiB -> 409.05 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 20, 2026
/// will be present at runtime.
pub fn is_definition_exact(self) -> bool {
match self {
Linkage::External | Linkage::Internal => true,

@Enselic Enselic Oct 21, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I currently don't have time to investigate at depth myself, but is Linkage::External really correct to return true? I'm thinking of LD_PRELOAD overriding something Linkage::External, for example. I know Rust by default prefers static linkage and not exporting symbols, but it seems like this match should still be in sync with e.g.

None | Some(Linkage::Internal) => false,
Some(_) => true,

and

crate::Linkage::Internal => false,
crate::Linkage::AvailableExternally
| crate::Linkage::External
| crate::Linkage::ExternalWeak
| crate::Linkage::LinkOnceAny
| crate::Linkage::LinkOnceODR
| crate::Linkage::WeakAny
| crate::Linkage::WeakODR => true,
},

shouldn't it? If yes, I think it is worth considering using a common function for it, like the one you added. If no, consider adding a small comment explaining why the code looks a bit uninutitive.

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think you are right to ask about this and after musing about it for a while, I think the linkage attribute is more a distraction than anything. I think conceptually the right thing to do here is check for contains_extern_indicator, that just breaks a lot of codegen tests because they are accidentally testing that we do parameter deduction on #[no_mangle] functions.

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Oct 21, 2026
@saethlin
saethlin force-pushed the no-deduction-for-inexact branch from d7530b5 to 0748668 Compare November 11, 2026 02:01
@rustbot

rustbot commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@saethlin
saethlin marked this pull request as draft November 11, 2026 02:01
@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/addr-of-mutate.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/addr-of-mutate.rs:27:11: error: CHECK: expected string not found in input
// CHECK: i1 @third(ptr{{( dead_on_return)?}} noalias nofree noundef readonly align {{[0-9]+}}{{( captures\(none\))?}}{{( dead_on_return)?}} dereferenceable({{[0-9]+}}) %a_ptr_and_b)
          ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/addr-of-mutate/addr-of-mutate.ll:17:136: note: scanning from here
define noundef zeroext i1 @second(ptr noalias nofree noundef align 8 captures(address) dead_on_return dereferenceable(24) %a_ptr_and_b) unnamed_addr #0 !guid !4 {
                                                                                                                                       ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/addr-of-mutate/addr-of-mutate.ll
Check file: /checkout/tests/codegen-llvm/addr-of-mutate.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'addr_of_mutate.9ef07b3ba1d68205-cgu.0' 
            2: source_filename = "addr_of_mutate.9ef07b3ba1d68205-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-wasip3" 
            5:  
            6: ; Function Attrs: nounwind 
            7: define noundef i8 @foo(ptr noalias nofree noundef align 1 captures(address) dead_on_return dereferenceable(128) %x) unnamed_addr #0 !guid !2 { 
            8: start: 
            9:  %0 = getelementptr inbounds nuw i8, ptr %x, i32 0 
           10:  store i8 1, ptr %0, align 1 
           11:  %1 = getelementptr inbounds nuw i8, ptr %x, i32 0 
           12:  %_0 = load i8, ptr %1, align 1, !noundef !3 
           13:  ret i8 %_0 
           14: } 
           15:  
           16: ; Function Attrs: nounwind 
           17: define noundef zeroext i1 @second(ptr noalias nofree noundef align 8 captures(address) dead_on_return dereferenceable(24) %a_ptr_and_b) unnamed_addr #0 !guid !4 { 
check:27'0                                                                                                                                           {                              search range start (exclusive)
check:27'1                                                                                                                                                                          error: no match found in search range
           18: start: 
           19:  %0 = getelementptr inbounds i8, ptr %a_ptr_and_b, i32 8 
           20:  %_3 = getelementptr inbounds i8, ptr %0, i32 8 
           21:  store i8 1, ptr %_3, align 1 
           22:  %1 = getelementptr inbounds i8, ptr %a_ptr_and_b, i32 8 
           23:  %2 = getelementptr inbounds i8, ptr %1, i32 8 
           24:  %3 = load i8, ptr %2, align 8, !range !5, !noundef !3 
           25:  %_0 = trunc nuw i8 %3 to i1 
           26:  ret i1 %_0 
           27: } 
           28:  
           29: ; Function Attrs: nounwind 
           30: define noundef zeroext i1 @third(ptr noalias nofree noundef align 8 captures(address) dead_on_return dereferenceable(24) %a_ptr_and_b) unnamed_addr #0 !guid !6 { 
           31: start: 
           32:  %_4 = load ptr, ptr %a_ptr_and_b, align 8, !noundef !3 
           33:  %_3 = getelementptr inbounds i8, ptr %_4, i32 4 
           34:  store i8 1, ptr %_3, align 1 
           35:  %0 = getelementptr inbounds i8, ptr %a_ptr_and_b, i32 8 
           36:  %1 = getelementptr inbounds i8, ptr %0, i32 8 
           37:  %2 = load i8, ptr %1, align 8, !range !5, !noundef !3 
           38:  %_0 = trunc nuw i8 %2 to i1 
           39:  ret i1 %_0 
           40: } 
           41:  
           42: attributes #0 = { nounwind "target-cpu"="generic" } 
           43:  
           44: !llvm.module.flags = !{!0} 
           45: !llvm.ident = !{!1} 
           46:  
           47: !0 = !{i32 8, !"PIC Level", i32 2} 
           48: !1 = !{!"rustc version 1.102.0-nightly (bbb9c40b1 2026-11-11)"} 
           49: !2 = !{i64 6699318081062747564} 
           50: !3 = !{} 
           51: !4 = !{i64 -6159097919373381463} 
           52: !5 = !{i8 0, i8 2} 
           53: !6 = !{i64 -3747179513611854627} 
check:27'2                                      } 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/addr-of-mutate/addr-of-mutate.ll" "/checkout/tests/codegen-llvm/addr-of-mutate.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/addr-of-mutate.rs:27:11: error: CHECK: expected string not found in input
// CHECK: i1 @third(ptr{{( dead_on_return)?}} noalias nofree noundef readonly align {{[0-9]+}}{{( captures\(none\))?}}{{( dead_on_return)?}} dereferenceable({{[0-9]+}}) %a_ptr_and_b)
          ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/addr-of-mutate/addr-of-mutate.ll:17:136: note: scanning from here
define noundef zeroext i1 @second(ptr noalias nofree noundef align 8 captures(address) dead_on_return dereferenceable(24) %a_ptr_and_b) unnamed_addr #0 !guid !4 {
                                                                                                                                       ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/addr-of-mutate/addr-of-mutate.ll
Check file: /checkout/tests/codegen-llvm/addr-of-mutate.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'addr_of_mutate.9ef07b3ba1d68205-cgu.0' 
            2: source_filename = "addr_of_mutate.9ef07b3ba1d68205-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-wasip3" 
            5:  
            6: ; Function Attrs: nounwind 
            7: define noundef i8 @foo(ptr noalias nofree noundef align 1 captures(address) dead_on_return dereferenceable(128) %x) unnamed_addr #0 !guid !2 { 
            8: start: 
            9:  %0 = getelementptr inbounds nuw i8, ptr %x, i32 0 
           10:  store i8 1, ptr %0, align 1 
           11:  %1 = getelementptr inbounds nuw i8, ptr %x, i32 0 
           12:  %_0 = load i8, ptr %1, align 1, !noundef !3 
           13:  ret i8 %_0 
           14: } 
           15:  
           16: ; Function Attrs: nounwind 
           17: define noundef zeroext i1 @second(ptr noalias nofree noundef align 8 captures(address) dead_on_return dereferenceable(24) %a_ptr_and_b) unnamed_addr #0 !guid !4 { 
check:27'0                                                                                                                                           {                              search range start (exclusive)
check:27'1                                                                                                                                                                          error: no match found in search range
           18: start: 
           19:  %0 = getelementptr inbounds i8, ptr %a_ptr_and_b, i32 8 
           20:  %_3 = getelementptr inbounds i8, ptr %0, i32 8 
           21:  store i8 1, ptr %_3, align 1 
           22:  %1 = getelementptr inbounds i8, ptr %a_ptr_and_b, i32 8 
           23:  %2 = getelementptr inbounds i8, ptr %1, i32 8 
           24:  %3 = load i8, ptr %2, align 8, !range !5, !noundef !3 
           25:  %_0 = trunc nuw i8 %3 to i1 
           26:  ret i1 %_0 
           27: } 
           28:  
           29: ; Function Attrs: nounwind 
           30: define noundef zeroext i1 @third(ptr noalias nofree noundef align 8 captures(address) dead_on_return dereferenceable(24) %a_ptr_and_b) unnamed_addr #0 !guid !6 { 
           31: start: 
           32:  %_4 = load ptr, ptr %a_ptr_and_b, align 8, !noundef !3 
           33:  %_3 = getelementptr inbounds i8, ptr %_4, i32 4 
           34:  store i8 1, ptr %_3, align 1 
           35:  %0 = getelementptr inbounds i8, ptr %a_ptr_and_b, i32 8 
           36:  %1 = getelementptr inbounds i8, ptr %0, i32 8 
           37:  %2 = load i8, ptr %1, align 8, !range !5, !noundef !3 
           38:  %_0 = trunc nuw i8 %2 to i1 
           39:  ret i1 %_0 
           40: } 
           41:  
           42: attributes #0 = { nounwind "target-cpu"="generic" } 
           43:  
           44: !llvm.module.flags = !{!0} 
           45: !llvm.ident = !{!1} 
           46:  
           47: !0 = !{i32 8, !"PIC Level", i32 2} 
           48: !1 = !{!"rustc version 1.102.0-nightly (bbb9c40b1 2026-11-11)"} 
           49: !2 = !{i64 6699318081062747564} 
           50: !3 = !{} 
           51: !4 = !{i64 -6159097919373381463} 
           52: !5 = !{i8 0, i8 2} 
           53: !6 = !{i64 -3747179513611854627} 
check:27'2                                      } search range end (exclusive)
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/addr-of-mutate.rs stdout end ----
---- [codegen] tests/codegen-llvm/deduced-param-attrs-eii.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/deduced-param-attrs-eii.rs:13:17: error: CHECK-LABEL: expected string not found in input
// CHECK-LABEL: @external(ptr {{.*}}readonly {{.*}}captures(none) {{.*}}%_b)
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-eii/deduced-param-attrs-eii.ll:1:1: note: scanning from here
; ModuleID = 'deduced_param_attrs_eii.18c3457beef146b9-cgu.0'
^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-eii/deduced-param-attrs-eii.ll:7:13: note: possible intended match here
define void @external(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !2 {
            ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-eii/deduced-param-attrs-eii.ll
Check file: /checkout/tests/codegen-llvm/deduced-param-attrs-eii.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'deduced_param_attrs_eii.18c3457beef146b9-cgu.0' 
label:13'0    {                                                                search range start (exclusive)
label:13'1                                                                     error: no match found in search range
            2: source_filename = "deduced_param_attrs_eii.18c3457beef146b9-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-wasip3" 
            5:  
            6: ; Function Attrs: nounwind 
            7: define void @external(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !2 { 
label:13'2                 ?                                                                                                                                     possible intended match
            8: start: 
            9:  ret void 
           10: } 
           11:  
           12: ; deduced_param_attrs_eii::_::decl_default 
           13: ; Function Attrs: nounwind 
           14: define void @_RNvNvCs27Ok8OFZBnF_23deduced_param_attrs_eii1__12decl_default(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !3 { 
           15: start: 
           16:  ret void 
           17: } 
           18:  
           19: ; deduced_param_attrs_eii::decl_default 
           20: ; Function Attrs: nounwind 
           21: define weak void @_RNvCs27Ok8OFZBnF_23deduced_param_attrs_eii12decl_default(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %0) unnamed_addr #0 !guid !4 { 
           22: start: 
           23: ; call deduced_param_attrs_eii::_::decl_default 
           24:  call void @_RNvNvCs27Ok8OFZBnF_23deduced_param_attrs_eii1__12decl_default(ptr noalias nofree noundef align 4 captures(address) dereferenceable(4096) %0) #1 
           25:  ret void 
           26: } 
           27:  
           28: attributes #0 = { nounwind "target-cpu"="generic" } 
           29: attributes #1 = { nounwind } 
           30:  
           31: !llvm.module.flags = !{!0} 
           32: !llvm.ident = !{!1} 
           33:  
           34: !0 = !{i32 8, !"PIC Level", i32 2} 
           35: !1 = !{!"rustc version 1.102.0-nightly (bbb9c40b1 2026-11-11)"} 
           36: !2 = !{i64 5224464028922159466} 
           37: !3 = !{i64 -9192150561541716542} 
           38: !4 = !{i64 -8453444075777132308} 
label:13'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/deduced-param-attrs-eii/deduced-param-attrs-eii.ll" "/checkout/tests/codegen-llvm/deduced-param-attrs-eii.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/deduced-param-attrs-eii.rs:13:17: error: CHECK-LABEL: expected string not found in input
// CHECK-LABEL: @external(ptr {{.*}}readonly {{.*}}captures(none) {{.*}}%_b)
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-eii/deduced-param-attrs-eii.ll:1:1: note: scanning from here
; ModuleID = 'deduced_param_attrs_eii.18c3457beef146b9-cgu.0'
^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-eii/deduced-param-attrs-eii.ll:7:13: note: possible intended match here
define void @external(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !2 {
            ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-eii/deduced-param-attrs-eii.ll
Check file: /checkout/tests/codegen-llvm/deduced-param-attrs-eii.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'deduced_param_attrs_eii.18c3457beef146b9-cgu.0' 
label:13'0    {                                                                search range start (exclusive)
label:13'1                                                                     error: no match found in search range
            2: source_filename = "deduced_param_attrs_eii.18c3457beef146b9-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-wasip3" 
            5:  
            6: ; Function Attrs: nounwind 
            7: define void @external(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !2 { 
label:13'2                 ?                                                                                                                                     possible intended match
            8: start: 
            9:  ret void 
           10: } 
           11:  
           12: ; deduced_param_attrs_eii::_::decl_default 
           13: ; Function Attrs: nounwind 
           14: define void @_RNvNvCs27Ok8OFZBnF_23deduced_param_attrs_eii1__12decl_default(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !3 { 
           15: start: 
           16:  ret void 
           17: } 
           18:  
           19: ; deduced_param_attrs_eii::decl_default 
           20: ; Function Attrs: nounwind 
           21: define weak void @_RNvCs27Ok8OFZBnF_23deduced_param_attrs_eii12decl_default(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %0) unnamed_addr #0 !guid !4 { 
           22: start: 
           23: ; call deduced_param_attrs_eii::_::decl_default 
           24:  call void @_RNvNvCs27Ok8OFZBnF_23deduced_param_attrs_eii1__12decl_default(ptr noalias nofree noundef align 4 captures(address) dereferenceable(4096) %0) #1 
           25:  ret void 
           26: } 
           27:  
           28: attributes #0 = { nounwind "target-cpu"="generic" } 
           29: attributes #1 = { nounwind } 
           30:  
           31: !llvm.module.flags = !{!0} 
           32: !llvm.ident = !{!1} 
           33:  
           34: !0 = !{i32 8, !"PIC Level", i32 2} 
           35: !1 = !{!"rustc version 1.102.0-nightly (bbb9c40b1 2026-11-11)"} 
           36: !2 = !{i64 5224464028922159466} 
           37: !3 = !{i64 -9192150561541716542} 
           38: !4 = !{i64 -8453444075777132308} 
label:13'3                                      } search range end (exclusive)
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/deduced-param-attrs-eii.rs stdout end ----
---- [codegen] tests/codegen-llvm/deduced-param-attrs-linkage.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/deduced-param-attrs-linkage.rs:12:17: error: CHECK-LABEL: expected string not found in input
// CHECK-LABEL: @external(ptr {{.*}}readonly {{.*}}captures(none) {{.*}}%_b)
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-linkage/deduced-param-attrs-linkage.ll:1:1: note: scanning from here
; ModuleID = 'deduced_param_attrs_linkage.302a7edd016c85a9-cgu.0'
^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-linkage/deduced-param-attrs-linkage.ll:11:13: note: possible intended match here
define void @external(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !2 {
            ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-linkage/deduced-param-attrs-linkage.ll
Check file: /checkout/tests/codegen-llvm/deduced-param-attrs-linkage.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'deduced_param_attrs_linkage.302a7edd016c85a9-cgu.0' 
label:12'0    {                                                                    search range start (exclusive)
label:12'1                                                                         error: no match found in search range
            2: source_filename = "deduced_param_attrs_linkage.302a7edd016c85a9-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-wasip3" 
            5:  
            6: $linkonce_odr = comdat any 
            7:  
            8: $weak_odr = comdat any 
            9:  
           10: ; Function Attrs: nounwind 
           11: define void @external(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !2 { 
label:12'2                 ?                                                                                                                                     possible intended match
           12: start: 
           13:  ret void 
           14: } 
           15:  
           16: ; Function Attrs: nounwind 
           17: define linkonce void @linkonce(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !3 { 
           18: start: 
           19:  ret void 
           20: } 
           21:  
           22: ; Function Attrs: nounwind 
           23: define linkonce_odr void @linkonce_odr(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 comdat !guid !4 { 
           24: start: 
           25:  ret void 
           26: } 
           27:  
           28: ; Function Attrs: nounwind 
           29: define weak void @weak(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !5 { 
           30: start: 
           31:  ret void 
           32: } 
           33:  
           34: ; Function Attrs: nounwind 
           35: define weak_odr void @weak_odr(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 comdat !guid !6 { 
           36: start: 
           37:  ret void 
           38: } 
           39:  
           40: ; Function Attrs: nounwind 
           41: define available_externally void @available_externally(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !7 { 
           42: start: 
           43:  ret void 
           44: } 
           45:  
           46: attributes #0 = { nounwind "target-cpu"="generic" } 
           47:  
           48: !llvm.module.flags = !{!0} 
           49: !llvm.ident = !{!1} 
           50:  
           51: !0 = !{i32 8, !"PIC Level", i32 2} 
           52: !1 = !{!"rustc version 1.102.0-nightly (bbb9c40b1 2026-11-11)"} 
           53: !2 = !{i64 5224464028922159466} 
           54: !3 = !{i64 -121947654961992603} 
           55: !4 = !{i64 4699683234740488346} 
           56: !5 = !{i64 -5028622335731970946} 
           57: !6 = !{i64 5032595276345663039} 
           58: !7 = !{i64 -8510055422695886042} 
label: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/deduced-param-attrs-linkage/deduced-param-attrs-linkage.ll" "/checkout/tests/codegen-llvm/deduced-param-attrs-linkage.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/deduced-param-attrs-linkage.rs:12:17: error: CHECK-LABEL: expected string not found in input
// CHECK-LABEL: @external(ptr {{.*}}readonly {{.*}}captures(none) {{.*}}%_b)
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-linkage/deduced-param-attrs-linkage.ll:1:1: note: scanning from here
; ModuleID = 'deduced_param_attrs_linkage.302a7edd016c85a9-cgu.0'
^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-linkage/deduced-param-attrs-linkage.ll:11:13: note: possible intended match here
define void @external(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !2 {
            ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs-linkage/deduced-param-attrs-linkage.ll
Check file: /checkout/tests/codegen-llvm/deduced-param-attrs-linkage.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'deduced_param_attrs_linkage.302a7edd016c85a9-cgu.0' 
label:12'0    {                                                                    search range start (exclusive)
label:12'1                                                                         error: no match found in search range
            2: source_filename = "deduced_param_attrs_linkage.302a7edd016c85a9-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-wasip3" 
            5:  
            6: $linkonce_odr = comdat any 
            7:  
            8: $weak_odr = comdat any 
            9:  
           10: ; Function Attrs: nounwind 
           11: define void @external(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !2 { 
label:12'2                 ?                                                                                                                                     possible intended match
           12: start: 
           13:  ret void 
           14: } 
           15:  
           16: ; Function Attrs: nounwind 
           17: define linkonce void @linkonce(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !3 { 
           18: start: 
           19:  ret void 
           20: } 
           21:  
           22: ; Function Attrs: nounwind 
           23: define linkonce_odr void @linkonce_odr(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 comdat !guid !4 { 
           24: start: 
           25:  ret void 
           26: } 
           27:  
           28: ; Function Attrs: nounwind 
           29: define weak void @weak(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !5 { 
           30: start: 
           31:  ret void 
           32: } 
           33:  
           34: ; Function Attrs: nounwind 
           35: define weak_odr void @weak_odr(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 comdat !guid !6 { 
           36: start: 
           37:  ret void 
           38: } 
           39:  
           40: ; Function Attrs: nounwind 
           41: define available_externally void @available_externally(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %_b) unnamed_addr #0 !guid !7 { 
           42: start: 
           43:  ret void 
           44: } 
           45:  
           46: attributes #0 = { nounwind "target-cpu"="generic" } 
           47:  
           48: !llvm.module.flags = !{!0} 
           49: !llvm.ident = !{!1} 
           50:  
           51: !0 = !{i32 8, !"PIC Level", i32 2} 
           52: !1 = !{!"rustc version 1.102.0-nightly (bbb9c40b1 2026-11-11)"} 
           53: !2 = !{i64 5224464028922159466} 
           54: !3 = !{i64 -121947654961992603} 
           55: !4 = !{i64 4699683234740488346} 
           56: !5 = !{i64 -5028622335731970946} 
           57: !6 = !{i64 5032595276345663039} 
           58: !7 = !{i64 -8510055422695886042} 
label:12'3                                      } search range end (exclusive)
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/deduced-param-attrs-linkage.rs stdout end ----
---- [codegen] tests/codegen-llvm/deduced-param-attrs.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/deduced-param-attrs.rs:37:17: error: CHECK-LABEL: expected string not found in input
// CHECK-LABEL: @deref_mut({{.*}}readonly {{.*}}captures(none) {{.*}}%c)
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs/deduced-param-attrs.ll:29:21: note: scanning from here
define void @mutate(ptr noalias nofree noundef align 4 captures(address) dead_on_return dereferenceable(4096) %b) unnamed_addr #0 !guid !9 {
                    ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs/deduced-param-attrs.ll:106:103: note: possible intended match here
define internal void @_RINvCsjJDJnE9cmQ5_19deduced_param_attrs7consumeNtB2_7BigCellEB2_(ptr noalias nofree noundef readonly align 4 captures(none) dead_on_return dereferenceable(4096) %_1) unnamed_addr #0 !guid !19 {
                                                                                                      ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/deduced-param-attrs/deduced-param-attrs.ll
Check file: /checkout/tests/codegen-llvm/deduced-param-attrs.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'deduced_param_attrs.e5e10a062a5af667-cgu.0' 
            2: source_filename = "deduced_param_attrs.e5e10a062a5af667-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-wasip3" 
            5:  
            6: @_RNvCsjJDJnE9cmQ5_19deduced_param_attrs2A0 = constant ptr @_RINvCsjJDJnE9cmQ5_19deduced_param_attrs13shared_borrowNtB2_3BigEB2_, align 4, !guid !0 
            7: @_RNvCsjJDJnE9cmQ5_19deduced_param_attrs2A1 = constant ptr @_RINvCsjJDJnE9cmQ5_19deduced_param_attrs13shared_borrowNtB2_7BigCellEB2_, align 4, !guid !1 
            8: @_RNvCsjJDJnE9cmQ5_19deduced_param_attrs2B0 = constant ptr @_RINvCsjJDJnE9cmQ5_19deduced_param_attrs7consumeNtB2_7BigCellEB2_, align 4, !guid !2 
            9: @_RNvCsjJDJnE9cmQ5_19deduced_param_attrs2B1 = constant ptr @_RINvCsjJDJnE9cmQ5_19deduced_param_attrs7consumeNtB2_7BigDropEB2_, align 4, !guid !3 
           10: @_RNvCsjJDJnE9cmQ5_19deduced_param_attrs2C1 = constant ptr @_RINvCsjJDJnE9cmQ5_19deduced_param_attrs13consume_partsAhj28_EB2_, align 4, !guid !4 
           11:  

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

A-attributes Area: Attributes (`#[…]`, `#![…]`) 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants