Skip to content

Commit febb16a

Browse files
committed
type_ir: add faster exit for types_may_unify
1 parent a5e1dba commit febb16a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_type_ir/src/fast_reject.rs

+3
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ impl<I: Interner, const INSTANTIATE_LHS_WITH_INFER: bool, const INSTANTIATE_RHS_
232232
}
233233

234234
pub fn types_may_unify(self, lhs: I::Ty, rhs: I::Ty) -> bool {
235+
if lhs == rhs {
236+
return true;
237+
}
235238
self.types_may_unify_inner(lhs, rhs, Self::STARTING_DEPTH)
236239
}
237240

0 commit comments

Comments
 (0)