Skip to content

Remove uninit drops after building MIR - #160442

Draft
cjgillot wants to merge 3 commits into
rust-lang:mainfrom
cjgillot:remove-uninit-drops
Draft

Remove uninit drops after building MIR#160442
cjgillot wants to merge 3 commits into
rust-lang:mainfrom
cjgillot:remove-uninit-drops

Conversation

@cjgillot

@cjgillot cjgillot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

r? @ghost

@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. labels Aug 3, 2026
@cjgillot

cjgillot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

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

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
Remove uninit drops after building MIR
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 71397a5 (71397a59747fe3fec51e3238c9bc2dca5f03997e)
Base parent: 7c329d6 (7c329d6c76e11ca40c5673818ab0439c1be8962c)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (71397a5): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@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)
1.2% [0.1%, 4.2%] 82
Regressions ❌
(secondary)
1.1% [0.2%, 4.2%] 96
Improvements ✅
(primary)
-0.7% [-1.4%, -0.2%] 20
Improvements ✅
(secondary)
-0.8% [-2.3%, -0.1%] 18
All ❌✅ (primary) 0.9% [-1.4%, 4.2%] 102

Max RSS (memory usage)

Results (primary -0.7%, 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)
1.0% [0.5%, 1.6%] 8
Regressions ❌
(secondary)
2.1% [0.5%, 6.6%] 8
Improvements ✅
(primary)
-2.1% [-4.7%, -0.8%] 10
Improvements ✅
(secondary)
-1.0% [-1.5%, -0.4%] 5
All ❌✅ (primary) -0.7% [-4.7%, 1.6%] 18

Cycles

Results (primary 2.6%, secondary 1.5%)

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

mean range count
Regressions ❌
(primary)
2.9% [0.5%, 4.8%] 34
Regressions ❌
(secondary)
2.4% [0.4%, 5.5%] 23
Improvements ✅
(primary)
-1.4% [-2.6%, -0.5%] 3
Improvements ✅
(secondary)
-0.8% [-2.7%, -0.4%] 10
All ❌✅ (primary) 2.6% [-2.6%, 4.8%] 37

Binary size

Results (primary -0.5%, secondary -0.4%)

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

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.5%] 6
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 3
Improvements ✅
(primary)
-0.5% [-2.7%, -0.0%] 106
Improvements ✅
(secondary)
-0.5% [-2.7%, -0.0%] 53
All ❌✅ (primary) -0.5% [-2.7%, 0.5%] 112

Bootstrap: 491.018s -> 509.55s (3.77%)
Artifact size: 390.29 MiB -> 390.17 MiB (-0.03%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 3, 2026
@cjgillot
cjgillot force-pushed the remove-uninit-drops branch from f62a5c7 to 53de634 Compare August 3, 2026 23:15
@cjgillot

cjgillot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

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

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
Remove uninit drops after building MIR
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-next-trait-solver-polonius failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

failures:

---- [ui (polonius)] tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.polonius/unboxed-closures-failed-recursive-fn-1.polonius.stderr`
diff of stderr:

- error[E0597]: `factorial` does not live long enough
-   --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:15:17
-    |
- LL |     let mut factorial: Option<Box<dyn Fn(u32) -> u32>> = None;
-    |         ------------- binding `factorial` declared here
- LL |
- LL |     let f = |x: u32| -> u32 {
-    |             --------------- value captured here
- LL |         let g = factorial.as_ref().unwrap();
-    |                 ^^^^^^^^^ borrowed value does not live long enough
- ...
- LL | }
-    | -
-    | |
-    | `factorial` dropped here while still borrowed
-    | borrow might be used here, when `factorial` is dropped and runs the destructor for type `Option<Box<dyn Fn(u32) -> u32>>`
- 
18 error[E0506]: cannot assign to `factorial` because it is borrowed
19   --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:20:5
20    |

29    |     `factorial` is assigned to here but it was already borrowed
30    |     borrow later used here
31 
- error[E0597]: `factorial` does not live long enough
-   --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:28:17
-    |
- LL |     let mut factorial: Option<Box<dyn Fn(u32) -> u32 + 'static>> = None;
-    |         -------------  ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static`
-    |         |
-    |         binding `factorial` declared here
- LL |
- LL |     let f = |x: u32| -> u32 {
-    |             --------------- value captured here
- LL |         let g = factorial.as_ref().unwrap();
-    |                 ^^^^^^^^^ borrowed value does not live long enough
- ...
- LL | }
-    | - `factorial` dropped here while still borrowed
- 
48 error[E0506]: cannot assign to `factorial` because it is borrowed
49   --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:33:5
50    |

---
To only update this specific test, also pass `--test-args unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/checkout/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.polonius" "-Zpolonius=next" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0506]: cannot assign to `factorial` because it is borrowed
##[error]  --> /checkout/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs:20:5
   |
LL |     let f = |x: u32| -> u32 {
   |             --------------- `factorial` is borrowed here
LL |         let g = factorial.as_ref().unwrap();
   |                 --------- borrow occurs due to use in closure
...
LL |     factorial = Some(Box::new(f));
   |     ^^^^^^^^^
   |     |
   |     `factorial` is assigned to here but it was already borrowed
   |     borrow later used here

error[E0506]: cannot assign to `factorial` because it is borrowed
##[error]  --> /checkout/tests/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs:33:5
   |
LL |     let mut factorial: Option<Box<dyn Fn(u32) -> u32 + 'static>> = None;
   |                        ----------------------------------------- type annotation requires that `factorial` is borrowed for `'static`
LL |
LL |     let f = |x: u32| -> u32 {
   |             --------------- `factorial` is borrowed here
LL |         let g = factorial.as_ref().unwrap();
   |                 --------- borrow occurs due to use in closure
...
LL |     factorial = Some(Box::new(f));
   |     ^^^^^^^^^ `factorial` is assigned to here but it was already borrowed

error: aborting due to 2 previous errors

Important

For more information how to resolve CI failures of this job, visit this link.

@rust-bors

rust-bors Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: ea35837 (ea358370493e8c9cdc1e5bf91eb9fddb8afbd72e)
Base parent: 5048696 (504869653f510b279c542e65ccd1ea9710c119ba)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (ea35837): comparison URL.

Overall result: ❌ regressions - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@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.9% [0.2%, 2.6%] 88
Regressions ❌
(secondary)
0.9% [0.2%, 2.5%] 86
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [0.2%, 2.6%] 88

Max RSS (memory usage)

Results (primary 0.5%, 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)
1.6% [0.5%, 5.4%] 11
Regressions ❌
(secondary)
2.0% [0.4%, 6.6%] 12
Improvements ✅
(primary)
-1.4% [-2.5%, -0.8%] 6
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [-2.5%, 5.4%] 17

Cycles

Results (primary 1.7%, secondary 5.9%)

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

mean range count
Regressions ❌
(primary)
2.0% [0.4%, 3.8%] 15
Regressions ❌
(secondary)
9.2% [0.5%, 25.0%] 11
Improvements ✅
(primary)
-0.8% [-1.2%, -0.5%] 2
Improvements ✅
(secondary)
-1.4% [-4.1%, -0.4%] 5
All ❌✅ (primary) 1.7% [-1.2%, 3.8%] 17

Binary size

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

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

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.8%] 10
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.3%, -0.0%] 32
Improvements ✅
(secondary)
-0.4% [-1.1%, -0.0%] 21
All ❌✅ (primary) -0.0% [-0.3%, 0.8%] 42

Bootstrap: 491.182s -> 491.564s (0.08%)
Artifact size: 390.23 MiB -> 390.12 MiB (-0.03%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants