diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 213a0e870450..ec30df1212d9 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -3316,8 +3316,6 @@ fn autoderef(cx: &@block_ctxt, v: ValueRef, t: &ty::t) -> result_t { fn trans_binary(cx: &@block_ctxt, op: ast::binop, a: &@ast::expr, b: &@ast::expr) -> result { - - // First couple cases are lazy: alt op { ast::and. { @@ -3333,11 +3331,11 @@ fn trans_binary(cx: &@block_ctxt, op: ast::binop, a: &@ast::expr, ty::expr_ty(bcx_tcx(cx), b)); let lhs_false_cx = new_scope_block_ctxt(cx, "lhs false"); let lhs_false_res = rslt(lhs_false_cx, C_bool(false)); + // The following line ensures that any cleanups for rhs // are done within the block for rhs. This is necessary // because and/or are lazy. So the rhs may never execute, // and the cleanups can't be pushed into later code. - let rhs_bcx = trans_block_cleanups(rhs_res.bcx, rhs_cx); lhs_res.bcx.build.CondBr(lhs_res.val, rhs_cx.llbb, lhs_false_cx.llbb); ret join_results(cx, T_bool(), @@ -3356,8 +3354,8 @@ fn trans_binary(cx: &@block_ctxt, op: ast::binop, a: &@ast::expr, ty::expr_ty(bcx_tcx(cx), b)); let lhs_true_cx = new_scope_block_ctxt(cx, "lhs true"); let lhs_true_res = rslt(lhs_true_cx, C_bool(true)); - // see the and case for an explanation + // see the and case for an explanation let rhs_bcx = trans_block_cleanups(rhs_res.bcx, rhs_cx); lhs_res.bcx.build.CondBr(lhs_res.val, lhs_true_cx.llbb, rhs_cx.llbb); ret join_results(cx, T_bool(), diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 7bbd8a800d62..9b5416fdd595 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -883,7 +883,6 @@ mod collect { // Type unification - mod unify { fn unify(fcx: &@fn_ctxt, expected: &ty::t, actual: &ty::t) -> ty::unify::result { @@ -1009,12 +1008,12 @@ mod demand { } else if (adk == AUTODEREF_BLOCK_COERCE) { actual_1 = do_fn_block_coerce(fcx, sp, actual, expected); } + let ty_param_substs: [mutable ty::t] = ~[mutable]; let ty_param_subst_var_ids: [int] = ~[]; for ty_param_subst: ty::t in ty_param_substs_0 { // Generate a type variable and unify it with the type parameter // substitution. We will then pull out these type variables. - let t_0 = next_ty_var(fcx); ty_param_substs += ~[mutable t_0]; ty_param_subst_var_ids += ~[ty::ty_var_id(fcx.ccx.tcx, t_0)]; @@ -1370,12 +1369,11 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat, let v_def_ids = ast::variant_def_ids(v_def); let tag_tpt = ty::lookup_item_type(fcx.ccx.tcx, v_def_ids.tg); let path_tpot = instantiate_path(fcx, path, tag_tpt, pat.span); - // Take the tag type params out of `expected`. + // Take the tag type params out of `expected`. alt structure_of(fcx, pat.span, expected) { ty::ty_tag(_, expected_tps) { // Unify with the expected tag type. - let ctor_ty = ty::ty_param_substs_opt_and_ty_to_monotype(fcx.ccx.tcx, path_tpot); @@ -1385,8 +1383,8 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat, NO_AUTODEREF); path_tpot = {substs: some[[ty::t]](path_tpt.substs), ty: path_tpt.ty}; - // Get the number of arguments in this tag variant. + // Get the number of arguments in this tag variant. let arg_types = variant_arg_types(fcx.ccx, pat.span, v_def_ids.var, expected_tps); @@ -1417,9 +1415,6 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat, } } else if (subpats_len > 0u) { // TODO: note definition of tag variant - // TODO (issue #448): Wrap a #fmt string over multiple - // lines... - fcx.ccx.tcx.sess.span_fatal (pat.span, #fmt("this pattern has %u field%s, \ but the corresponding \