Skip to content

Port rustc_intrinsic to the new attribute parser#152167

Closed
jdonszelmann wants to merge 1 commit intorust-lang:mainfrom
jdonszelmann:port-rustc-intrinsic
Closed

Port rustc_intrinsic to the new attribute parser#152167
jdonszelmann wants to merge 1 commit intorust-lang:mainfrom
jdonszelmann:port-rustc-intrinsic

Conversation

@jdonszelmann
Copy link
Contributor

@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2026

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @JonathanBrouwer

Some changes occurred in compiler/rustc_hir/src/attrs

cc @JonathanBrouwer

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 5, 2026
@rustbot rustbot added T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 5, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2026

JonathanBrouwer is currently at their maximum review capacity.
They may take a while to respond.

@JonathanBrouwer
Copy link
Contributor

r=me after rebasing & ci green

@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2026

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.

@jdonszelmann
Copy link
Contributor Author

closed in favor of #152168

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 5, 2026
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/asm/aarch64/type-check-2.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-2-2.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-3.rs ... ok
test [ui] tests/ui/asm/aarch64/type-f16.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#hf ... ok
test [ui] tests/ui/asm/arm-low-dreg.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#r82 ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#sf ... ok
test [ui] tests/ui/asm/aarch64/sym.rs ... ok
test [ui] tests/ui/asm/binary_asm_labels.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/asm/asm-with-nested-closure.rs ... ok
test [ui] tests/ui/asm/bad-template.rs#x86_64 ... ok
test [ui] tests/ui/asm/cfg.rs#reva ... ignored, only executed when the architecture is x86_64
---
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat2 ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat3 ... ok
test [ui] tests/ui/extern/issue-80074.rs ... ok
test [ui] tests/ui/extern/issue-95829.rs ... ok
test [ui] tests/ui/extern/lgamma-linkage.rs ... ok
test [ui] tests/ui/extern/no-mangle-associated-fn.rs ... ok
test [ui] tests/ui/extern/not-in-block.rs ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#thin1 ... ok
test [ui] tests/ui/extern/unsized-extern-derefmove.rs ... ok
test [ui] tests/ui/feature-gates/allow-features-empty.rs ... ok
---
test [ui] tests/ui/imports/ambiguous-7.rs ... ok
test [ui] tests/ui/imports/ambiguous-import-visibility-module.rs ... ok
test [ui] tests/ui/imports/ambiguous-8.rs ... ok
test [ui] tests/ui/imports/ambiguous-glob-vs-expanded-extern.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-glob-vs-multiouter.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-globvsglob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-no-implicit-prelude.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-std-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-core-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-std.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-core.rs ... ok
---

---- [codegen] tests/codegen-llvm/cross-crate-inlining/leaf-inlining.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/cross-crate-inlining/leaf-inlining.rs:25:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: call {{.*}}leaf_with_intrinsic
               ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/cross-crate-inlining/leaf-inlining/leaf-inlining.ll:29:3: note: found here
; call leaf::leaf_with_intrinsic
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/cross-crate-inlining/leaf-inlining/leaf-inlining.ll
Check file: /checkout/tests/codegen-llvm/cross-crate-inlining/leaf-inlining.rs

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

Input was:
<<<<<<
        1: ; ModuleID = 'leaf_inlining.b2cf0d1cb56386d5-cgu.0' 
        2: source_filename = "leaf_inlining.b2cf0d1cb56386d5-cgu.0" 
        3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 
        4: target triple = "aarch64-unknown-linux-gnu" 
        5:  
        6: @alloc_32cfad16a511ea83d837da127571c10f = private unnamed_addr constant [68 x i8] c"/checkout/tests/codegen-llvm/cross-crate-inlining/auxiliary/leaf.rs\00", align 1 
        7: @alloc_232d1567b0091edb9201d74e2a59a963 = private unnamed_addr constant <{ [8 x i8], ptr, [8 x i8] }> <{ [8 x i8] c"\05\00\00\00\1D\00\00\00", ptr @alloc_32cfad16a511ea83d837da127571c10f, [8 x i8] c"C\00\00\00\00\00\00\00" }>, align 8 
        8:  
        9: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 
       10: define void @leaf_outer(ptr dead_on_unwind noalias nocapture noundef writable writeonly sret([24 x i8]) align 8 dereferenceable(24) initializes((0, 24)) %_0) unnamed_addr #0 { 
       11: start: 
       12:  %_1.sroa.5.0._0.sroa_idx = getelementptr inbounds nuw i8, ptr %_0, i64 16 
       13:  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %_0, i8 0, i64 16, i1 false) 
       14:  store ptr inttoptr (i64 1 to ptr), ptr %_1.sroa.5.0._0.sroa_idx, align 8 
       15:  ret void 
       16: } 
       17:  
       18: ; Function Attrs: uwtable 
       19: define void @stem_outer(ptr dead_on_unwind noalias noundef writable sret([24 x i8]) align 8 dereferenceable(24) %_0) unnamed_addr #1 { 
       20: start: 
       21: ; call leaf::stem_fn 
       22:  tail call void @_RNvCsfx35IASk1Bw_4leaf7stem_fn(ptr noalias noundef nonnull sret([24 x i8]) align 8 dereferenceable(24) %_0) 
       23:  ret void 
       24: } 
       25:  
       26: ; Function Attrs: uwtable 
       27: define noundef zeroext i1 @leaf_with_intrinsic_outer(ptr noalias noundef readonly align 8 dereferenceable(16) %a, ptr noalias noundef readonly align 8 dereferenceable(16) %b) unnamed_addr #1 { 
       28: start: 
       29: ; call leaf::leaf_with_intrinsic 
not:25       !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: no match expected
       30:  %_0 = tail call noundef zeroext i1 @_RNvCsfx35IASk1Bw_4leaf19leaf_with_intrinsic(ptr noalias noundef nonnull readonly align 8 dereferenceable(16) %a, ptr noalias noundef nonnull readonly align 8 dereferenceable(16) %b) 
       31:  ret i1 %_0 
       32: } 
       33:  
       34: ; Function Attrs: uwtable 
       35: define noundef i32 @leaf_with_assert(i32 noundef %a, i32 noundef %b) unnamed_addr #1 { 
       36: start: 
       37:  %_3 = icmp eq i32 %b, 0 
       38:  br i1 %_3, label %panic, label %bb1 
       39:  
       40: bb1: ; preds = %start 
       41:  %_4 = icmp eq i32 %b, -1 
       42:  %_5 = icmp eq i32 %a, -2147483648 
       43:  %_6 = and i1 %_5, %_4 
       44:  br i1 %_6, label %panic1, label %bb2 
       45:  
       46: panic: ; preds = %start 
       47: ; call core::panicking::panic_const::panic_const_div_by_zero 
       48:  tail call void @_RNvNtNtCscXCf4ZPppj8_4core9panicking11panic_const23panic_const_div_by_zero(ptr noalias noundef nonnull readonly align 8 dereferenceable(24) @alloc_232d1567b0091edb9201d74e2a59a963) #4 
       49:  unreachable 
       50:  
       51: bb2: ; preds = %bb1 
       52:  %_0 = sdiv i32 %a, %b 
       53:  ret i32 %_0 
       54:  
       55: panic1: ; preds = %bb1 
       56: ; call core::panicking::panic_const::panic_const_div_overflow 
       57:  tail call void @_RNvNtNtCscXCf4ZPppj8_4core9panicking11panic_const24panic_const_div_overflow(ptr noalias noundef nonnull readonly align 8 dereferenceable(24) @alloc_232d1567b0091edb9201d74e2a59a963) #4 
       58:  unreachable 
       59: } 
       60:  
       61: ; leaf::stem_fn 
       62: ; Function Attrs: uwtable 
       63: declare void @_RNvCsfx35IASk1Bw_4leaf7stem_fn(ptr dead_on_unwind noalias noundef writable sret([24 x i8]) align 8 dereferenceable(24)) unnamed_addr #1 
       64:  
       65: ; leaf::leaf_with_intrinsic 
       66: ; Function Attrs: uwtable 
       67: declare noundef zeroext i1 @_RNvCsfx35IASk1Bw_4leaf19leaf_with_intrinsic(ptr noalias noundef readonly align 8 dereferenceable(16), ptr noalias noundef readonly align 8 dereferenceable(16)) unnamed_addr #1 
       68:  
       69: ; core::panicking::panic_const::panic_const_div_by_zero 
       70: ; Function Attrs: cold noinline noreturn uwtable 
       71: declare void @_RNvNtNtCscXCf4ZPppj8_4core9panicking11panic_const23panic_const_div_by_zero(ptr noalias noundef readonly align 8 dereferenceable(24)) unnamed_addr #2 
       72:  
       73: ; core::panicking::panic_const::panic_const_div_overflow 
       74: ; Function Attrs: cold noinline noreturn uwtable 
       75: declare void @_RNvNtNtCscXCf4ZPppj8_4core9panicking11panic_const24panic_const_div_overflow(ptr noalias noundef readonly align 8 dereferenceable(24)) unnamed_addr #2 
       76:  
       77: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) 
       78: declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 
       79:  
       80: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       81: attributes #1 = { uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       82: attributes #2 = { cold noinline noreturn uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       83: attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } 
       84: attributes #4 = { noinline noreturn } 
       85:  
       86: !llvm.module.flags = !{!0} 
       87: !llvm.ident = !{!1} 
       88:  
       89: !0 = !{i32 8, !"PIC Level", i32 2} 
       90: !1 = !{!"rustc version 1.95.0-nightly (2e9d03ce4 2026-02-05)"} 
>>>>>>

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

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-20/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/cross-crate-inlining/leaf-inlining/leaf-inlining.ll" "/checkout/tests/codegen-llvm/cross-crate-inlining/leaf-inlining.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/cross-crate-inlining/leaf-inlining.rs:25:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: call {{.*}}leaf_with_intrinsic
               ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/cross-crate-inlining/leaf-inlining/leaf-inlining.ll:29:3: note: found here
; call leaf::leaf_with_intrinsic
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/cross-crate-inlining/leaf-inlining/leaf-inlining.ll
Check file: /checkout/tests/codegen-llvm/cross-crate-inlining/leaf-inlining.rs

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

Input was:
<<<<<<
        1: ; ModuleID = 'leaf_inlining.b2cf0d1cb56386d5-cgu.0' 
        2: source_filename = "leaf_inlining.b2cf0d1cb56386d5-cgu.0" 
        3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 
        4: target triple = "aarch64-unknown-linux-gnu" 
        5:  
        6: @alloc_32cfad16a511ea83d837da127571c10f = private unnamed_addr constant [68 x i8] c"/checkout/tests/codegen-llvm/cross-crate-inlining/auxiliary/leaf.rs\00", align 1 
        7: @alloc_232d1567b0091edb9201d74e2a59a963 = private unnamed_addr constant <{ [8 x i8], ptr, [8 x i8] }> <{ [8 x i8] c"\05\00\00\00\1D\00\00\00", ptr @alloc_32cfad16a511ea83d837da127571c10f, [8 x i8] c"C\00\00\00\00\00\00\00" }>, align 8 
        8:  
        9: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 
       10: define void @leaf_outer(ptr dead_on_unwind noalias nocapture noundef writable writeonly sret([24 x i8]) align 8 dereferenceable(24) initializes((0, 24)) %_0) unnamed_addr #0 { 
       11: start: 
       12:  %_1.sroa.5.0._0.sroa_idx = getelementptr inbounds nuw i8, ptr %_0, i64 16 
       13:  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %_0, i8 0, i64 16, i1 false) 
       14:  store ptr inttoptr (i64 1 to ptr), ptr %_1.sroa.5.0._0.sroa_idx, align 8 
       15:  ret void 
       16: } 
       17:  
       18: ; Function Attrs: uwtable 
       19: define void @stem_outer(ptr dead_on_unwind noalias noundef writable sret([24 x i8]) align 8 dereferenceable(24) %_0) unnamed_addr #1 { 
       20: start: 
       21: ; call leaf::stem_fn 
       22:  tail call void @_RNvCsfx35IASk1Bw_4leaf7stem_fn(ptr noalias noundef nonnull sret([24 x i8]) align 8 dereferenceable(24) %_0) 
       23:  ret void 
       24: } 
       25:  
       26: ; Function Attrs: uwtable 
       27: define noundef zeroext i1 @leaf_with_intrinsic_outer(ptr noalias noundef readonly align 8 dereferenceable(16) %a, ptr noalias noundef readonly align 8 dereferenceable(16) %b) unnamed_addr #1 { 
       28: start: 
       29: ; call leaf::leaf_with_intrinsic 
not:25       !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: no match expected
       30:  %_0 = tail call noundef zeroext i1 @_RNvCsfx35IASk1Bw_4leaf19leaf_with_intrinsic(ptr noalias noundef nonnull readonly align 8 dereferenceable(16) %a, ptr noalias noundef nonnull readonly align 8 dereferenceable(16) %b) 
       31:  ret i1 %_0 
       32: } 
       33:  
       34: ; Function Attrs: uwtable 
       35: define noundef i32 @leaf_with_assert(i32 noundef %a, i32 noundef %b) unnamed_addr #1 { 
       36: start: 
       37:  %_3 = icmp eq i32 %b, 0 
       38:  br i1 %_3, label %panic, label %bb1 
       39:  
       40: bb1: ; preds = %start 
       41:  %_4 = icmp eq i32 %b, -1 
       42:  %_5 = icmp eq i32 %a, -2147483648 
       43:  %_6 = and i1 %_5, %_4 
       44:  br i1 %_6, label %panic1, label %bb2 
       45:  
       46: panic: ; preds = %start 
       47: ; call core::panicking::panic_const::panic_const_div_by_zero 
       48:  tail call void @_RNvNtNtCscXCf4ZPppj8_4core9panicking11panic_const23panic_const_div_by_zero(ptr noalias noundef nonnull readonly align 8 dereferenceable(24) @alloc_232d1567b0091edb9201d74e2a59a963) #4 
       49:  unreachable 
       50:  
       51: bb2: ; preds = %bb1 
       52:  %_0 = sdiv i32 %a, %b 
       53:  ret i32 %_0 
       54:  
       55: panic1: ; preds = %bb1 
       56: ; call core::panicking::panic_const::panic_const_div_overflow 
       57:  tail call void @_RNvNtNtCscXCf4ZPppj8_4core9panicking11panic_const24panic_const_div_overflow(ptr noalias noundef nonnull readonly align 8 dereferenceable(24) @alloc_232d1567b0091edb9201d74e2a59a963) #4 
       58:  unreachable 
       59: } 
       60:  
       61: ; leaf::stem_fn 
       62: ; Function Attrs: uwtable 
       63: declare void @_RNvCsfx35IASk1Bw_4leaf7stem_fn(ptr dead_on_unwind noalias noundef writable sret([24 x i8]) align 8 dereferenceable(24)) unnamed_addr #1 
       64:  
       65: ; leaf::leaf_with_intrinsic 
       66: ; Function Attrs: uwtable 
       67: declare noundef zeroext i1 @_RNvCsfx35IASk1Bw_4leaf19leaf_with_intrinsic(ptr noalias noundef readonly align 8 dereferenceable(16), ptr noalias noundef readonly align 8 dereferenceable(16)) unnamed_addr #1 
       68:  
       69: ; core::panicking::panic_const::panic_const_div_by_zero 
       70: ; Function Attrs: cold noinline noreturn uwtable 
       71: declare void @_RNvNtNtCscXCf4ZPppj8_4core9panicking11panic_const23panic_const_div_by_zero(ptr noalias noundef readonly align 8 dereferenceable(24)) unnamed_addr #2 
       72:  
       73: ; core::panicking::panic_const::panic_const_div_overflow 
       74: ; Function Attrs: cold noinline noreturn uwtable 
       75: declare void @_RNvNtNtCscXCf4ZPppj8_4core9panicking11panic_const24panic_const_div_overflow(ptr noalias noundef readonly align 8 dereferenceable(24)) unnamed_addr #2 
       76:  
       77: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) 
       78: declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 
       79:  
       80: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       81: attributes #1 = { uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       82: attributes #2 = { cold noinline noreturn uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 
       83: attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } 
       84: attributes #4 = { noinline noreturn } 
       85:  
       86: !llvm.module.flags = !{!0} 
       87: !llvm.ident = !{!1} 
       88:  
       89: !0 = !{i32 8, !"PIC Level", i32 2} 
       90: !1 = !{!"rustc version 1.95.0-nightly (2e9d03ce4 2026-02-05)"} 
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/cross-crate-inlining/leaf-inlining.rs stdout end ----

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) T-clippy Relevant to the Clippy team. 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.

4 participants