Skip to content

Conversation

@nnethercote
Copy link
Contributor

r? @ghost

These should have been removed in rust-lang#139768, which removed the blanket
impls and separated the fallible/infallible method implementations.
The theory here is that this kind of pattern is very common:
```
    fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
        if matches!(t.kind(), ty::Param(..)) {
            return Ty::new_error(self.tcx, self.error());
        }
        t.super_fold_with(self)
    }
```
I.e. we match on the kind, do something specific for one (or a few) variants.
Otherwise, we fall back to `super_fold_with`, which also does a match on the
kind. By inlining `super_fold_with`, hopefully the optimizer can effectively
combine the two matches into one.
@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 Jan 13, 2026
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Jan 13, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 13, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 13, 2026

☀️ Try build successful (CI)
Build commit: ed52d0c (ed52d0cceed51178dafa6a3623c4b5e538bb4508, parent: 2f1bd3f3781c90a8447e37d65a898442b8618895)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ed52d0c): 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

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

Binary size

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

Bootstrap: 475.39s -> 472.016s (-0.71%)
Artifact size: 391.43 MiB -> 391.46 MiB (0.01%)

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

Labels

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.

3 participants