rustc: Add a fast path when the types to be unified are exactly equal

This commit is contained in:
Patrick Walton 2011-04-22 10:51:32 -07:00
parent 9edaa7dba3
commit 106f783b33

View file

@ -1877,6 +1877,9 @@ mod Unify {
// TODO: occurs check, to make sure we don't loop forever when
// unifying e.g. 'a and option['a]
// Fast path.
if (eq_ty(expected, actual)) { ret ures_ok(expected); }
alt (actual.struct) {
// If the RHS is a variable type, then just do the appropriate
// binding.