Skip to content

Commit 1339d05

Browse files
committed
Work around destructuring bug
1 parent f3edf8d commit 1339d05

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

src/comp/middle/typeck.rs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,19 +2055,27 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
20552055
bot = check_call_or_bind(fcx, expr.span, f, args, kind_bind);
20562056

20572057
// Pull the argument and return types out.
2058-
let (proto, arg_tys, rt, cf, constrs) =
2059-
alt structure_of(fcx, expr.span, expr_ty(tcx, f)) {
2060-
// FIXME:
2061-
// probably need to munge the constrs to drop constraints
2062-
// for any bound args
2063-
ty::ty_fn(proto, arg_tys, rt, cf, constrs) {
2064-
(proto, arg_tys, rt, cf, constrs)
2065-
}
2066-
ty::ty_native_fn(_, arg_tys, rt) {
2067-
(ast::proto_fn, arg_tys, rt, ast::return, [])
2068-
}
2069-
_ { fail "LHS of bind expr didn't have a function type?!"; }
2070-
};
2058+
let proto, arg_tys, rt, cf, constrs;
2059+
alt structure_of(fcx, expr.span, expr_ty(tcx, f)) {
2060+
// FIXME:
2061+
// probably need to munge the constrs to drop constraints
2062+
// for any bound args
2063+
ty::ty_fn(proto_, arg_tys_, rt_, cf_, constrs_) {
2064+
proto = proto_;
2065+
arg_tys = arg_tys_;
2066+
rt = rt_;
2067+
cf = cf_;
2068+
constrs = constrs_;
2069+
}
2070+
ty::ty_native_fn(_, arg_tys_, rt_) {
2071+
proto = ast::proto_fn;
2072+
arg_tys = arg_tys_;
2073+
rt = rt_;
2074+
cf = ast::return;
2075+
constrs = [];
2076+
}
2077+
_ { fail "LHS of bind expr didn't have a function type?!"; }
2078+
};
20712079

20722080
// For each blank argument, add the type of that argument
20732081
// to the resulting function type.

0 commit comments

Comments
 (0)