Skip to content

Commit 7c7d434

Browse files
committed
---
yaml --- r: 14178 b: refs/heads/try c: fe8a31e h: refs/heads/master v: v3
1 parent 9445146 commit 7c7d434

File tree

18 files changed

+44
-88
lines changed

18 files changed

+44
-88
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 107f827b537a4c3b2a44993085609497a1871928
5+
refs/heads/try: fe8a31e56992a712b532350596af05186ac90613
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/comp/middle/alias.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,14 @@ fn visit_expr(cx: @ctx, ex: @ast::expr, sc: scope, v: vt<scope>) {
141141
}
142142

143143
fn visit_block(cx: @ctx, b: ast::blk, sc: scope, v: vt<scope>) {
144-
let bs = sc.bs, sc = sc;
144+
let sc = sc;
145145
for stmt in b.node.stmts {
146146
alt stmt.node {
147147
ast::stmt_decl(@{node: ast::decl_item(it), _}, _) {
148148
v.visit_item(it, sc, v);
149149
}
150150
ast::stmt_decl(@{node: ast::decl_local(locs), _}, _) {
151-
for (st, loc) in locs {
152-
if st == ast::let_ref {
153-
add_bindings_for_let(*cx, bs, loc);
154-
sc = {bs: bs with sc};
155-
}
151+
for loc in locs {
156152
alt loc.node.init {
157153
some(init) {
158154
if init.op == ast::init_move {
@@ -547,7 +543,7 @@ fn ty_can_unsafely_include(cx: ctx, needle: unsafe_ty, haystack: ty::t,
547543

548544
fn def_is_local(d: ast::def) -> bool {
549545
alt d {
550-
ast::def_local(_, _) | ast::def_arg(_, _) | ast::def_binding(_) |
546+
ast::def_local(_) | ast::def_arg(_, _) | ast::def_binding(_) |
551547
ast::def_upvar(_, _, _) | ast::def_self(_) { true }
552548
_ { false }
553549
}

branches/try/src/comp/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
204204
fn check_stmt(stmt: @stmt, cx: ctx, v: visit::vt<ctx>) {
205205
alt stmt.node {
206206
stmt_decl(@{node: decl_local(locals), _}, _) {
207-
for (_, local) in locals {
207+
for local in locals {
208208
alt local.node.init {
209209
some({op: init_assign, expr}) { maybe_copy(cx, expr); }
210210
_ {}

branches/try/src/comp/middle/last_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ fn clear_in_current(cx: ctx, my_def: node_id, to: bool) {
285285
fn clear_def_if_path(cx: ctx, d: def, to: bool)
286286
-> option<node_id> {
287287
alt d {
288-
def_local(def_id, let_copy) {
288+
def_local(def_id) {
289289
clear_in_current(cx, def_id.node, to);
290290
some(def_id.node)
291291
}

branches/try/src/comp/middle/mut.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn visit_decl(cx: @ctx, d: @decl, &&e: (), v: visit::vt<()>) {
137137
visit::visit_decl(d, e, v);
138138
alt d.node {
139139
decl_local(locs) {
140-
for (_, loc) in locs {
140+
for loc in locs {
141141
alt loc.node.init {
142142
some(init) {
143143
if init.op == init_move { check_move_rhs(cx, init.expr); }
@@ -282,7 +282,6 @@ fn is_immutable_def(cx: @ctx, def: def) -> option<str> {
282282
};
283283
}
284284
def_binding(_) { some("binding") }
285-
def_local(_, let_ref) { some("by-reference binding") }
286285
_ { none }
287286
}
288287
}

branches/try/src/comp/middle/resolve.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ fn visit_decl_with_scope(d: @decl, sc: scopes, v: vt<scopes>) {
542542
};
543543
alt d.node {
544544
decl_local(locs) {
545-
for (_, loc) in locs { v.visit_local(loc, sc, v);; *loc_pos += 1u; }
545+
for loc in locs { v.visit_local(loc, sc, v);; *loc_pos += 1u; }
546546
}
547547
decl_item(it) { v.visit_item(it, sc, v); }
548548
}
@@ -882,7 +882,7 @@ fn scope_closes(sc: scope) -> option<node_id> {
882882

883883
fn def_is_local(d: def) -> bool {
884884
alt d {
885-
ast::def_arg(_, _) | ast::def_local(_, _) | ast::def_binding(_) |
885+
ast::def_arg(_, _) | ast::def_local(_) | ast::def_binding(_) |
886886
ast::def_upvar(_, _, _) { true }
887887
_ { false }
888888
}
@@ -1114,12 +1114,12 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint,
11141114
let j = vec::len(locs);
11151115
while j > 0u {
11161116
j -= 1u;
1117-
let (style, loc) = locs[j];
1117+
let loc = locs[j];
11181118
if ns == ns_val(ns_any_value)
11191119
&& (i < pos || j < loc_pos) {
11201120
alt lookup_in_pat(e, name, loc.node.pat) {
11211121
some(did) {
1122-
ret some(ast::def_local(did, style));
1122+
ret some(ast::def_local(did));
11231123
}
11241124
_ { }
11251125
}
@@ -1549,7 +1549,7 @@ fn ns_for_def(d: def) -> namespace {
15491549
alt d {
15501550
ast::def_variant(_, _) { ns_val(ns_a_enum) }
15511551
ast::def_fn(_, _) | ast::def_self(_) |
1552-
ast::def_const(_) | ast::def_arg(_, _) | ast::def_local(_, _) |
1552+
ast::def_const(_) | ast::def_arg(_, _) | ast::def_local(_) |
15531553
ast::def_upvar(_, _, _) | ast::def_self(_) |
15541554
ast::def_class_field(_,_) | ast::def_class_method(_,_)
15551555
{ ns_val(ns_any_value) }
@@ -1713,7 +1713,7 @@ fn check_block(e: @env, b: ast::blk, &&x: (), v: vt<()>) {
17131713
alt d.node {
17141714
ast::decl_local(locs) {
17151715
let local_values = checker(*e, "value");
1716-
for (_, loc) in locs {
1716+
for loc in locs {
17171717
pat_util::pat_bindings
17181718
(normalize_pat_def_map(e.def_map, loc.node.pat))
17191719
{|_i, p_sp, n|

branches/try/src/comp/middle/trans/base.rs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,7 @@ fn trans_local_var(cx: @block_ctxt, def: ast::def) -> local_var_result {
23952395
assert (cx.fcx.llargs.contains_key(did.node));
23962396
ret take_local(cx.fcx.llargs, did.node);
23972397
}
2398-
ast::def_local(did, _) | ast::def_binding(did) {
2398+
ast::def_local(did) | ast::def_binding(did) {
23992399
assert (cx.fcx.lllocals.contains_key(did.node));
24002400
ret take_local(cx.fcx.lllocals, did.node);
24012401
}
@@ -3737,18 +3737,6 @@ fn init_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt {
37373737
ret alt::bind_irrefutable_pat(bcx, local.node.pat, llptr, false);
37383738
}
37393739

3740-
fn init_ref_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt {
3741-
let init_expr = option::get(local.node.init).expr;
3742-
let {bcx, val, kind} = trans_lval(bcx, init_expr);
3743-
alt kind {
3744-
owned_imm { val = do_spill_noroot(bcx, val); }
3745-
owned {}
3746-
_ { bcx_tcx(bcx).sess.span_bug(local.span,
3747-
"Someone forgot to document an invariant in init_ref_local!"); }
3748-
}
3749-
ret alt::bind_irrefutable_pat(bcx, local.node.pat, val, false);
3750-
}
3751-
37523740
fn zero_alloca(cx: @block_ctxt, llptr: ValueRef, t: ty::t)
37533741
-> @block_ctxt {
37543742
let bcx = cx;
@@ -3790,12 +3778,8 @@ fn trans_stmt(cx: @block_ctxt, s: ast::stmt) -> @block_ctxt {
37903778
ast::stmt_decl(d, _) {
37913779
alt d.node {
37923780
ast::decl_local(locals) {
3793-
for (style, local) in locals {
3794-
if style == ast::let_copy {
3795-
bcx = init_local(bcx, local);
3796-
} else {
3797-
bcx = init_ref_local(bcx, local);
3798-
}
3781+
for local in locals {
3782+
bcx = init_local(bcx, local);
37993783
if bcx_ccx(cx).sess.opts.extra_debuginfo {
38003784
debuginfo::create_local_var(bcx, local);
38013785
}
@@ -3924,9 +3908,7 @@ fn block_locals(b: ast::blk, it: fn(@ast::local)) {
39243908
ast::stmt_decl(d, _) {
39253909
alt d.node {
39263910
ast::decl_local(locals) {
3927-
for (style, local) in locals {
3928-
if style == ast::let_copy { it(local); }
3929-
}
3911+
for local in locals { it(local); }
39303912
}
39313913
_ {/* fall through */ }
39323914
}

branches/try/src/comp/middle/tstate/auxiliary.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ fn expr_to_constr_arg(tcx: ty::ctxt, e: @expr) -> @constr_arg_use {
576576
alt e.node {
577577
expr_path(p) {
578578
alt tcx.def_map.find(e.id) {
579-
some(def_local(id, _)) | some(def_arg(id, _)) |
579+
some(def_local(id)) | some(def_arg(id, _)) |
580580
some(def_binding(id)) | some(def_upvar(id, _, _)) {
581581
ret @respan(p.span,
582582
carg_ident({ident: p.node.idents[0], node: id.node}));
@@ -786,7 +786,7 @@ enum if_ty { if_check, plain_if, }
786786
fn local_node_id_to_def_id_strict(fcx: fn_ctxt, sp: span, i: node_id) ->
787787
def_id {
788788
alt local_node_id_to_def(fcx, i) {
789-
some(def_local(id, _)) | some(def_arg(id, _)) |
789+
some(def_local(id)) | some(def_arg(id, _)) |
790790
some(def_upvar(id, _, _)) {
791791
ret id;
792792
}
@@ -810,7 +810,7 @@ fn local_node_id_to_def(fcx: fn_ctxt, i: node_id) -> option<def> {
810810

811811
fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option<def_id> {
812812
alt local_node_id_to_def(fcx, i) {
813-
some(def_local(id, _)) | some(def_arg(id, _)) | some(def_binding(id)) |
813+
some(def_local(id)) | some(def_arg(id, _)) | some(def_binding(id)) |
814814
some(def_upvar(id, _, _)) {
815815
some(id)
816816
}
@@ -1062,10 +1062,9 @@ fn local_to_bindings(tcx: ty::ctxt, loc: @local) -> binding {
10621062
{lhs: lhs, rhs: loc.node.init}
10631063
}
10641064

1065-
fn locals_to_bindings(tcx: ty::ctxt,
1066-
locals: [(let_style, @local)]) -> [binding] {
1065+
fn locals_to_bindings(tcx: ty::ctxt, locals: [@local]) -> [binding] {
10671066
let rslt = [];
1068-
for (_, loc) in locals { rslt += [local_to_bindings(tcx, loc)]; }
1067+
for loc in locals { rslt += [local_to_bindings(tcx, loc)]; }
10691068
ret rslt;
10701069
}
10711070

branches/try/src/comp/middle/tstate/bitvectors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn clear_in_poststate_expr(fcx: fn_ctxt, e: @expr, t: poststate) {
185185
alt vec::last(p.node.idents) {
186186
some(i) {
187187
alt local_node_id_to_def(fcx, e.id) {
188-
some(def_local(d_id, _)) {
188+
some(def_local(d_id)) {
189189
clear_in_poststate_(bit_num(fcx, ninit(d_id.node, i)), t);
190190
}
191191
some(_) {/* ignore args (for now...) */ }

branches/try/src/comp/middle/tstate/pre_post_conditions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn gen_if_local(fcx: fn_ctxt, lhs: @expr, rhs: @expr, larger_id: node_id,
176176
alt node_id_to_def(fcx.ccx, new_var) {
177177
some(d) {
178178
alt d {
179-
def_local(d_id, _) {
179+
def_local(d_id) {
180180
find_pre_post_expr(fcx, rhs);
181181
let p = expr_pp(fcx.ccx, rhs);
182182
set_pre_and_post(fcx.ccx, larger_id, p.precondition,
@@ -214,7 +214,7 @@ fn handle_update(fcx: fn_ctxt, parent: @expr, lhs: @expr, rhs: @expr,
214214
// pure and assign_op require the lhs to be init'd
215215
let df = node_id_to_def_strict(fcx.ccx.tcx, lhs.id);
216216
alt df {
217-
def_local(d_id, _) {
217+
def_local(d_id) {
218218
let i =
219219
bit_num(fcx,
220220
ninit(d_id.node, path_to_ident(p)));
@@ -261,7 +261,7 @@ fn handle_var(fcx: fn_ctxt, rslt: pre_and_post, id: node_id, name: ident) {
261261
fn handle_var_def(fcx: fn_ctxt, rslt: pre_and_post, def: def, name: ident) {
262262
log(debug, ("handle_var_def: ", def, name));
263263
alt def {
264-
def_local(d_id, _) | def_arg(d_id, _) {
264+
def_local(d_id) | def_arg(d_id, _) {
265265
use_var(fcx, d_id.node);
266266
let i = bit_num(fcx, ninit(d_id.node, name));
267267
require_and_preserve(i, rslt);
@@ -545,7 +545,7 @@ fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) {
545545
decl_local(alocals) {
546546
let e_pp;
547547
let prev_pp = empty_pre_post(num_constraints(fcx.enclosing));
548-
for (_, alocal) in alocals {
548+
for alocal in alocals {
549549
alt alocal.node.init {
550550
some(an_init) {
551551
/* LHS always becomes initialized,

branches/try/src/comp/middle/tstate/states.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ fn gen_if_local(fcx: fn_ctxt, p: poststate, e: @expr) -> bool {
247247
alt e.node {
248248
expr_path(pth) {
249249
alt fcx.ccx.tcx.def_map.find(e.id) {
250-
some(def_local(loc, _)) {
250+
some(def_local(loc)) {
251251
ret set_in_poststate_ident(fcx, loc.node,
252252
path_to_ident(pth), p);
253253
}

branches/try/src/comp/middle/typeck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) ->
9292
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node));
9393
ret {bounds: @[], ty: typ};
9494
}
95-
ast::def_local(id, _) {
95+
ast::def_local(id) {
9696
assert (fcx.locals.contains_key(id.node));
9797
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node));
9898
ret {bounds: @[], ty: typ};
@@ -2526,7 +2526,7 @@ fn check_stmt(fcx: @fn_ctxt, stmt: @ast::stmt) -> bool {
25262526
node_id = id;
25272527
alt decl.node {
25282528
ast::decl_local(ls) {
2529-
for (_, l) in ls { bot |= check_decl_local(fcx, l); }
2529+
for l in ls { bot |= check_decl_local(fcx, l); }
25302530
}
25312531
ast::decl_item(_) {/* ignore for now */ }
25322532
}

branches/try/src/comp/syntax/ast.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ enum def {
3838
def_native_mod(def_id),
3939
def_const(def_id),
4040
def_arg(def_id, mode),
41-
def_local(def_id, let_style),
41+
def_local(def_id),
4242
def_variant(def_id /* enum */, def_id /* variant */),
4343
def_ty(def_id),
4444
def_prim_ty(prim_ty),
@@ -201,9 +201,7 @@ type local = spanned<local_>;
201201

202202
type decl = spanned<decl_>;
203203

204-
enum let_style { let_copy, let_ref, }
205-
206-
enum decl_ { decl_local([(let_style, @local)]), decl_item(@item), }
204+
enum decl_ { decl_local([@local]), decl_item(@item), }
207205

208206
type arm = {pats: [@pat], guard: option<@expr>, body: blk};
209207

branches/try/src/comp/syntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
2828
fn def_id_of_def(d: def) -> def_id {
2929
alt d {
3030
def_fn(id, _) | def_self(id) | def_mod(id) |
31-
def_native_mod(id) | def_const(id) | def_arg(id, _) | def_local(id, _) |
31+
def_native_mod(id) | def_const(id) | def_arg(id, _) | def_local(id) |
3232
def_variant(_, id) | def_ty(id) | def_ty_param(id, _) |
3333
def_binding(id) | def_use(id) | def_upvar(id, _, _) |
3434
def_class(id) | def_class_field(_, id) | def_class_method(_, id) { id }

branches/try/src/comp/syntax/fold.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,10 @@ fn noop_fold_pat(p: pat_, fld: ast_fold) -> pat_ {
320320
}
321321

322322
fn noop_fold_decl(d: decl_, fld: ast_fold) -> decl_ {
323-
ret alt d {
324-
decl_local(ls) {
325-
decl_local(vec::map(ls, {|l| let (st, lc) = l;
326-
(st, fld.fold_local(lc))}))
327-
}
328-
decl_item(it) { decl_item(fld.fold_item(it)) }
329-
}
323+
alt d {
324+
decl_local(ls) { decl_local(vec::map(ls, fld.fold_local)) }
325+
decl_item(it) { decl_item(fld.fold_item(it)) }
326+
}
330327
}
331328

332329
fn wrap<T>(f: fn@(T, ast_fold) -> T)

branches/try/src/comp/syntax/parse/parser.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,18 +1511,12 @@ fn parse_pat(p: parser) -> @ast::pat {
15111511
}
15121512
} else if is_plain_ident(p) &&
15131513
alt p.look_ahead(1u) {
1514-
token::LPAREN | token::LBRACKET |
1515-
token::LT {
1516-
false
1517-
}
1514+
token::LPAREN | token::LBRACKET | token::LT { false }
15181515
_ { true }
15191516
} {
15201517
let name = parse_path(p);
1521-
let sub = if eat(p, token::AT) {
1522-
some(parse_pat(p))
1523-
} else {
1524-
none
1525-
};
1518+
let sub = if eat(p, token::AT) { some(parse_pat(p)) }
1519+
else { none };
15261520
pat = ast::pat_ident(name, sub);
15271521
} else {
15281522
let enum_path = parse_path_and_ty_param_substs(p, true);
@@ -1563,17 +1557,10 @@ fn parse_local(p: parser, allow_init: bool) -> @ast::local {
15631557
}
15641558

15651559
fn parse_let(p: parser) -> @ast::decl {
1566-
fn parse_let_style(p: parser) -> ast::let_style {
1567-
if eat(p, token::BINOP(token::AND)) {
1568-
ast::let_ref
1569-
} else {
1570-
ast::let_copy
1571-
}
1572-
}
15731560
let lo = p.span.lo;
1574-
let locals = [(parse_let_style(p), parse_local(p, true))];
1561+
let locals = [parse_local(p, true)];
15751562
while eat(p, token::COMMA) {
1576-
locals += [(parse_let_style(p), parse_local(p, true))];
1563+
locals += [parse_local(p, true)];
15771564
}
15781565
ret @spanned(lo, p.last_span.hi, ast::decl_local(locals));
15791566
}

branches/try/src/comp/syntax/print/pprust.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,10 +1082,8 @@ fn print_decl(s: ps, decl: @ast::decl) {
10821082
space_if_not_bol(s);
10831083
ibox(s, indent_unit);
10841084
word_nbsp(s, "let");
1085-
fn print_local(s: ps, loc_st: (ast::let_style, @ast::local)) {
1086-
let (st, loc) = loc_st;
1085+
fn print_local(s: ps, &&loc: @ast::local) {
10871086
ibox(s, indent_unit);
1088-
if st == ast::let_ref { word(s.s, "&"); }
10891087
print_local_decl(s, loc);
10901088
end(s);
10911089
alt loc.node.init {

branches/try/src/comp/syntax/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
276276
fn visit_decl<E>(d: @decl, e: E, v: vt<E>) {
277277
alt d.node {
278278
decl_local(locs) {
279-
for (_, loc) in locs { v.visit_local(loc, e, v); }
279+
for loc in locs { v.visit_local(loc, e, v); }
280280
}
281281
decl_item(it) { v.visit_item(it, e, v); }
282282
}

0 commit comments

Comments
 (0)