Skip to content

Commit cbd67db

Browse files
Don't fold in Instantiate when there's nothing to fold
1 parent 100199c commit cbd67db

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_type_ir/src/binder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,10 @@ impl<I: Interner, T: TypeFoldable<I>> ty::EarlyBinder<I, T> {
622622
where
623623
A: SliceLike<Item = I::GenericArg>,
624624
{
625+
// Nothing to fold.
626+
if !cfg!(debug_assertions) && args.is_empty() {
627+
return self.value;
628+
}
625629
let mut folder = ArgFolder { cx, args: args.as_slice(), binders_passed: 0 };
626630
self.value.fold_with(&mut folder)
627631
}

0 commit comments

Comments
 (0)