From 106f783b33f64cfc364b7aa2e5f57bcd07e9bfb8 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 22 Apr 2011 10:51:32 -0700 Subject: rustc: Add a fast path when the types to be unified are exactly equal --- src/comp/middle/ty.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/comp') diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 96479c40..d57b8071 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -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. -- cgit v1.2.3