Skip to content

Commit c9e8b7d

Browse files
committed
Merge branch 'master' of github.com:mozilla/rust into incoming
2 parents 810677e + 87eaf91 commit c9e8b7d

33 files changed

+182
-147
lines changed

src/rustc/back/link.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,9 @@ fn mangle(ss: path) -> str {
490490
}
491491

492492
fn exported_name(path: path, hash: @str, vers: @str) -> str {
493-
ret mangle(path + [path_name(hash)]/~ + [path_name(vers)]/~);
493+
ret mangle(
494+
vec::append_one(vec::append_one(path, path_name(hash)),
495+
path_name(vers)));
494496
}
495497

496498
fn mangle_exported_name(ccx: @crate_ctxt, path: path, t: ty::t) -> str {
@@ -508,7 +510,7 @@ fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
508510

509511
fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt, path: path,
510512
flav: @str) -> str {
511-
ret mangle(path + [path_name(@ccx.names(*flav))]/~);
513+
ret mangle(vec::append_one(path, path_name(@ccx.names(*flav))));
512514
}
513515

514516
fn mangle_internal_name_by_path(_ccx: @crate_ctxt, path: path) -> str {
@@ -577,8 +579,10 @@ fn link_binary(sess: session,
577579
// The invocations of cc share some flags across platforms
578580

579581
let mut cc_args =
580-
[stage]/~ + sess.targ_cfg.target_strs.cc_args +
581-
["-o", output, obj_filename]/~;
582+
vec::append([stage]/~, sess.targ_cfg.target_strs.cc_args);
583+
vec::push(cc_args, "-o");
584+
vec::push(cc_args, output);
585+
vec::push(cc_args, obj_filename);
582586

583587
let mut lib_cmd;
584588
let os = sess.targ_cfg.os;

src/rustc/back/rpath.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str]/~ {
2929
let libs = cstore::get_used_crate_files(sess.cstore);
3030
// We don't currently rpath native libraries, but we know
3131
// where rustrt is and we know every rust program needs it
32-
let libs = libs + [get_sysroot_absolute_rt_lib(sess)]/~;
32+
let libs = vec::append_one(libs, get_sysroot_absolute_rt_lib(sess));
3333

3434
let target_triple = sess.opts.target_triple;
3535
let rpaths = get_rpaths(os, cwd, sysroot, output, libs, target_triple);
3636
rpaths_to_flags(rpaths)
3737
}
3838

3939
fn get_sysroot_absolute_rt_lib(sess: session::session) -> path::path {
40-
let path = [sess.filesearch.sysroot()]/~
41-
+ filesearch::relative_target_lib_path(
42-
sess.opts.target_triple)
43-
+ [os::dll_filename("rustrt")]/~;
40+
let mut path = vec::append([sess.filesearch.sysroot()]/~,
41+
filesearch::relative_target_lib_path(
42+
sess.opts.target_triple));
43+
vec::push(path, os::dll_filename("rustrt"));
4444
path::connect_many(path)
4545
}
4646

@@ -83,7 +83,9 @@ fn get_rpaths(os: session::os, cwd: path::path, sysroot: path::path,
8383
log_rpaths("absolute", abs_rpaths);
8484
log_rpaths("fallback", fallback_rpaths);
8585

86-
let rpaths = rel_rpaths + abs_rpaths + fallback_rpaths;
86+
let mut rpaths = rel_rpaths;
87+
vec::push_all(rpaths, abs_rpaths);
88+
vec::push_all(rpaths, fallback_rpaths);
8789

8890
// Remove duplicates
8991
let rpaths = minimize_rpaths(rpaths);
@@ -142,7 +144,7 @@ fn get_relative_to(abs1: path::path, abs2: path::path) -> path::path {
142144
let mut path = []/~;
143145
for uint::range(start_idx, len1 - 1u) {|_i| vec::push(path, ".."); };
144146

145-
path += vec::slice(split2, start_idx, len2 - 1u);
147+
vec::push_all(path, vec::view(split2, start_idx, len2 - 1u));
146148

147149
if check vec::is_not_empty(path) {
148150
ret path::connect_many(path);
@@ -174,8 +176,9 @@ fn get_install_prefix_rpath(cwd: path::path, target_triple: str) -> str {
174176
fail "rustc compiled without CFG_PREFIX environment variable";
175177
}
176178

177-
let path = [install_prefix]/~
178-
+ filesearch::relative_target_lib_path(target_triple);
179+
let path = vec::append(
180+
[install_prefix]/~,
181+
filesearch::relative_target_lib_path(target_triple));
179182
get_absolute(cwd, path::connect_many(path))
180183
}
181184

@@ -184,7 +187,7 @@ fn minimize_rpaths(rpaths: [str]/~) -> [str]/~ {
184187
let mut minimized = []/~;
185188
for rpaths.each {|rpath|
186189
if !set.contains_key(rpath) {
187-
minimized += [rpath]/~;
190+
vec::push(minimized, rpath);
188191
set.insert(rpath, ());
189192
}
190193
}

src/rustc/back/upcall.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn declare_upcalls(targ_cfg: @session::config,
3636
tys: [TypeRef]/~, rv: TypeRef) ->
3737
ValueRef {
3838
let mut arg_tys: [TypeRef]/~ = []/~;
39-
for tys.each {|t| arg_tys += [t]/~; }
39+
for tys.each {|t| vec::push(arg_tys, t); }
4040
let fn_ty = T_fn(arg_tys, rv);
4141
ret base::decl_cdecl_fn(llmod, prefix + name, fn_ty);
4242
}

src/rustc/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn build_configuration(sess: session, argv0: str, input: input) ->
7373
[attr::mk_word_item(@"test")]/~
7474
} else { []/~ }
7575
};
76-
ret user_cfg + gen_cfg + default_cfg;
76+
ret vec::append(vec::append(user_cfg, gen_cfg), default_cfg);
7777
}
7878

7979
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
@@ -414,8 +414,8 @@ fn build_session_options(match: getopts::match,
414414
let parse_only = opt_present(match, "parse-only");
415415
let no_trans = opt_present(match, "no-trans");
416416

417-
let lint_flags = (getopts::opt_strs(match, "W")
418-
+ getopts::opt_strs(match, "warn"));
417+
let lint_flags = vec::append(getopts::opt_strs(match, "W"),
418+
getopts::opt_strs(match, "warn"));
419419
let lint_dict = lint::get_lint_dict();
420420
let lint_opts = vec::map(lint_flags) {|flag|
421421
alt lint::lookup_lint(lint_dict, flag) {

src/rustc/driver/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ fn run_compiler(args: [str]/~, demitter: diagnostic::emitter) {
131131
ret;
132132
}
133133

134-
let lint_flags = (getopts::opt_strs(match, "W")
135-
+ getopts::opt_strs(match, "warn"));
134+
let lint_flags = vec::append(getopts::opt_strs(match, "W"),
135+
getopts::opt_strs(match, "warn"));
136136
if lint_flags.contains("help") {
137137
describe_warnings();
138138
ret;

src/rustc/front/core_inject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn inject_libcore_ref(sess: session,
4141
vis: ast::public,
4242
span: dummy_sp()};
4343

44-
let vis = [vi1, vi2]/~ + crate.node.module.view_items;
44+
let vis = vec::append([vi1, vi2]/~, crate.node.module.view_items);
4545

4646
ret @{node: {module: { view_items: vis with crate.node.module }
4747
with crate.node} with *crate }

src/rustc/front/intrinsic_inject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn inject_intrinsic(sess: session,
2222
}
2323
};
2424

25-
let items = [item]/~ + crate.node.module.items;
25+
let items = vec::append([item]/~, crate.node.module.items);
2626

2727
ret @{node: {module: { items: items with crate.node.module }
2828
with crate.node} with *crate }

src/rustc/front/test.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn fold_crate(cx: test_ctxt, c: ast::crate_, fld: fold::ast_fold) ->
9898
fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
9999
@ast::item {
100100

101-
cx.path += [i.ident]/~;
101+
vec::push(cx.path, i.ident);
102102
#debug("current path: %s", ast_util::path_name_i(cx.path));
103103

104104
if is_test_fn(i) {
@@ -161,7 +161,7 @@ fn should_fail(i: @ast::item) -> bool {
161161

162162
fn add_test_module(cx: test_ctxt, m: ast::_mod) -> ast::_mod {
163163
let testmod = mk_test_module(cx);
164-
ret {items: m.items + [testmod]/~ with m};
164+
ret {items: vec::append_one(m.items, testmod) with m};
165165
}
166166

167167
/*
@@ -252,7 +252,8 @@ fn mk_path(cx: test_ctxt, path: [ast::ident]/~) -> [ast::ident]/~ {
252252
_ { false }
253253
}
254254
};
255-
(if is_std { []/~ } else { [@"std"]/~ }) + path
255+
if is_std { path }
256+
else { vec::append([@"std"]/~, path) }
256257
}
257258

258259
// The ast::ty of [std::test::test_desc]/~
@@ -278,7 +279,7 @@ fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr {
278279
#debug("building test vector from %u tests", cx.testfns.len());
279280
let mut descs = []/~;
280281
for cx.testfns.each {|test|
281-
descs += [mk_test_desc_rec(cx, test)]/~;
282+
vec::push(descs, mk_test_desc_rec(cx, test));
282283
}
283284

284285
let inner_expr = @{id: cx.sess.next_node_id(),

src/rustc/lib/llvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef]/~, ty: TypeRef) ->
991991
_ {}
992992
}
993993

994-
let outer = outer0 + [ty]/~;
994+
let outer = vec::append_one(outer0, ty);
995995

996996
let kind = llvm::LLVMGetTypeKind(ty);
997997

src/rustc/metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fn metas_with(ident: ast::ident, key: ast::ident,
164164
metas: [@ast::meta_item]/~) -> [@ast::meta_item]/~ {
165165
let name_items = attr::find_meta_items_by_name(metas, *key);
166166
if name_items.is_empty() {
167-
metas + [attr::mk_name_value_item_str(key, *ident)]/~
167+
vec::append_one(metas, attr::mk_name_value_item_str(key, *ident))
168168
} else {
169169
metas
170170
}

src/rustc/metadata/csearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn get_item_path(tcx: ty::ctxt, def: ast::def_id) -> ast_map::path {
8888

8989
// FIXME #1920: This path is not always correct if the crate is not linked
9090
// into the root namespace.
91-
[ast_map::path_mod(@cdata.name)]/~ + path
91+
vec::append([ast_map::path_mod(@cdata.name)]/~, path)
9292
}
9393

9494
enum found_ast {

src/rustc/metadata/cstore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn get_used_libraries(cstore: cstore) -> [str]/~ {
134134
}
135135

136136
fn add_used_link_args(cstore: cstore, args: str) {
137-
p(cstore).used_link_args += str::split_char(args, ' ');
137+
vec::push_all(p(cstore).used_link_args, str::split_char(args, ' '));
138138
}
139139

140140
fn get_used_link_args(cstore: cstore) -> [str]/~ {

src/rustc/metadata/decoder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,9 @@ fn get_attributes(md: ebml::doc) -> [ast::attribute]/~ {
611611
// an attribute
612612
assert (vec::len(meta_items) == 1u);
613613
let meta_item = meta_items[0];
614-
attrs +=
615-
[{node: {style: ast::attr_outer, value: *meta_item},
616-
span: ast_util::dummy_sp()}]/~;
614+
vec::push(attrs,
615+
{node: {style: ast::attr_outer, value: *meta_item},
616+
span: ast_util::dummy_sp()});
617617
};
618618
}
619619
option::none { }

src/rustc/metadata/encoder.rs

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ fn encode_enum_variant_paths(ebml_w: ebml::writer, variants: [variant]/~,
119119
}
120120
}
121121

122-
fn add_to_index(ebml_w: ebml::writer, path: [ident]/~, &index: [entry<str>]/~,
122+
fn add_to_index(ebml_w: ebml::writer, path: [ident]/&, &index: [entry<str>]/~,
123123
name: ident) {
124-
let full_path = path + [name]/~;
124+
let mut full_path = []/~;
125+
vec::push_all(full_path, path);
126+
vec::push(full_path, name);
125127
vec::push(index, {val: ast_util::path_name_i(full_path),
126128
pos: ebml_w.writer.tell()});
127129
}
@@ -171,15 +173,16 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt,
171173
ebml_w.wr_tag(tag_paths_data_mod) {||
172174
encode_name_and_def_id(ebml_w, it.ident, it.id);
173175
encode_module_item_paths(ebml_w, ecx, _mod,
174-
path + [it.ident]/~,
176+
vec::append_one(path, it.ident),
175177
index);
176178
}
177179
}
178180
item_foreign_mod(nmod) {
179181
ebml_w.wr_tag(tag_paths_data_mod) {||
180182
encode_name_and_def_id(ebml_w, it.ident, it.id);
181-
encode_foreign_module_item_paths(ebml_w, nmod,
182-
path + [it.ident]/~, index);
183+
encode_foreign_module_item_paths(
184+
ebml_w, nmod,
185+
vec::append_one(path, it.ident), index);
183186
}
184187
}
185188
item_ty(_, tps, _) {
@@ -197,7 +200,8 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt,
197200
add_to_index(ebml_w, path, index, it.ident);
198201
encode_named_def_id(ebml_w, it.ident,
199202
local_def(ctor.node.id));
200-
encode_class_item_paths(ebml_w, items, path + [it.ident]/~,
203+
encode_class_item_paths(ebml_w, items,
204+
vec::append_one(path, it.ident),
201205
index);
202206
}
203207
}
@@ -451,11 +455,12 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer,
451455
vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()});
452456
vec::push(*global_index,
453457
{val: m.id, pos: ebml_w.writer.tell()});
454-
let impl_path = path + [ast_map::path_name(m.ident)]/~;
458+
let impl_path = vec::append_one(path,
459+
ast_map::path_name(m.ident));
455460
#debug("encode_info_for_class: doing %s %d", *m.ident, m.id);
456461
encode_info_for_method(ecx, ebml_w, impl_path,
457462
should_inline(m.attrs), id, m,
458-
class_tps + m.tps);
463+
vec::append(class_tps, m.tps));
459464
}
460465
_ { /* don't encode private methods */ }
461466
}
@@ -709,11 +714,13 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
709714
encode_path(ebml_w, path, ast_map::path_name(item.ident));
710715
ebml_w.end_tag();
711716

712-
let impl_path = path + [ast_map::path_name(item.ident)]/~;
717+
let impl_path = vec::append_one(path,
718+
ast_map::path_name(item.ident));
713719
for methods.each {|m|
714720
vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()});
715721
encode_info_for_method(ecx, ebml_w, impl_path,
716-
should_inline(m.attrs), item.id, m, tps + m.tps);
722+
should_inline(m.attrs), item.id, m,
723+
vec::append(tps, m.tps));
717724
}
718725
}
719726
item_iface(tps, rp, ms) {
@@ -786,8 +793,8 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
786793
item_class(tps, _, _, ctor, m_dtor, _) {
787794
#debug("encoding info for ctor %s %d", *i.ident,
788795
ctor.node.id);
789-
*index +=
790-
[{val: ctor.node.id, pos: ebml_w.writer.tell()}]/~;
796+
vec::push(*index,
797+
{val: ctor.node.id, pos: ebml_w.writer.tell()});
791798
encode_info_for_fn(ecx, ebml_w, ctor.node.id, i.ident,
792799
*pt, if tps.len() > 0u {
793800
some(ii_ctor(ctor, i.ident, tps,
@@ -933,7 +940,7 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute]/~ {
933940
attr::remove_meta_items_by_name(tmp, @"vers")
934941
};
935942

936-
let meta_items = [name_item, vers_item]/~ + other_items;
943+
let meta_items = vec::append([name_item, vers_item]/~, other_items);
937944
let link_item = attr::mk_list_item(@"link", meta_items);
938945

939946
ret attr::mk_attr(link_item);
@@ -942,18 +949,19 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute]/~ {
942949
let mut attrs: [attribute]/~ = []/~;
943950
let mut found_link_attr = false;
944951
for crate.node.attrs.each {|attr|
945-
attrs +=
952+
vec::push(
953+
attrs,
946954
if *attr::get_attr_name(attr) != "link" {
947-
[attr]/~
955+
attr
948956
} else {
949957
alt attr.node.value.node {
950958
meta_list(n, l) {
951959
found_link_attr = true;;
952-
[synthesize_link_attr(ecx, l)]/~
960+
synthesize_link_attr(ecx, l)
953961
}
954-
_ { [attr]/~ }
962+
_ { attr }
955963
}
956-
};
964+
});
957965
}
958966

959967
if !found_link_attr { vec::push(attrs, synthesize_link_attr(ecx, []/~)); }

0 commit comments

Comments
 (0)