Skip to content

Commit bb64fd1

Browse files
committed
Specialize the (0, 0) case too.
1 parent 9d00e33 commit bb64fd1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

compiler/rustc_type_ir/src/fast_reject.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,12 @@ impl<I: Interner, const INSTANTIATE_LHS_WITH_INFER: bool, const INSTANTIATE_RHS_
247247
}
248248
};
249249

250-
// Specialize the common `(1, 1)` case to avoid iterator machinery.
251-
if let ([obl], [imp]) = (obligation_args.as_slice(), impl_args.as_slice()) {
252-
return may_unify((*obl, *imp));
250+
// Specialize the common `(1, 1)` and `(0, 0)` cases to avoid iterator machinery.
251+
match (obligation_args.as_slice(), impl_args.as_slice()) {
252+
([obl], [imp]) => may_unify((*obl, *imp)),
253+
([], []) => true,
254+
_ => iter::zip(obligation_args.iter(), impl_args.iter()).all(may_unify),
253255
}
254-
255-
iter::zip(obligation_args.iter(), impl_args.iter()).all(may_unify)
256256
}
257257

258258
fn types_may_unify_inner(self, lhs: I::Ty, rhs: I::Ty, depth: usize) -> bool {

0 commit comments

Comments
 (0)