Skip to content

Implement MaybeDangling compiler support#150447

Merged
rust-bors[bot] merged 6 commits intorust-lang:mainfrom
WaffleLapkin:maybe-dangling-semantics
Mar 5, 2026
Merged

Implement MaybeDangling compiler support#150447
rust-bors[bot] merged 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
@rust-bors

This comment has been minimized.

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

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 3, 2026

☀️ Try build successful (CI)
Build commit: e147e93 (e147e934a1e67cc70979480d1f951518bb5f7dbe, parent: 1b7d722f429f09c87b08b757d89c689c6cf7f6e7)

@rust-timer

This comment has been minimized.

@WaffleLapkin WaffleLapkin force-pushed the maybe-dangling-semantics branch from 632b33d to d5e1b0e Compare March 3, 2026 13:30
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e147e93): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -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.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
-0.3% [-0.3%, -0.3%] 1
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 2
All ❌✅ (primary) -0.3% [-0.3%, -0.3%] 1

Max RSS (memory usage)

Results (primary -0.8%, secondary -1.3%)

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)
1.3% [1.3%, 1.3%] 1
Improvements ✅
(primary)
-0.8% [-0.8%, -0.8%] 1
Improvements ✅
(secondary)
-3.8% [-3.8%, -3.8%] 1
All ❌✅ (primary) -0.8% [-0.8%, -0.8%] 1

Cycles

Results (secondary 1.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)
6.9% [6.9%, 6.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.1%, -3.1%] 1
All ❌✅ (primary) - - 0

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%] 2
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 1

Bootstrap: 479.356s -> 478.805s (-0.11%)
Artifact size: 396.94 MiB -> 394.94 MiB (-0.50%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 3, 2026
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.

I like the new test, thanks. :)

Minor nit on the doc comment. IIUC the scalar is only treated like &mut if it's a ptr scalar; if it is an int, drop_target_pointee gets ignored.

r=me with that fixed. Thanks so much for finally pushing this forward ❤️

View changes since this review

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 d5e1b0e to d6ca5c3 Compare March 5, 2026 10:53
@WaffleLapkin
Copy link
Member Author

@bors r=RalfJung

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 5, 2026

📌 Commit d6ca5c3 has been approved by RalfJung

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 5, 2026
@JonathanBrouwer
Copy link
Contributor

@bors p=6
Scheduling this before the next rollup

@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 5, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 5, 2026

☀️ Test successful - CI
Approved by: RalfJung
Duration: 3h 41m 22s
Pushing 64b72a1 to main...

@rust-bors rust-bors bot merged commit 64b72a1 into rust-lang:main Mar 5, 2026
12 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

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 70d86e3 (parent) -> 64b72a1 (this PR)

Test differences

Show 21 test diffs

Stage 1

  • [codegen] tests/codegen-llvm/maybe_dangling_refs.rs: [missing] -> pass (J0)

Stage 2

  • [codegen] tests/codegen-llvm/maybe_dangling_refs.rs: [missing] -> pass (J1)

Additionally, 19 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 64b72a1fa5449d928d5f553b01a596b78ee255d2 --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. dist-x86_64-illumos: 2h 16m -> 1h 45m (-22.6%)
  2. dist-aarch64-llvm-mingw: 1h 55m -> 1h 33m (-18.8%)
  3. x86_64-gnu-aux: 2h 1m -> 2h 21m (+16.5%)
  4. test-various: 1h 51m -> 2h 7m (+14.9%)
  5. dist-apple-various: 2h 7m -> 1h 49m (-13.9%)
  6. dist-aarch64-apple: 2h 34m -> 2h 13m (-13.7%)
  7. dist-aarch64-msvc: 1h 48m -> 1h 37m (-10.4%)
  8. aarch64-gnu: 2h 4m -> 2h 16m (+9.6%)
  9. aarch64-apple: 3h 18m -> 3h 34m (+8.1%)
  10. dist-x86_64-apple: 2h 34m -> 2h 22m (-7.6%)
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.

@WaffleLapkin WaffleLapkin deleted the maybe-dangling-semantics branch March 5, 2026 16:34
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (64b72a1): 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.5% [-0.5%, -0.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-0.5%, -0.5%] 1

Max RSS (memory usage)

Results (primary 0.3%, secondary 3.5%)

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

mean range count
Regressions ❌
(primary)
1.7% [0.8%, 2.7%] 2
Regressions ❌
(secondary)
3.5% [3.4%, 3.6%] 2
Improvements ✅
(primary)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [-2.5%, 2.7%] 3

Cycles

Results (primary -1.3%, secondary -4.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)
-1.3% [-1.3%, -1.3%] 1
Improvements ✅
(secondary)
-4.0% [-4.0%, -4.0%] 1
All ❌✅ (primary) -1.3% [-1.3%, -1.3%] 1

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%] 2
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 1

Bootstrap: 480.787s -> 479.735s (-0.22%)
Artifact size: 395.02 MiB -> 395.00 MiB (-0.00%)

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. merged-by-bors This PR was explicitly merged by bors. PG-exploit-mitigations Project group: Exploit mitigations 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.

9 participants