Skip to content

Add lint against invalid runtime symbol definitions#155521

Merged
rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
Urgau:runtime-symbols
Jun 26, 2026
Merged

Add lint against invalid runtime symbol definitions#155521
rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
Urgau:runtime-symbols

Conversation

@Urgau

@Urgau Urgau commented Apr 19, 2026

Copy link
Copy Markdown
Member

View all comments

This PR adds a deny-by-default lint againts invalid runtime symbol definitions, those runtime symbols are assumed and used by core1 and rustc with a specific definition.

We have had multiple reports of users tripping over std symbols (addressed in a future PR):

This PR is a second attempt after #146505, where T-lang had some reservations about a blanket lint that does not check the signature, which is now done with this PR, and about linting of std runtime symbols when std is not linked, which this PR omits by not including any std runtime symbols (for now).

invalid_runtime_symbol_definitions

(deny-by-default)

The invalid_runtime_symbol_definitions lint checks the signature of items whose symbol name is a runtime symbols expected by core differs significantly from the expected signature (like mismatch ABI, mismatch C variadics, mismatch argument count, missing return type, ...).

Example

#[unsafe(no_mangle)]
pub fn memcmp() {} // invalid definition of the `memcmp` runtime symbol
error: invalid definition of the runtime `memcmp` symbol used by the standard library
 --> a.rs:2:1
  |
4 | fn memcmp() {}
  | ^^^^^^^^^^^
  |
  = note: expected `unsafe extern "C" fn(*const c_void, *const c_void, usize) -> i32`
          found    `fn()`
  = help: either fix the signature or remove any attributes like `#[unsafe(no_mangle)]`, `#[unsafe(export_name = "memcmp")]`, or `#[link_name = "memcmp"]`
  = note: `#[deny(invalid_runtime_symbol_definitions)]` on by default

Explanation

Up-most care is required when defining runtime symbols assumed and used by the standard library. They must follow the C specification, not use any standard-library facility or undefined behavior may occur.

The symbols currently checked are memcpy, memmove, memset, memcmp, bcmp and strlen.

suspicious_runtime_symbol_definitions

(warn-by-default, asked in this comment)

The suspicious_runtime_symbol_definitions lint checks the signature of items whose symbol name is a runtime symbol expected by core.

Example

#[unsafe(no_mangle)]
pub extern "C" fn strlen(ptr: *mut f32) -> usize { 0 }
// suspicious definition of the `strlen` function
// `ptr` should be `*const std::ffi::c_char`

Explanation

Up-most care is required when defining runtime symbols assumed and used by the standard library. They must follow the C specification, not use any standard-library facility or undefined behavior may occur.

@rustbot labels +I-lang-nominated +T-lang +needs-fcp +A-lints
cc @rust-lang/lang-ops
r? compiler

Footnotes

  1. https://doc.rust-lang.org/core/index.html#how-to-use-the-core-library

@rustbot

rustbot commented Apr 19, 2026

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 19, 2026
@rustbot rustbot added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. I-lang-nominated Nominated for discussion during a lang team meeting. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. T-lang Relevant to the language team labels Apr 19, 2026
@rust-log-analyzer

This comment has been minimized.

@Urgau Urgau force-pushed the runtime-symbols branch from 46b7db0 to d81044c Compare April 19, 2026 16:26
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Urgau Urgau force-pushed the runtime-symbols branch from 4debba0 to 058c0e4 Compare April 19, 2026 19:43
@rust-log-analyzer

This comment has been minimized.

///
/// ### Explanation
///
/// Up-most care is required when defining runtime symbols assumed and

@PatchMixolydic PatchMixolydic Apr 19, 2026

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.

Nit:

Suggested change
/// Up-most care is required when defining runtime symbols assumed and
/// Utmost care is required when defining runtime symbols assumed and

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@traviscross traviscross added the P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang label Apr 19, 2026
@rust-log-analyzer

This comment has been minimized.

@Urgau Urgau force-pushed the runtime-symbols branch from 1b7638a to ed313a0 Compare April 20, 2026 06:11
@rust-log-analyzer

This comment has been minimized.

@Urgau Urgau force-pushed the runtime-symbols branch from ed313a0 to 0e3b44e Compare April 20, 2026 06:51
@rustbot

This comment has been minimized.

@traviscross

Copy link
Copy Markdown
Contributor

Thanks @Urgau for adjusting based on the feedback and moving this forward.

@rfcbot fcp merge lang

@traviscross traviscross added the I-lang-radar Items that are on lang's radar and will need eventual work or consideration. label Apr 22, 2026
@traviscross

This comment was marked as duplicate.

@jackh726

jackh726 commented Apr 22, 2026

Copy link
Copy Markdown
Member

Should this also include rust_eh_personality?

@steffahn

Copy link
Copy Markdown
Member

As far as I understood the lang meeting discussion, there was no concern with this PR.

But some opinion that it doesn’t fully replace the previous PR, since some warn-by-default lint more generally applicable (and to actually address the user reports, which were about open and read) might also be desirable. All of this can of course be follow-up work so it shouldn’t block us from getting the lint as in this PR; but it’s be useful to clarify that the user reports (currently mentioned in the OP of this PR) aren’t addressed yet with this PR merged, and in this regard this isn’t a full replacement of #146505.

@scottmcm

Copy link
Copy Markdown
Member

My interpretation here: this lint is valuable because the wrong signature for something on the well-known list is clearly and always wrong, so deny makes sense. We should have this lint. (And I'm find expanding to more functions so long as they meet that "definitely incontrovertibly wrong signature for that name that rustc or one of your linked libraries uses" bar. I don't know if we include extern function declarations in rlibs, but if this expanded to a general check that you're not conflicting with other rust libraries that'd also be cool -- not this PR I assume, though.)

Another lint, for "it's very suspicious that you're defining an unmangled open" kinds of things probably also makes sense. That might not be deny though, since it's not as unquestionably wrong. It's a rare case of a rustc lint where I'm plausibly fine with the only mitigation being to allow it, since you could just crate-level-allow it for those very few crates where doing this is intentional because it's trying to implement such things. (Notably if you're trying to define a memcpy you'll need to do extra steps already anyway, IIRC.) But that wouldn't be this PR.

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors p=1 to get around tree closure

@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 60c3805 failed: CI. Failed job:

@jhpratt

jhpratt commented Jun 26, 2026

Copy link
Copy Markdown
Member

@bors retry

@rust-bors

This comment has been minimized.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  TOOLSTATE_PUBLISH: 1
##[endgroup]
    Updating crates.io index
error: failed to get `simd-adler32` as a dependency of package `miniz_oxide v0.8.8`
    ... which satisfies dependency `miniz_oxide = "^0.8.5"` of package `flate2 v1.1.9`
    ... which satisfies dependency `flate2 = "^1.1.9"` of package `citool v0.1.0 (/home/runner/work/rust/rust/src/ci/citool)`

Caused by:
  failed to load source for dependency `simd-adler32`

Caused by:

@rust-bors

rust-bors Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 8e191f3 failed: CI. Failed job:

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors retry

@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

💔 Test for d7af889 failed: CI. Failed job:

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-llvm-22-3 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/issues/issue-107681-unwrap_unchecked.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs:17:12: error: CHECK: expected string not found in input
 // CHECK: [[RET:%.*]] = load i32, ptr [[INNER]]
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:11:24: note: scanning from here
 %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4
                       ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:11:24: note: with "INNER" equal to "%_7"
 %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4
                       ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:15:2: note: possible intended match here
 %_4 = load i32, ptr %_6, align 4, !noundef !4
 ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll
Check file: /checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'issue_107681_unwrap_unchecked.67fd71670d665894-cgu.0' 
            2: source_filename = "issue_107681_unwrap_unchecked.67fd71670d665894-cgu.0" 
            3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 
            4: target triple = "x86_64-unknown-linux-gnu" 
            5:  
            6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(read, argmem: readwrite, inaccessiblemem: write, target_mem0: none, target_mem1: none) uwtable 
            7: define noundef i32 @foo(ptr noalias nofree noundef align 8 captures(none) dereferenceable(16) %x) unnamed_addr #0 { 
            8: start: 
            9:  %0 = getelementptr inbounds nuw i8, ptr %x, i64 8 
           10:  %_6 = load ptr, ptr %0, align 8, !nonnull !4, !noundef !4 
           11:  %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4 
check:17'0                            X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:17'1                                                                 with "INNER" equal to "%_7"
           12:  %_8 = icmp ne ptr %_6, %_7 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           13:  %_14 = getelementptr inbounds nuw i8, ptr %_6, i64 4 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           14:  store ptr %_14, ptr %0, align 8 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           15:  %_4 = load i32, ptr %_6, align 4, !noundef !4 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:17'2      ?                                              possible intended match
           16:  tail call void @llvm.assume(i1 %_8) 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           17:  ret i32 %_4 
check:17'0     ~~~~~~~~~~~~~
           18: } 
check:17'0     ~~
           19:  
check:17'0     ~
           20: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           21: declare void @llvm.assume(i1 noundef) #1 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           22:  
check:17'0     ~
           23: attributes #0 = { mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(read, argmem: readwrite, inaccessiblemem: write, target_mem0: none, target_mem1: none) uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" } 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           24: attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           25:  
check:17'0     ~
           26: !llvm.module.flags = !{!0, !1, !2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           27: !llvm.ident = !{!3} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~
           28:  
check:17'0     ~
           29: !0 = !{i32 8, !"PIC Level", i32 2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           30: !1 = !{i32 2, !"RtLibUseGOT", i32 1} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           31: !2 = !{i32 7, !"uwtable", i32 2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           32: !3 = !{!"rustc version 1.98.0-nightly (d7af88977 2026-06-26)"} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           33: !4 = !{} 
check:17'0     ~~~~~~~~~
>>>>>>

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

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-22/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll" "/checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100" "--implicit-check-not" "br {{.*}}" "--implicit-check-not" "select"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs:17:12: error: CHECK: expected string not found in input
 // CHECK: [[RET:%.*]] = load i32, ptr [[INNER]]
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:11:24: note: scanning from here
 %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4
                       ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:11:24: note: with "INNER" equal to "%_7"
 %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4
                       ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:15:2: note: possible intended match here
 %_4 = load i32, ptr %_6, align 4, !noundef !4
 ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll
Check file: /checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'issue_107681_unwrap_unchecked.67fd71670d665894-cgu.0' 
            2: source_filename = "issue_107681_unwrap_unchecked.67fd71670d665894-cgu.0" 
            3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 
            4: target triple = "x86_64-unknown-linux-gnu" 
            5:  
            6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(read, argmem: readwrite, inaccessiblemem: write, target_mem0: none, target_mem1: none) uwtable 
            7: define noundef i32 @foo(ptr noalias nofree noundef align 8 captures(none) dereferenceable(16) %x) unnamed_addr #0 { 
            8: start: 
            9:  %0 = getelementptr inbounds nuw i8, ptr %x, i64 8 
           10:  %_6 = load ptr, ptr %0, align 8, !nonnull !4, !noundef !4 
           11:  %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4 
check:17'0                            X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:17'1                                                                 with "INNER" equal to "%_7"
           12:  %_8 = icmp ne ptr %_6, %_7 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           13:  %_14 = getelementptr inbounds nuw i8, ptr %_6, i64 4 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           14:  store ptr %_14, ptr %0, align 8 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           15:  %_4 = load i32, ptr %_6, align 4, !noundef !4 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:17'2      ?                                              possible intended match
           16:  tail call void @llvm.assume(i1 %_8) 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           17:  ret i32 %_4 
check:17'0     ~~~~~~~~~~~~~
           18: } 
check:17'0     ~~
           19:  
check:17'0     ~
           20: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           21: declare void @llvm.assume(i1 noundef) #1 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           22:  
check:17'0     ~
           23: attributes #0 = { mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(read, argmem: readwrite, inaccessiblemem: write, target_mem0: none, target_mem1: none) uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" } 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           24: attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           25:  
check:17'0     ~
           26: !llvm.module.flags = !{!0, !1, !2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           27: !llvm.ident = !{!3} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~
           28:  
check:17'0     ~
           29: !0 = !{i32 8, !"PIC Level", i32 2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           30: !1 = !{i32 2, !"RtLibUseGOT", i32 1} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           31: !2 = !{i32 7, !"uwtable", i32 2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           32: !3 = !{!"rustc version 1.98.0-nightly (d7af88977 2026-06-26)"} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           33: !4 = !{} 
check:17'0     ~~~~~~~~~
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs stdout end ----

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

This is possibly real? Haven't seen this spurious failure before
@bors r-
@bors try jobs=x86_64-gnu-llvm-22-3

@rust-bors

rust-bors Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 0f09409 failed: CI. Failed job:

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-llvm-22-3 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/issues/issue-107681-unwrap_unchecked.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs:17:12: error: CHECK: expected string not found in input
 // CHECK: [[RET:%.*]] = load i32, ptr [[INNER]]
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:11:24: note: scanning from here
 %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4
                       ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:11:24: note: with "INNER" equal to "%_7"
 %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4
                       ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:15:2: note: possible intended match here
 %_4 = load i32, ptr %_6, align 4, !noundef !4
 ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll
Check file: /checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'issue_107681_unwrap_unchecked.67fd71670d665894-cgu.0' 
            2: source_filename = "issue_107681_unwrap_unchecked.67fd71670d665894-cgu.0" 
            3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 
            4: target triple = "x86_64-unknown-linux-gnu" 
            5:  
            6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(read, argmem: readwrite, inaccessiblemem: write, target_mem0: none, target_mem1: none) uwtable 
            7: define noundef i32 @foo(ptr noalias nofree noundef align 8 captures(none) dereferenceable(16) %x) unnamed_addr #0 { 
            8: start: 
            9:  %0 = getelementptr inbounds nuw i8, ptr %x, i64 8 
           10:  %_6 = load ptr, ptr %0, align 8, !nonnull !4, !noundef !4 
           11:  %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4 
check:17'0                            X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:17'1                                                                 with "INNER" equal to "%_7"
           12:  %_8 = icmp ne ptr %_6, %_7 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           13:  %_14 = getelementptr inbounds nuw i8, ptr %_6, i64 4 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           14:  store ptr %_14, ptr %0, align 8 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           15:  %_4 = load i32, ptr %_6, align 4, !noundef !4 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:17'2      ?                                              possible intended match
           16:  tail call void @llvm.assume(i1 %_8) 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           17:  ret i32 %_4 
check:17'0     ~~~~~~~~~~~~~
           18: } 
check:17'0     ~~
           19:  
check:17'0     ~
           20: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           21: declare void @llvm.assume(i1 noundef) #1 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           22:  
check:17'0     ~
           23: attributes #0 = { mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(read, argmem: readwrite, inaccessiblemem: write, target_mem0: none, target_mem1: none) uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" } 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           24: attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           25:  
check:17'0     ~
           26: !llvm.module.flags = !{!0, !1, !2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           27: !llvm.ident = !{!3} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~
           28:  
check:17'0     ~
           29: !0 = !{i32 8, !"PIC Level", i32 2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           30: !1 = !{i32 2, !"RtLibUseGOT", i32 1} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           31: !2 = !{i32 7, !"uwtable", i32 2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           32: !3 = !{!"rustc version 1.98.0-nightly (0f09409de 2026-06-26)"} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           33: !4 = !{} 
check:17'0     ~~~~~~~~~
>>>>>>

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

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-22/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll" "/checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100" "--implicit-check-not" "br {{.*}}" "--implicit-check-not" "select"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs:17:12: error: CHECK: expected string not found in input
 // CHECK: [[RET:%.*]] = load i32, ptr [[INNER]]
           ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:11:24: note: scanning from here
 %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4
                       ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:11:24: note: with "INNER" equal to "%_7"
 %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4
                       ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll:15:2: note: possible intended match here
 %_4 = load i32, ptr %_6, align 4, !noundef !4
 ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/issues/issue-107681-unwrap_unchecked/issue-107681-unwrap_unchecked.ll
Check file: /checkout/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs

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

Input was:
<<<<<<
            1: ; ModuleID = 'issue_107681_unwrap_unchecked.67fd71670d665894-cgu.0' 
            2: source_filename = "issue_107681_unwrap_unchecked.67fd71670d665894-cgu.0" 
            3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 
            4: target triple = "x86_64-unknown-linux-gnu" 
            5:  
            6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(read, argmem: readwrite, inaccessiblemem: write, target_mem0: none, target_mem1: none) uwtable 
            7: define noundef i32 @foo(ptr noalias nofree noundef align 8 captures(none) dereferenceable(16) %x) unnamed_addr #0 { 
            8: start: 
            9:  %0 = getelementptr inbounds nuw i8, ptr %x, i64 8 
           10:  %_6 = load ptr, ptr %0, align 8, !nonnull !4, !noundef !4 
           11:  %_7 = load ptr, ptr %x, align 8, !nonnull !4, !noundef !4 
check:17'0                            X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:17'1                                                                 with "INNER" equal to "%_7"
           12:  %_8 = icmp ne ptr %_6, %_7 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           13:  %_14 = getelementptr inbounds nuw i8, ptr %_6, i64 4 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           14:  store ptr %_14, ptr %0, align 8 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           15:  %_4 = load i32, ptr %_6, align 4, !noundef !4 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:17'2      ?                                              possible intended match
           16:  tail call void @llvm.assume(i1 %_8) 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           17:  ret i32 %_4 
check:17'0     ~~~~~~~~~~~~~
           18: } 
check:17'0     ~~
           19:  
check:17'0     ~
           20: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           21: declare void @llvm.assume(i1 noundef) #1 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           22:  
check:17'0     ~
           23: attributes #0 = { mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(read, argmem: readwrite, inaccessiblemem: write, target_mem0: none, target_mem1: none) uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" } 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           24: attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           25:  
check:17'0     ~
           26: !llvm.module.flags = !{!0, !1, !2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           27: !llvm.ident = !{!3} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~
           28:  
check:17'0     ~
           29: !0 = !{i32 8, !"PIC Level", i32 2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           30: !1 = !{i32 2, !"RtLibUseGOT", i32 1} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           31: !2 = !{i32 7, !"uwtable", i32 2} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           32: !3 = !{!"rustc version 1.98.0-nightly (0f09409de 2026-06-26)"} 
check:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           33: !4 = !{} 
check:17'0     ~~~~~~~~~
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs stdout end ----

@Urgau

Urgau commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

This is possibly real? Haven't seen this spurious failure before

Looks like it's new spurious failure. I'm seeing in on other PRs (#158115 (comment)), and of course it doesn't reproduce locally for me.

Re-adding to the queue, hopefully it will pass next time 🤞

@bors r=davidtwco

@rust-bors

rust-bors Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 56d17c4 has been approved by davidtwco

It is now in the queue for this repository.

@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 390231d failed: CI. Failed job:

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors retry

@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

💔 Test for d12bbc8 failed: CI. Failed job:

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors retry

@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment was marked as outdated.

@rust-log-analyzer

This comment was marked as outdated.

@rust-bors

rust-bors Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: davidtwco
Duration: 3h 8m 7s
Pushing ce9954c to main...

@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing eb6346c (parent) -> ce9954c (this PR)

Test differences

Show 9 test diffs

Stage 1

  • [ui] tests/ui/lint/runtime-symbols.rs: [missing] -> pass (J0)
  • [ui (polonius)] tests/ui/lint/runtime-symbols.rs: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/lint/runtime-symbols.rs: [missing] -> pass (J2)

Additionally, 6 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard ce9954c0cfc4bf26b82aef16e6fd8b020c237992 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-rust-for-linux: 28m 8s -> 46m 48s (+66.3%)
  2. dist-i586-gnu-i586-i686-musl: 1h 5m -> 1h 33m (+42.5%)
  3. dist-various-2: 46m -> 28m 10s (-38.8%)
  4. x86_64-gnu-distcheck: 2h 19m -> 1h 26m (-38.3%)
  5. dist-riscv64-linux: 1h 29m -> 58m 2s (-34.8%)
  6. dist-x86_64-freebsd: 1h 11m -> 1h 32m (+30.0%)
  7. x86_64-msvc-2: 2h 25m -> 1h 48m (-25.2%)
  8. dist-i686-msvc: 2h 1m -> 1h 32m (-23.8%)
  9. dist-powerpc64-linux-gnu: 1h 16m -> 1h 33m (+22.1%)
  10. dist-armhf-linux: 1h 11m -> 1h 25m (+20.9%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (ce9954c): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

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

Max RSS (memory usage)

Results (primary 2.0%, secondary 2.0%)

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

mean range count
Regressions ❌
(primary)
2.0% [1.1%, 2.7%] 3
Regressions ❌
(secondary)
2.0% [1.6%, 2.1%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.0% [1.1%, 2.7%] 3

Cycles

Results (secondary 0.9%)

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)
4.2% [1.4%, 10.8%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.8%, -2.3%] 5
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 485.381s -> 486.597s (0.25%)
Artifact size: 392.99 MiB -> 395.64 MiB (0.67%)

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-CI Area: Our Github Actions CI A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-rust-for-linux Relevant for the Rust-for-Linux project A-testsuite Area: The testsuite used to check the correctness of rustc disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. merged-by-bors This PR was explicitly merged by bors. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-lang Relevant to the language team T-libs Relevant to the library team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.