Skip to content

Commit 518dc52

Browse files
committed
Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to [] and the extension syntax from #fmt() to #fmt[]
1 parent 4aa1655 commit 518dc52

File tree

642 files changed

+6788
-7387
lines changed

Some content is hidden

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

642 files changed

+6788
-7387
lines changed

src/comp/back/link.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,9 @@ mod write {
137137
False);
138138

139139
if threshold != 0u {
140-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(MPMB,
141-
threshold);
140+
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(
141+
MPMB, threshold);
142142
}
143-
144143
llvm::LLVMPassManagerBuilderPopulateModulePassManager(MPMB,
145144
pm.llpm);
146145

@@ -293,21 +292,21 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str,
293292
provided_metas {
294293
let name: option::t<str> = none;
295294
let vers: option::t<str> = none;
296-
let cmh_items: [@ast::meta_item] = ~[];
295+
let cmh_items: [@ast::meta_item] = [];
297296
let linkage_metas = attr::find_linkage_metas(c.node.attrs);
298297
attr::require_unique_names(sess, linkage_metas);
299298
for meta: @ast::meta_item in linkage_metas {
300299
if attr::get_meta_item_name(meta) == "name" {
301300
alt attr::get_meta_item_value_str(meta) {
302301
some(v) { name = some(v); }
303-
none. { cmh_items += ~[meta]; }
302+
none. { cmh_items += [meta]; }
304303
}
305-
} else if (attr::get_meta_item_name(meta) == "vers") {
304+
} else if attr::get_meta_item_name(meta) == "vers" {
306305
alt attr::get_meta_item_value_str(meta) {
307306
some(v) { vers = some(v); }
308-
none. { cmh_items += ~[meta]; }
307+
none. { cmh_items += [meta]; }
309308
}
310-
} else { cmh_items += ~[meta]; }
309+
} else { cmh_items += [meta]; }
311310
}
312311
ret {name: name, vers: vers, cmh_items: cmh_items};
313312
}
@@ -316,7 +315,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str,
316315
fn crate_meta_extras_hash(sha: sha1, _crate: &ast::crate,
317316
metas: &provided_metas) -> str {
318317
fn len_and_str(s: &str) -> str {
319-
ret #fmt("%u_%s", str::byte_len(s), s);
318+
ret #fmt["%u_%s", str::byte_len(s), s];
320319
}
321320

322321
fn len_and_str_lit(l: &ast::lit) -> str {
@@ -345,8 +344,8 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str,
345344

346345
fn warn_missing(sess: &session::session, name: str, default: str) {
347346
if !sess.get_opts().library { ret; }
348-
sess.warn(#fmt("missing crate link meta '%s', using '%s' as default",
349-
name, default));
347+
sess.warn(#fmt["missing crate link meta '%s', using '%s' as default",
348+
name, default]);
350349
}
351350

352351
fn crate_meta_name(sess: &session::session, _crate: &ast::crate,
@@ -356,8 +355,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str,
356355
none. {
357356
let name =
358357
{
359-
let os =
360-
str::split(fs::basename(output), '.' as u8);
358+
let os = str::split(fs::basename(output), '.' as u8);
361359
assert (vec::len(os) >= 2u);
362360
vec::pop(os);
363361
str::connect(os, ".")
@@ -429,7 +427,7 @@ fn mangle(ss: &[str]) -> str {
429427

430428
let n = "_ZN"; // Begin name-sequence.
431429

432-
for s: str in ss { n += #fmt("%u%s", str::byte_len(s), s); }
430+
for s: str in ss { n += #fmt["%u%s", str::byte_len(s), s]; }
433431
n += "E"; // End name-sequence.
434432

435433
ret n;
@@ -438,7 +436,7 @@ fn mangle(ss: &[str]) -> str {
438436
fn exported_name(path: &[str], hash: &str, _vers: &str) -> str {
439437
// FIXME: versioning isn't working yet
440438

441-
ret mangle(path + ~[hash]); // + "@" + vers;
439+
ret mangle(path + [hash]); // + "@" + vers;
442440

443441
}
444442

@@ -451,12 +449,12 @@ fn mangle_internal_name_by_type_only(ccx: &@crate_ctxt, t: &ty::t, name: &str)
451449
-> str {
452450
let s = util::ppaux::ty_to_short_str(ccx.tcx, t);
453451
let hash = get_symbol_hash(ccx, t);
454-
ret mangle(~[name, s, hash]);
452+
ret mangle([name, s, hash]);
455453
}
456454

457455
fn mangle_internal_name_by_path_and_seq(ccx: &@crate_ctxt, path: &[str],
458456
flav: &str) -> str {
459-
ret mangle(path + ~[ccx.names.next(flav)]);
457+
ret mangle(path + [ccx.names.next(flav)]);
460458
}
461459

462460
fn mangle_internal_name_by_path(_ccx: &@crate_ctxt, path: &[str]) -> str {

src/comp/back/upcall.rs

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,72 +51,68 @@ type upcalls =
5151

5252
fn declare_upcalls(_tn: type_names, tydesc_type: TypeRef,
5353
taskptr_type: TypeRef, llmod: ModuleRef) -> @upcalls {
54-
fn decl(llmod: ModuleRef, name: str, tys: [TypeRef],
55-
rv: TypeRef) -> ValueRef {
56-
let arg_tys: [TypeRef] = ~[];
57-
for t: TypeRef in tys { arg_tys += ~[t]; }
54+
fn decl(llmod: ModuleRef, name: str, tys: [TypeRef], rv: TypeRef) ->
55+
ValueRef {
56+
let arg_tys: [TypeRef] = [];
57+
for t: TypeRef in tys { arg_tys += [t]; }
5858
let fn_ty = T_fn(arg_tys, rv);
5959
ret trans::decl_cdecl_fn(llmod, "upcall_" + name, fn_ty);
6060
}
61-
fn decl_with_taskptr(taskptr_type: TypeRef,
62-
llmod: ModuleRef, name: str, tys: [TypeRef],
63-
rv: TypeRef) -> ValueRef {
64-
ret decl(llmod, name, ~[taskptr_type] + tys, rv);
61+
fn decl_with_taskptr(taskptr_type: TypeRef, llmod: ModuleRef, name: str,
62+
tys: [TypeRef], rv: TypeRef) -> ValueRef {
63+
ret decl(llmod, name, [taskptr_type] + tys, rv);
6564
}
6665
let dv = bind decl_with_taskptr(taskptr_type, llmod, _, _, T_void());
6766
let d = bind decl_with_taskptr(taskptr_type, llmod, _, _, _);
6867
let dr = bind decl(llmod, _, _, _);
6968

70-
let empty_vec: [TypeRef] = ~[];
71-
ret @{grow_task: dv("grow_task", ~[T_size_t()]),
69+
let empty_vec: [TypeRef] = [];
70+
ret @{grow_task: dv("grow_task", [T_size_t()]),
7271
_yield: dv("yield", empty_vec),
73-
sleep: dv("sleep", ~[T_size_t()]),
74-
_fail: dv("fail", ~[T_ptr(T_i8()), T_ptr(T_i8()), T_size_t()]),
75-
kill: dv("kill", ~[taskptr_type]),
72+
sleep: dv("sleep", [T_size_t()]),
73+
_fail: dv("fail", [T_ptr(T_i8()), T_ptr(T_i8()), T_size_t()]),
74+
kill: dv("kill", [taskptr_type]),
7675
exit: dv("exit", empty_vec),
7776
malloc:
78-
d("malloc", ~[T_size_t(), T_ptr(tydesc_type)], T_ptr(T_i8())),
79-
free: dv("free", ~[T_ptr(T_i8()), T_int()]),
77+
d("malloc", [T_size_t(), T_ptr(tydesc_type)], T_ptr(T_i8())),
78+
free: dv("free", [T_ptr(T_i8()), T_int()]),
8079
shared_malloc:
81-
d("shared_malloc", ~[T_size_t(), T_ptr(tydesc_type)],
80+
d("shared_malloc", [T_size_t(), T_ptr(tydesc_type)],
8281
T_ptr(T_i8())),
83-
shared_free: dv("shared_free", ~[T_ptr(T_i8())]),
84-
mark: d("mark", ~[T_ptr(T_i8())], T_int()),
85-
new_str: d("new_str", ~[T_ptr(T_i8()), T_size_t()], T_ptr(T_str())),
82+
shared_free: dv("shared_free", [T_ptr(T_i8())]),
83+
mark: d("mark", [T_ptr(T_i8())], T_int()),
84+
new_str: d("new_str", [T_ptr(T_i8()), T_size_t()], T_ptr(T_str())),
8685
evec_append:
8786
d("evec_append",
88-
~[T_ptr(tydesc_type), T_ptr(tydesc_type),
89-
T_ptr(T_opaque_vec_ptr()), T_opaque_vec_ptr(), T_bool()],
87+
[T_ptr(tydesc_type), T_ptr(tydesc_type),
88+
T_ptr(T_opaque_vec_ptr()), T_opaque_vec_ptr(), T_bool()],
9089
T_void()),
9190
get_type_desc:
9291
d("get_type_desc",
93-
~[T_ptr(T_nil()), T_size_t(), T_size_t(), T_size_t(),
94-
T_ptr(T_ptr(tydesc_type))], T_ptr(tydesc_type)),
92+
[T_ptr(T_nil()), T_size_t(), T_size_t(), T_size_t(),
93+
T_ptr(T_ptr(tydesc_type))], T_ptr(tydesc_type)),
9594
ivec_resize:
96-
d("ivec_resize", ~[T_ptr(T_opaque_ivec()), T_int()], T_void()),
95+
d("ivec_resize", [T_ptr(T_opaque_ivec()), T_int()], T_void()),
9796
ivec_spill:
98-
d("ivec_spill", ~[T_ptr(T_opaque_ivec()), T_int()], T_void()),
97+
d("ivec_spill", [T_ptr(T_opaque_ivec()), T_int()], T_void()),
9998
ivec_resize_shared:
100-
d("ivec_resize_shared", ~[T_ptr(T_opaque_ivec()), T_int()],
99+
d("ivec_resize_shared", [T_ptr(T_opaque_ivec()), T_int()],
101100
T_void()),
102101
ivec_spill_shared:
103-
d("ivec_spill_shared", ~[T_ptr(T_opaque_ivec()), T_int()],
102+
d("ivec_spill_shared", [T_ptr(T_opaque_ivec()), T_int()],
104103
T_void()),
105104
cmp_type:
106-
dr("cmp_type", ~[T_ptr(T_i1()), taskptr_type,
107-
T_ptr(tydesc_type), T_ptr(T_ptr(tydesc_type)),
108-
T_ptr(T_i8()), T_ptr(T_i8()), T_i8()],
109-
T_void()),
105+
dr("cmp_type",
106+
[T_ptr(T_i1()), taskptr_type, T_ptr(tydesc_type),
107+
T_ptr(T_ptr(tydesc_type)), T_ptr(T_i8()), T_ptr(T_i8()),
108+
T_i8()], T_void()),
110109
log_type:
111-
dr("log_type", ~[taskptr_type, T_ptr(tydesc_type),
112-
T_ptr(T_i8()), T_i32()],
110+
dr("log_type",
111+
[taskptr_type, T_ptr(tydesc_type), T_ptr(T_i8()), T_i32()],
113112
T_void()),
114-
dynastack_mark:
115-
d("dynastack_mark", ~[], T_ptr(T_i8())),
116-
dynastack_alloc:
117-
d("dynastack_alloc", ~[T_size_t()], T_ptr(T_i8())),
118-
dynastack_free:
119-
d("dynastack_free", ~[T_ptr(T_i8())], T_void())};
113+
dynastack_mark: d("dynastack_mark", [], T_ptr(T_i8())),
114+
dynastack_alloc: d("dynastack_alloc", [T_size_t()], T_ptr(T_i8())),
115+
dynastack_free: d("dynastack_free", [T_ptr(T_i8())], T_void())};
120116
}
121117
//
122118
// Local Variables:

0 commit comments

Comments
 (0)