Skip to content

Commit 0c78648

Browse files
committed
Skip reinterning if nothing changed
1 parent 1dc6b2a commit 0c78648

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_mir_transform/src/reveal_all.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ impl<'tcx> MutVisitor<'tcx> for RevealAllVisitor<'tcx> {
3232
_context: PlaceContext,
3333
_location: Location,
3434
) {
35+
// Performance optimization: don't reintern if there is no `OpaqueCast` to remove.
36+
if place.projection.iter().all(|elem| !matches!(elem, ProjectionElem::OpaqueCast(_))) {
37+
return;
38+
}
3539
// `OpaqueCast` projections are only needed if there are opaque types on which projections are performed.
3640
// After the `RevealAll` pass, all opaque types are replaced with their hidden types, so we don't need these
3741
// projections anymore.

0 commit comments

Comments
 (0)