We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ab9bd9 commit 9edaa7dCopy full SHA for 9edaa7d
src/comp/middle/ty.rs
@@ -2362,9 +2362,15 @@ mod Unify {
2362
2363
auto ures = unify_step(cx, expected, actual);
2364
alt (ures) {
2365
- case (ures_ok(?t)) {
+ case (ures_ok(?typ)) {
2366
+ // Fast path: if there are no local variables, don't perform
2367
+ // substitutions.
2368
+ if (_vec.len[mutable UFind.node](cx.sets.nodes) == 0u) {
2369
+ ret ures_ok(typ);
2370
+ }
2371
+
2372
auto set_types = unify_sets(cx);
- auto t2 = substitute(cx, set_types, t);
2373
+ auto t2 = substitute(cx, set_types, typ);
2374
ret ures_ok(t2);
2375
}
2376
case (_) { ret ures; }
0 commit comments