Skip to content

Conversation

@BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Nov 2, 2025

r? @ghost

This has three main effects:
1. we now leak check for closure->fnptr and fnptr->closure coercions
2. we now leak check normal subtyping in HIR typeck when going through coercions
3. we now leak check normal lubbing when there is no coercion
@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 Nov 2, 2025
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Nov 2, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 2, 2025
[PERF] non behavior changing coercion changes
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 2, 2025
@rust-bors
Copy link

rust-bors bot commented Nov 2, 2025

☀️ Try build successful (CI)
Build commit: 7a58efb (7a58efbaffa8988bd6eb238f5098444b74216db1, parent: 8483293b3b4eb209e8e8bd0d069e61de790018a8)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7a58efb): comparison URL.

Overall result: no relevant changes - 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

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (secondary -3.2%)

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

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 473.503s -> 473.376s (-0.03%)
Artifact size: 390.87 MiB -> 390.84 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 3, 2025
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Nov 3, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 3, 2025
[PERF] non behavior changing coercion changes
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 3, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Nov 3, 2025

☀️ Try build successful (CI)
Build commit: a803a24 (a803a241710ac8e33643fc524092d4fd8de7610f, parent: f2bae990e89bf696e86706b524ac32ab72945438)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a803a24): comparison URL.

Overall result: ❌ regressions - please read the text below

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.6% [0.1%, 1.7%] 17
Regressions ❌
(secondary)
1.4% [0.1%, 5.0%] 33
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [0.1%, 1.7%] 17

Max RSS (memory usage)

Results (primary 0.2%, 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.6% [1.8%, 3.7%] 3
Regressions ❌
(secondary)
1.5% [1.5%, 1.5%] 1
Improvements ✅
(primary)
-1.6% [-2.8%, -0.8%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [-2.8%, 3.7%] 7

Cycles

Results (primary -2.0%, secondary 3.6%)

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)
3.6% [2.5%, 4.7%] 9
Improvements ✅
(primary)
-2.0% [-2.0%, -2.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.0% [-2.0%, -2.0%] 1

Binary size

Results (primary 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.1% [0.1%, 0.2%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.0%, 0.2%] 4

Bootstrap: 475.169s -> 474.06s (-0.23%)
Artifact size: 390.81 MiB -> 390.81 MiB (-0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 3, 2025
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Nov 3, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 3, 2025
[PERF] non behavior changing coercion changes
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 3, 2025
@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
[TIMING:end] tool::ToolBuild { build_compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 10.507
[TIMING:end] tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/compiler/rustc_hir_typeck/src/coercion.rs:1168:
             if is_capturing_closure(prev_ty) || is_capturing_closure(new_ty) {
                 (None, None)
             } else {
-                let lubbed_tys = || self.commit_if_ok(|snapshot| {
-                    let outer_universe = self.infcx.universe();
+                let lubbed_tys = || {
+                    self.commit_if_ok(|snapshot| {
+                        let outer_universe = self.infcx.universe();
 
-                    // We need to eagerly handle nested obligations due to lazy norm.
-                    let result = if self.next_trait_solver() {
-                        let ocx = ObligationCtxt::new(self);
-                        let value = ocx.lub(cause, self.param_env, prev_ty, new_ty)?;
-                        if ocx.try_evaluate_obligations().is_empty() {
-                            Ok(InferOk { value, obligations: ocx.into_pending_obligations() })
+                        // We need to eagerly handle nested obligations due to lazy norm.
+                        let result = if self.next_trait_solver() {
+                            let ocx = ObligationCtxt::new(self);
+                            let value = ocx.lub(cause, self.param_env, prev_ty, new_ty)?;
+                            if ocx.try_evaluate_obligations().is_empty() {
+                                Ok(InferOk { value, obligations: ocx.into_pending_obligations() })
+                            } else {
+                                Err(TypeError::Mismatch)
+                            }
                         } else {
-                            Err(TypeError::Mismatch)
-                        }
-                    } else {
-                        self.at(cause, self.param_env).lub(prev_ty, new_ty)
-                    };
+                            self.at(cause, self.param_env).lub(prev_ty, new_ty)
+                        };
 
-                    self.leak_check(outer_universe, Some(snapshot))?;
-                    result
-                });
+                        self.leak_check(outer_universe, Some(snapshot))?;
+                        result
+                    })
+                };
 
                 match (prev_ty.kind(), new_ty.kind()) {
                     // Don't coerce pairs of fndefs or pairs of closures to fn ptrs
fmt: checked 6519 files
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Build completed unsuccessfully in 0:00:47
  local time: Mon Nov  3 18:01:21 UTC 2025
  network time: Mon, 03 Nov 2025 18:01:21 GMT

@rust-bors
Copy link

rust-bors bot commented Nov 3, 2025

☀️ Try build successful (CI)
Build commit: 89acb14 (89acb145aa646f0ff9d994a9b762f383b266450d, parent: f5711a55f5d5e2f942057d0f6d648dd2d8b2c37b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (89acb14): comparison URL.

Overall result: ❌ regressions - please read the text below

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.2% [0.2%, 0.3%] 22
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (secondary -3.2%)

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
Improvements ✅
(secondary)
-3.2% [-4.0%, -2.4%] 2
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 474.205s -> 499.227s (5.28%)
Artifact size: 390.90 MiB -> 390.85 MiB (-0.01%)

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