Skip to content

Commit 6e2a7bf

Browse files
committed
Fix damage done by the pretty-printer
1 parent df7f21d commit 6e2a7bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+678
-413
lines changed

src/comp/back/link.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,8 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str,
340340
ret alt metas.name {
341341
some(v) { v }
342342
none. {
343-
let
344-
// FIXME: Remove this vec->ivec conversion.
345-
346-
name =
343+
// FIXME: Remove this vec->ivec conversion.
344+
let name =
347345
{
348346
let os_vec =
349347
str::split(fs::basename(output), '.' as u8);

src/comp/driver/rustc.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ fn build_configuration(sess: session::session, argv0: str, input: str) ->
6565
// some default and generated configuration items
6666
let default_cfg = default_configuration(sess, argv0, input);
6767
let user_cfg = sess.get_opts().cfg;
68-
let
69-
// If the user wants a test runner, then add the test cfg
70-
gen_cfg =
68+
// If the user wants a test runner, then add the test cfg
69+
let gen_cfg =
7170
{
7271
if sess.get_opts().test && !attr::contains_name(user_cfg, "test")
7372
{

src/comp/front/config.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ fn in_cfg(cfg: &ast::crate_cfg, attrs: &ast::attribute[]) -> bool {
101101
// Pull the inner meta_items from the #[cfg(meta_item, ...)] attributes,
102102
// so we can match against them. This is the list of configurations for
103103
// which the item is valid
104-
let
105-
106-
item_cfg_metas =
104+
let item_cfg_metas =
107105
{
108106
fn extract_metas(inner_items: &(@ast::meta_item)[],
109107
cfg_item: &@ast::meta_item) ->

src/comp/lib/llvm.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1395,11 +1395,10 @@ obj builder(B: BuilderRef, terminated: @mutable bool) {
13951395

13961396
fn is_terminated() -> bool {
13971397
ret *terminated;
1398-
}drop
1399-
1400-
{
1398+
}
1399+
drop {
14011400
llvm::LLVMDisposeBuilder(B);
1402-
}
1401+
}
14031402
}
14041403

14051404
/* Memory-managed object interface to type handles. */

src/comp/metadata/creader.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,20 @@ fn find_library_crate(sess: &session::session, ident: &ast::ident,
122122

123123
attr::require_unique_names(sess, metas);
124124

125-
let
126-
// FIXME: Probably want a warning here since the user
127-
// is using the wrong type of meta item
128-
crate_name =
129-
{
130-
let name_items = attr::find_meta_items_by_name(metas, "name");
131-
alt ivec::last(name_items) {
132-
some(i) {
133-
alt attr::get_meta_item_value_str(i) {
134-
some(n) { n }
135-
_ { ident }
136-
}
137-
}
138-
none. { ident }
125+
// FIXME: Probably want a warning here since the user
126+
// is using the wrong type of meta item
127+
let crate_name = {
128+
let name_items = attr::find_meta_items_by_name(metas, "name");
129+
alt ivec::last(name_items) {
130+
some(i) {
131+
alt attr::get_meta_item_value_str(i) {
132+
some(n) { n }
133+
_ { ident }
139134
}
140-
};
135+
}
136+
none. { ident }
137+
}
138+
};
141139

142140
let nn = default_native_lib_naming(sess, sess.get_opts().static);
143141
let x =

src/comp/metadata/decoder.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,8 @@ fn lookup_def(cnum: ast::crate_num, data: @u8[], did_: &ast::def_id) ->
164164
let item = lookup_item(did_.node, data);
165165
let kind_ch = item_kind(item);
166166
let did = {crate: cnum, node: did_.node};
167-
let
168-
// We treat references to tags as references to types.
169-
def =
167+
// We treat references to tags as references to types.
168+
let def =
170169
alt kind_ch as char {
171170
'c' { ast::def_const(did) }
172171
'f' { ast::def_fn(did, ast::impure_fn) }

src/comp/middle/alias.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ tag local_info { arg(ast::mode); objfield(ast::mutability); }
3939
type ctx = {tcx: ty::ctxt, local_map: std::map::hashmap[node_id, local_info]};
4040

4141
fn check_crate(tcx: ty::ctxt, crate: &@ast::crate) {
42-
let
43-
// Stores information about object fields and function
44-
// arguments that's otherwise not easily available.
45-
cx =
42+
// Stores information about object fields and function
43+
// arguments that's otherwise not easily available.
44+
let cx =
4645
@{tcx: tcx, local_map: std::map::new_int_hash()};
4746
let v =
4847
@{visit_fn: bind visit_fn(cx, _, _, _, _, _, _, _),

src/comp/middle/freevars.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ fn collect_freevars(def_map: &resolve::def_map, sess: &session::session,
7373

7474
let e: env =
7575
@{mutable refs: ~[], decls: decls, def_map: def_map, sess: sess};
76-
walker(visit::mk_simple_visitor(@{visit_local: bind walk_local(e, _),
77-
visit_pat: bind walk_pat(e, _),
78-
visit_expr: bind walk_expr(e, _),
79-
visit_fn: bind walk_fn(e, _, _, _, _, _)
80-
with
81-
*visit::default_simple_visitor()}));
76+
walker(visit::mk_simple_visitor
77+
(@{visit_local: bind walk_local(e, _),
78+
visit_pat: bind walk_pat(e, _),
79+
visit_expr: bind walk_expr(e, _),
80+
visit_fn: bind walk_fn(e, _, _, _, _, _)
81+
with *visit::default_simple_visitor()}));
8282

8383
// Calculate (refs - decls). This is the set of captured upvars.
8484
// We build a vec of the node ids of the uses and a set of the

src/comp/middle/trans.rs

+40-47
Original file line numberDiff line numberDiff line change
@@ -830,10 +830,9 @@ fn trans_malloc_boxed(cx: &@block_ctxt, t: ty::t) -> result {
830830
// size of; box_ptr is the type that's converted to a TypeRef and used as
831831
// the pointer cast target in trans_raw_malloc.
832832

833-
let
834-
// The mk_int here is the space being
835-
// reserved for the refcount.
836-
boxed_body =
833+
// The mk_int here is the space being
834+
// reserved for the refcount.
835+
let boxed_body =
837836
ty::mk_imm_tup(bcx_tcx(cx), ~[ty::mk_int(bcx_tcx(cx)), t]);
838837
let box_ptr = ty::mk_imm_box(bcx_tcx(cx), t);
839838
let sz = size_of(cx, boxed_body);
@@ -1243,21 +1242,20 @@ fn incr_refcnt_of_boxed(cx: &@block_ctxt, box_ptr: ValueRef) -> result {
12431242
fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
12441243
// NB: v is an *alias* of type t here, not a direct value.
12451244

1246-
let
1247-
// FIXME: switch gc/non-gc on layer of the type.
1248-
// FIXME: switch gc/non-gc on layer of the type.
1249-
// TODO: call upcall_kill
1245+
// FIXME: switch gc/non-gc on layer of the type.
1246+
// FIXME: switch gc/non-gc on layer of the type.
1247+
// TODO: call upcall_kill
12501248

12511249

1252-
// Call through the obj's own fields-drop glue first.
1250+
// Call through the obj's own fields-drop glue first.
12531251

1254-
// Then free the body.
1255-
// FIXME: switch gc/non-gc on layer of the type.
1256-
// Call through the closure's own fields-drop glue first.
1252+
// Then free the body.
1253+
// FIXME: switch gc/non-gc on layer of the type.
1254+
// Call through the closure's own fields-drop glue first.
12571255

1258-
// Then free the body.
1259-
// FIXME: switch gc/non-gc on layer of the type.
1260-
rs =
1256+
// Then free the body.
1257+
// FIXME: switch gc/non-gc on layer of the type.
1258+
let rs =
12611259
alt ty::struct(bcx_tcx(cx), t) {
12621260
ty::ty_str. { let v = cx.build.Load(v0); trans_non_gc_free(cx, v) }
12631261
ty::ty_vec(_) {
@@ -1361,9 +1359,7 @@ fn maybe_free_ivec_heap_part(cx: &@block_ctxt, v0: ValueRef, unit_ty: ty::t)
13611359
fn make_drop_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
13621360
// NB: v0 is an *alias* of type t here, not a direct value.
13631361
let ccx = bcx_ccx(cx);
1364-
let
1365-
1366-
rs =
1362+
let rs =
13671363
alt ty::struct(ccx.tcx, t) {
13681364
ty::ty_str. { decr_refcnt_maybe_free(cx, v0, v0, t) }
13691365
ty::ty_vec(_) { decr_refcnt_maybe_free(cx, v0, v0, t) }
@@ -1453,7 +1449,9 @@ fn trans_res_drop(cx: @block_ctxt, rs: ValueRef, did: &ast::def_id,
14531449
// value here, but the dtor expects a type that still has opaque pointers
14541450
// for type variables.
14551451
let val_llty =
1456-
lib::llvm::fn_ty_param_tys(llvm::LLVMGetElementType(llvm::LLVMTypeOf(dtor_addr))).(std::ivec::len(args));
1452+
lib::llvm::fn_ty_param_tys(llvm::LLVMGetElementType
1453+
(llvm::LLVMTypeOf(dtor_addr)))
1454+
.(std::ivec::len(args));
14571455
let val_cast = cx.build.BitCast(val.val, val_llty);
14581456
cx.build.FastCall(dtor_addr, args + ~[val_cast]);
14591457

@@ -3345,9 +3343,8 @@ mod ivec {
33453343
maybe_on_heap_cx.build.PointerCast(vptr,
33463344
T_ptr(T_ivec_heap(llunitty)));
33473345
let heap_ptr_ptr =
3348-
maybe_on_heap_cx.build.InBoundsGEP(stub_ptr,
3349-
~[C_int(0),
3350-
C_uint(abi::ivec_heap_stub_elt_ptr)]);
3346+
maybe_on_heap_cx.build.InBoundsGEP
3347+
(stub_ptr, ~[C_int(0), C_uint(abi::ivec_heap_stub_elt_ptr)]);
33513348
let heap_ptr = maybe_on_heap_cx.build.Load(heap_ptr_ptr);
33523349
let heap_ptr_is_nonnull =
33533350
maybe_on_heap_cx.build.ICmp(lib::llvm::LLVMIntNE, heap_ptr,
@@ -3358,9 +3355,8 @@ mod ivec {
33583355

33593356
// Ok, the vector is on the heap. Copy the heap part.
33603357
let alen_ptr =
3361-
on_heap_cx.build.InBoundsGEP(stub_ptr,
3362-
~[C_int(0),
3363-
C_uint(abi::ivec_heap_stub_elt_alen)]);
3358+
on_heap_cx.build.InBoundsGEP
3359+
(stub_ptr, ~[C_int(0), C_uint(abi::ivec_heap_stub_elt_alen)]);
33643360
let alen = on_heap_cx.build.Load(alen_ptr);
33653361

33663362
let heap_part_sz =
@@ -3598,17 +3594,15 @@ fn trans_if(cx: &@block_ctxt, cond: &@ast::expr, thn: &ast::blk,
35983594
let then_cx = new_scope_block_ctxt(cx, "then");
35993595
let then_res = trans_block(then_cx, thn, output);
36003596
let else_cx = new_scope_block_ctxt(cx, "else");
3601-
let
3602-
// Synthesize a block here to act as the else block
3603-
// containing an if expression. Needed in order for the
3604-
// else scope to behave like a normal block scope. A tad
3605-
// ugly.
3606-
// Calling trans_block directly instead of trans_expr
3607-
// because trans_expr will create another scope block
3608-
// context for the block, but we've already got the
3609-
// 'else' context
3610-
3611-
else_res =
3597+
// Synthesize a block here to act as the else block
3598+
// containing an if expression. Needed in order for the
3599+
// else scope to behave like a normal block scope. A tad
3600+
// ugly.
3601+
// Calling trans_block directly instead of trans_expr
3602+
// because trans_expr will create another scope block
3603+
// context for the block, but we've already got the
3604+
// 'else' context
3605+
let else_res =
36123606
alt els {
36133607
some(elexpr) {
36143608
alt elexpr.node {
@@ -4908,7 +4902,7 @@ fn trans_call(cx: &@block_ctxt, f: &@ast::expr,
49084902
let llretslot = args_res.retslot;
49094903
/*
49104904
log "calling: " + val_str(bcx_ccx(cx).tn, faddr);
4911-
4905+
49124906
for (ValueRef arg in llargs) {
49134907
log "arg: " + val_str(bcx_ccx(cx).tn, arg);
49144908
}
@@ -5334,9 +5328,9 @@ fn trans_expr_out(cx: &@block_ctxt, e: &@ast::expr, output: out_method) ->
53345328
}
53355329
_ {
53365330
// The expression is an lvalue. Fall through.
5337-
assert (ty::is_lval(e)); // make sure it really is and that we
5338-
// didn't forget to add a case for a new expr!
5339-
5331+
assert (ty::is_lval(e));
5332+
// make sure it really is and that we
5333+
// didn't forget to add a case for a new expr!
53405334
}
53415335
}
53425336
// lval cases fall through to trans_lval and then
@@ -6352,8 +6346,8 @@ fn copy_args_to_allocas(fcx: @fn_ctxt, args: &ast::arg[],
63526346
alt bcx.fcx.llargs.find(aarg.id) {
63536347
some(x) { argval = x; }
63546348
_ {
6355-
bcx_ccx(bcx).sess.span_fatal(aarg.ty.span,
6356-
"unbound arg ID in copy_args_to_allocas");
6349+
bcx_ccx(bcx).sess.span_fatal
6350+
(aarg.ty.span, "unbound arg ID in copy_args_to_allocas");
63576351
}
63586352
}
63596353
bcx.build.Store(argval, a);
@@ -6374,8 +6368,8 @@ fn add_cleanups_for_args(bcx: &@block_ctxt, args: &ast::arg[],
63746368
alt bcx.fcx.llargs.find(aarg.id) {
63756369
some(x) { argval = x; }
63766370
_ {
6377-
bcx_ccx(bcx).sess.span_fatal(aarg.ty.span,
6378-
"unbound arg ID in copy_args_to_allocas");
6371+
bcx_ccx(bcx).sess.span_fatal
6372+
(aarg.ty.span, "unbound arg ID in copy_args_to_allocas");
63796373
}
63806374
}
63816375
add_clean(bcx, argval, arg_tys.(arg_n).ty);
@@ -7227,9 +7221,8 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
72277221
let bcx = new_top_block_ctxt(fcx);
72287222
let lltop = bcx.llbb;
72297223

7230-
let
7231-
// Cast the tag to a type we can GEP into.
7232-
llblobptr =
7224+
// Cast the tag to a type we can GEP into.
7225+
let llblobptr =
72337226
if is_degen {
72347227
fcx.llretptr
72357228
} else {

src/comp/middle/trans_alt.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,8 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: ValueRef[],
294294
if ivec::len(ty::tag_variants(ccx.tcx, vdef.tg)) == 1u {
295295
kind = single;
296296
} else {
297-
let tagptr =
298-
bcx.build.PointerCast(val,
299-
trans_common::T_opaque_tag_ptr(ccx.tn));
297+
let tagptr = bcx.build.PointerCast
298+
(val, trans_common::T_opaque_tag_ptr(ccx.tn));
300299
let discrimptr = bcx.build.GEP(tagptr, ~[C_int(0), C_int(0)]);
301300
test_val = bcx.build.Load(discrimptr);
302301
kind = switch;

src/comp/middle/tstate/bitvectors.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,7 @@ fn relax_precond_block(fcx: &fn_ctxt, i: node_id, b: &blk) {
159159
fn quit(keepgoing: @mutable bool, i: &@item) { *keepgoing = false; }
160160
fn kg(keepgoing: @mutable bool) -> bool { ret *keepgoing; }
161161

162-
let
163-
164-
v =
162+
let v =
165163
{visit_block_pre: bind relax_precond_block_non_recursive(fcx, i, _),
166164
visit_expr_pre: bind relax_precond_expr(fcx, i, _),
167165
visit_stmt_pre: bind relax_precond_stmt(fcx, i, _),

src/comp/middle/tstate/pre_post_conditions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ fn find_pre_post_block(fcx: &fn_ctxt, b: blk) {
641641
This will mean that:
642642
x = 0;
643643
break;
644-
644+
645645
won't have a postcondition that says x is initialized, but that's ok.
646646
*/
647647

src/comp/middle/ty.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1987,8 +1987,9 @@ mod unify {
19871987

19881988
let result_mode;
19891989
if expected_input.mode != actual_input.mode {
1990-
ret fn_common_res_err(ures_err(terr_mode_mismatch(expected_input.mode,
1991-
actual_input.mode)));
1990+
ret fn_common_res_err
1991+
(ures_err(terr_mode_mismatch(expected_input.mode,
1992+
actual_input.mode)));
19921993
} else { result_mode = expected_input.mode; }
19931994
let result = unify_step(cx, expected_input.ty, actual_input.ty);
19941995
alt result {
@@ -2817,10 +2818,10 @@ fn ast_constr_to_constr[T](tcx: ty::ctxt, c: &@ast::constr_general[T]) ->
28172818
{path: c.node.path, args: c.node.args, id: pred_id});
28182819
}
28192820
_ {
2820-
tcx.sess.span_fatal(c.span,
2821-
"Predicate " + path_to_str(c.node.path) +
2822-
" is unbound or bound to a non-function or an \
2823-
impure function");
2821+
tcx.sess.span_fatal
2822+
(c.span, "Predicate " + path_to_str(c.node.path) +
2823+
" is unbound or bound to a non-function or an \
2824+
impure function");
28242825
}
28252826
}
28262827
}

0 commit comments

Comments
 (0)