Skip to content

Commit 106f783

Browse files
committed
rustc: Add a fast path when the types to be unified are exactly equal
1 parent 9edaa7d commit 106f783

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/comp/middle/ty.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,9 @@ mod Unify {
18771877
// TODO: occurs check, to make sure we don't loop forever when
18781878
// unifying e.g. 'a and option['a]
18791879

1880+
// Fast path.
1881+
if (eq_ty(expected, actual)) { ret ures_ok(expected); }
1882+
18801883
alt (actual.struct) {
18811884
// If the RHS is a variable type, then just do the appropriate
18821885
// binding.

0 commit comments

Comments
 (0)