diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2011-04-22 10:51:32 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2011-04-22 10:51:32 -0700 |
| commit | 106f783b33f64cfc364b7aa2e5f57bcd07e9bfb8 (patch) | |
| tree | 7876306d353746e0c25be7f27fd99d3d9f71930e | |
| parent | 9edaa7dba3181ae68c60204e1e47a2d20e86236e (diff) | |
| download | rust-106f783b33f64cfc364b7aa2e5f57bcd07e9bfb8.tar.gz rust-106f783b33f64cfc364b7aa2e5f57bcd07e9bfb8.zip | |
rustc: Add a fast path when the types to be unified are exactly equal
| -rw-r--r-- | src/comp/middle/ty.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 96479c4096d..d57b8071b06 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. |
