Skip to content

Implement MaybeDangling compiler support#150447

Open
WaffleLapkin wants to merge 6 commits intorust-lang:mainfrom
WaffleLapkin:maybe-dangling-semantics
Open

Implement MaybeDangling compiler support#150447
WaffleLapkin wants to merge 6 commits intorust-lang:mainfrom
WaffleLapkin:maybe-dangling-semantics

Conversation

@WaffleLapkin
Copy link
Member

@WaffleLapkin WaffleLapkin commented Dec 27, 2025

View all comments

Tracking issue: #118166

cc @RalfJung

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 27, 2025
@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch 2 times, most recently from aebfd56 to 63e07cf Compare December 27, 2025 21:28
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Feb 19, 2026
@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch from 6d96bdb to d71787d Compare February 19, 2026 18:35
@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch 2 times, most recently from f6fafff to baa9118 Compare February 19, 2026 23:25
@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch from baa9118 to c135ac1 Compare February 23, 2026 16:07
@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch from c135ac1 to f399322 Compare February 25, 2026 23:07
@rustbot rustbot added the PG-exploit-mitigations Project group: Exploit mitigations label Feb 25, 2026
@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch 3 times, most recently from 8bbf80d to a72a3f3 Compare February 25, 2026 23:34
@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch from a72a3f3 to 42ce338 Compare February 26, 2026 12:26
@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch 2 times, most recently from 51a5c77 to efc351d Compare February 26, 2026 13:52
@WaffleLapkin
Copy link
Member Author

@RalfJung this is finally ready for review :)

Let me know if you'd prefer the PointeeInfo changes in a separate PR.

@rust-bors

This comment has been minimized.

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

This looks generally great, thanks! Nice cleanup for getting rid of those align 1 everywhere.

I left some comments. I don't understand why the may_dangle field exists. Please resolve the conflicts so we can do a perf run.

View changes since this review

@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 Mar 1, 2026
@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch from efc351d to 8102f65 Compare March 2, 2026 13:43
@rustbot
Copy link
Collaborator

rustbot commented Mar 2, 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.

@theemathas
Copy link
Contributor

This PR can result in stable code using ManuallyDrop getting less optimization, right?

@WaffleLapkin
Copy link
Member Author

@theemathas yes. Importantly also less UB ^^'

@RalfJung
Copy link
Member

RalfJung commented Mar 2, 2026

Indeed, that is the intent of this PR. ;)

Note that this PR does not guarantee the absence of those optimizations on stable. It only guarantees it for code that uses MaybeDangling directly, which remains unstable.

@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch from 395a073 to 62cbdee Compare March 2, 2026 15:48
// Handle safe Rust thin and wide pointers.
/// Returns argument attributes for a scalar argument.
///
/// `drop_target_pointee` is used to special-case the argument of `ptr::drop_in_place`,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// `drop_target_pointee` is used to special-case the argument of `ptr::drop_in_place`,
/// `drop_target_pointee`, if set, causes the scalar, if it is a pointer, to be treated as a mutable
/// reference to the given type. This is used to special-case the argument of `ptr::drop_in_place`,

This is unlike before where that treatment only happened if the scalar was by itself not already a safe pointer -- right?

Copy link
Member Author

Choose a reason for hiding this comment

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

if it is a pointer

that is not quite correct, we have an assertion that it's a pointer, not a check.

This is unlike before where that treatment only happened if the scalar was by itself not already a safe pointer -- right?

Yes, before it happened if the scalar was a pointer, and specifically a raw one.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, please make the docs whatever the correct thing is then. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tried to clarify the docs, is this better?

/// Indicates whether the type is `FieldRepresentingType`.
const IS_FIELD_REPRESENTING_TYPE = 1 << 13;
/// Indicates whether the type is `MaybeDangling<_>`.
const IS_MAYBE_DANGLING = 1 << 14;
Copy link
Member

Choose a reason for hiding this comment

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

Most of these are mutually exclusive so it is a huge waste of bits to have a separate bit for each of them... 🤷 that's pre-existing though, not for this PR to fix.

Make `size`/`align` always correct rather than conditionally on the
`safe` field. This makes it less error prone and easier to work with for
`MaybeDangling` / potential future pointer kinds like `Aligned<_>`.
Instead of defaulting to `None` it now defaults to `Align::ONE` i.e.
no alignment restriction. Codegen test changes are due to us now skipping
`align 1` annotations (they are useless; not skipping them makes all the
raw pointers gain an `align 1` annotation which doesn't seem any good)
@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch from 62cbdee to 24012bc Compare March 3, 2026 10:07
@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch from 24012bc to f308311 Compare March 3, 2026 10:54
@WaffleLapkin
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 3, 2026

⌛ Trying commit f308311 with merge e147e93

To cancel the try build, run the command @bors try cancel.

Workflow: https://github.com/rust-lang/rust/actions/runs/22619884618

rust-bors bot pushed a commit that referenced this pull request Mar 3, 2026
Implement `MaybeDangling` compiler support
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 3, 2026
@rust-log-analyzer
Copy link
Collaborator

The job 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)
/dev/sda15      105M  6.2M   99M   6% /boot/efi
tmpfs           1.6G   12K  1.6G   1% /run/user/1001
================================================================================

Sufficient disk space available (94917444KB >= 52428800KB). Skipping cleanup.
##[group]Run echo "[CI_PR_NUMBER=$num]"
echo "[CI_PR_NUMBER=$num]"
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
test num::bignum::test_ord ... ok
test num::bignum::test_sub ... ok
test num::bignum::test_sub_underflow_1 ... ok
test num::bignum::test_sub_underflow_2 ... ok
test num::carryless_mul::carrying_carryless_mul ... ok
test num::carryless_mul::carryless_mul_u128 ... ok
test num::carryless_mul::carryless_mul_u16 ... ok
test num::carryless_mul::carryless_mul_u32 ... ok
test num::carryless_mul::carryless_mul_u64 ... ok
test num::carryless_mul::carryless_mul_u8 ... ok
test num::carryless_mul::widening_carryless_mul ... ok
test num::const_from::from ... ok
test num::dec2flt::decimal::check_fast_path_f16 ... ok
test num::dec2flt::decimal::check_fast_path_f32 ... ok
test num::dec2flt::decimal::check_fast_path_f64 ... ok
test num::dec2flt::decimal_seq::test_parse ... ok
---
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap (line 72) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,RandomState>::new (line 264) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,RandomState>::from (line 1504) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,RandomState>::with_capacity (line 283) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::capacity (line 445) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::clear (line 819) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::contains_key (line 1220) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::drain (line 721) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::entry (line 959) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get (line 987) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::extract_if (line 761) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_disjoint_mut (line 1077) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_disjoint_mut (line 1119) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::hasher (line 837) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_disjoint_unchecked_mut (line 1162) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_key_value (line 1017) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_mut (line 1247) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::insert (line 1280) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::into_iter (line 2053) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::into_keys (line 491) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::into_values (line 586) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::is_empty (line 698) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::iter (line 618) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::iter_mut (line 648) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::keys (line 461) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::len (line 681) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::remove (line 1339) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::remove_entry (line 1367) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::reserve (line 870) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::retain (line 792) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::shrink_to (line 937) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::shrink_to_fit (line 913) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::try_insert (line 1309) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::try_reserve (line 895) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::values (line 523) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S>::with_capacity_and_hasher (line 383) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::values_mut (line 552) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S>::with_hasher (line 351) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::IntoIter (line 1611) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::IntoKeys (line 1843) ... ok
---
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,RandomState>::new (line 142) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,RandomState>::with_capacity (line 161) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::capacity (line 313) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,RandomState>::from (line 1180) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::clear (line 490) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::contains (line 758) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::drain (line 398) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::difference (line 630) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::entry (line 861) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::extract_if (line 434) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::get (line 783) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::get_or_insert (line 805) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::hasher (line 508) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::get_or_insert_with (line 829) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::insert (line 983) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::intersection (line 697) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::into_iter (line 1643) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::is_disjoint (line 903) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::is_empty (line 375) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::iter (line 329) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::is_superset (line 951) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::is_subset (line 929) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::len (line 357) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::reserve (line 541) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::remove (line 1030) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::replace (line 1004) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::retain (line 465) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::shrink_to (line 607) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::shrink_to_fit (line 584) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::symmetric_difference (line 660) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::take (line 1058) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::try_reserve (line 567) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S>::with_capacity_and_hasher (line 255) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::union (line 726) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S>::with_hasher (line 223) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::Intersection (line 1507) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::Iter (line 1392) ... ok
---

---- [codegen] tests/codegen-llvm/maybe_dangling_refs.rs stdout ----
------FileCheck stdout------------------------------

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

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

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

Input was:
<<<<<<
            1: ; ModuleID = 'maybe_dangling_refs.9ac11b7eb2eadbaf-cgu.0' 
check:12'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            2: source_filename = "maybe_dangling_refs.9ac11b7eb2eadbaf-cgu.0" 
check:12'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" 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4: target triple = "wasm32-unknown-wasip1" 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            5:  
check:12'0     ~
            6: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
            7: define dso_local noundef nonnull ptr @f(ptr noundef nonnull %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:12'1               ?                                                                        possible intended match
            8: start: 
check:12'0     ~~~~~~~
            9:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           10: } 
check:12'0     ~~
           11:  
check:12'0     ~
           12: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           13: define dso_local noundef nonnull ptr @g(ptr noundef nonnull %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           14: start: 
check:12'0     ~~~~~~~
           15:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           16: } 
check:12'0     ~~
           17:  
check:12'0     ~
           18: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           19: define dso_local noundef nonnull ptr @h(ptr noundef nonnull %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           20: start: 
check:12'0     ~~~~~~~
           21:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           22: } 
check:12'0     ~~
           23:  
check:12'0     ~
           24: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           25: define dso_local noundef nonnull align 4 ptr @i(ptr noundef nonnull align 4 %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           26: start: 
check:12'0     ~~~~~~~
           27:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           28: } 
check:12'0     ~~
           29:  
check:12'0     ~
           30: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           31: define dso_local noundef nonnull align 4 ptr @j(ptr noundef nonnull align 4 %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           32: start: 
check:12'0     ~~~~~~~
           33:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           34: } 
check:12'0     ~~
           35:  
check:12'0     ~
           36: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           37: define dso_local noundef nonnull align 4 ptr @k(ptr noundef nonnull align 4 %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           38: start: 
check:12'0     ~~~~~~~
           39:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           40: } 
check:12'0     ~~
           41:  
check:12'0     ~
           42: attributes #0 = { nounwind "target-cpu"="generic" } 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           43:  
check:12'0     ~
           44: !llvm.ident = !{!0} 
check:12'0     ~~~~~~~~~~~~~~~~~~~~
           45:  
check:12'0     ~
           46: !0 = !{!"rustc version 1.96.0-nightly (257af5fcb 2026-03-03)"} 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>

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

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/maybe_dangling_refs/maybe_dangling_refs.ll" "/checkout/tests/codegen-llvm/maybe_dangling_refs.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/maybe_dangling_refs.rs:12:11: error: CHECK: expected string not found in input
// CHECK: define noundef nonnull ptr @f(ptr noundef nonnull %x) unnamed_addr
          ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/maybe_dangling_refs/maybe_dangling_refs.ll:1:1: note: scanning from here
; ModuleID = 'maybe_dangling_refs.9ac11b7eb2eadbaf-cgu.0'
^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/maybe_dangling_refs/maybe_dangling_refs.ll:7:11: note: possible intended match here
define dso_local noundef nonnull ptr @f(ptr noundef nonnull %x) unnamed_addr #0 {
          ^

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

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

Input was:
<<<<<<
            1: ; ModuleID = 'maybe_dangling_refs.9ac11b7eb2eadbaf-cgu.0' 
check:12'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            2: source_filename = "maybe_dangling_refs.9ac11b7eb2eadbaf-cgu.0" 
check:12'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" 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4: target triple = "wasm32-unknown-wasip1" 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            5:  
check:12'0     ~
            6: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
            7: define dso_local noundef nonnull ptr @f(ptr noundef nonnull %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:12'1               ?                                                                        possible intended match
            8: start: 
check:12'0     ~~~~~~~
            9:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           10: } 
check:12'0     ~~
           11:  
check:12'0     ~
           12: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           13: define dso_local noundef nonnull ptr @g(ptr noundef nonnull %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           14: start: 
check:12'0     ~~~~~~~
           15:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           16: } 
check:12'0     ~~
           17:  
check:12'0     ~
           18: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           19: define dso_local noundef nonnull ptr @h(ptr noundef nonnull %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           20: start: 
check:12'0     ~~~~~~~
           21:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           22: } 
check:12'0     ~~
           23:  
check:12'0     ~
           24: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           25: define dso_local noundef nonnull align 4 ptr @i(ptr noundef nonnull align 4 %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           26: start: 
check:12'0     ~~~~~~~
           27:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           28: } 
check:12'0     ~~
           29:  
check:12'0     ~
           30: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           31: define dso_local noundef nonnull align 4 ptr @j(ptr noundef nonnull align 4 %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           32: start: 
check:12'0     ~~~~~~~
           33:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           34: } 
check:12'0     ~~
           35:  
check:12'0     ~
           36: ; Function Attrs: nounwind 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           37: define dso_local noundef nonnull align 4 ptr @k(ptr noundef nonnull align 4 %x) unnamed_addr #0 { 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           38: start: 
check:12'0     ~~~~~~~
           39:  ret ptr %x 
check:12'0     ~~~~~~~~~~~~
           40: } 
check:12'0     ~~
           41:  
check:12'0     ~
           42: attributes #0 = { nounwind "target-cpu"="generic" } 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           43:  
check:12'0     ~
           44: !llvm.ident = !{!0} 
check:12'0     ~~~~~~~~~~~~~~~~~~~~
           45:  
check:12'0     ~
           46: !0 = !{!"rustc version 1.96.0-nightly (257af5fcb 2026-03-03)"} 
check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/maybe_dangling_refs.rs stdout end ----

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

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants