Merge branch 'master' of github.com:mozilla/rust into incoming

This commit is contained in:
Eric Holk 2012-06-28 17:30:36 -07:00
commit c9e8b7de82
33 changed files with 182 additions and 147 deletions

View file

@ -490,7 +490,9 @@ fn mangle(ss: path) -> str {
} }
fn exported_name(path: path, hash: @str, vers: @str) -> str { fn exported_name(path: path, hash: @str, vers: @str) -> str {
ret mangle(path + [path_name(hash)]/~ + [path_name(vers)]/~); ret mangle(
vec::append_one(vec::append_one(path, path_name(hash)),
path_name(vers)));
} }
fn mangle_exported_name(ccx: @crate_ctxt, path: path, t: ty::t) -> str { 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,
fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt, path: path, fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt, path: path,
flav: @str) -> str { flav: @str) -> str {
ret mangle(path + [path_name(@ccx.names(*flav))]/~); ret mangle(vec::append_one(path, path_name(@ccx.names(*flav))));
} }
fn mangle_internal_name_by_path(_ccx: @crate_ctxt, path: path) -> str { fn mangle_internal_name_by_path(_ccx: @crate_ctxt, path: path) -> str {
@ -577,8 +579,10 @@ fn link_binary(sess: session,
// The invocations of cc share some flags across platforms // The invocations of cc share some flags across platforms
let mut cc_args = let mut cc_args =
[stage]/~ + sess.targ_cfg.target_strs.cc_args + vec::append([stage]/~, sess.targ_cfg.target_strs.cc_args);
["-o", output, obj_filename]/~; vec::push(cc_args, "-o");
vec::push(cc_args, output);
vec::push(cc_args, obj_filename);
let mut lib_cmd; let mut lib_cmd;
let os = sess.targ_cfg.os; let os = sess.targ_cfg.os;

View file

@ -29,7 +29,7 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str]/~ {
let libs = cstore::get_used_crate_files(sess.cstore); let libs = cstore::get_used_crate_files(sess.cstore);
// We don't currently rpath native libraries, but we know // We don't currently rpath native libraries, but we know
// where rustrt is and we know every rust program needs it // where rustrt is and we know every rust program needs it
let libs = libs + [get_sysroot_absolute_rt_lib(sess)]/~; let libs = vec::append_one(libs, get_sysroot_absolute_rt_lib(sess));
let target_triple = sess.opts.target_triple; let target_triple = sess.opts.target_triple;
let rpaths = get_rpaths(os, cwd, sysroot, output, libs, target_triple); let rpaths = get_rpaths(os, cwd, sysroot, output, libs, target_triple);
@ -37,10 +37,10 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str]/~ {
} }
fn get_sysroot_absolute_rt_lib(sess: session::session) -> path::path { fn get_sysroot_absolute_rt_lib(sess: session::session) -> path::path {
let path = [sess.filesearch.sysroot()]/~ let mut path = vec::append([sess.filesearch.sysroot()]/~,
+ filesearch::relative_target_lib_path( filesearch::relative_target_lib_path(
sess.opts.target_triple) sess.opts.target_triple));
+ [os::dll_filename("rustrt")]/~; vec::push(path, os::dll_filename("rustrt"));
path::connect_many(path) path::connect_many(path)
} }
@ -83,7 +83,9 @@ fn get_rpaths(os: session::os, cwd: path::path, sysroot: path::path,
log_rpaths("absolute", abs_rpaths); log_rpaths("absolute", abs_rpaths);
log_rpaths("fallback", fallback_rpaths); log_rpaths("fallback", fallback_rpaths);
let rpaths = rel_rpaths + abs_rpaths + fallback_rpaths; let mut rpaths = rel_rpaths;
vec::push_all(rpaths, abs_rpaths);
vec::push_all(rpaths, fallback_rpaths);
// Remove duplicates // Remove duplicates
let rpaths = minimize_rpaths(rpaths); let rpaths = minimize_rpaths(rpaths);
@ -142,7 +144,7 @@ fn get_relative_to(abs1: path::path, abs2: path::path) -> path::path {
let mut path = []/~; let mut path = []/~;
for uint::range(start_idx, len1 - 1u) {|_i| vec::push(path, ".."); }; for uint::range(start_idx, len1 - 1u) {|_i| vec::push(path, ".."); };
path += vec::slice(split2, start_idx, len2 - 1u); vec::push_all(path, vec::view(split2, start_idx, len2 - 1u));
if check vec::is_not_empty(path) { if check vec::is_not_empty(path) {
ret path::connect_many(path); ret path::connect_many(path);
@ -174,8 +176,9 @@ fn get_install_prefix_rpath(cwd: path::path, target_triple: str) -> str {
fail "rustc compiled without CFG_PREFIX environment variable"; fail "rustc compiled without CFG_PREFIX environment variable";
} }
let path = [install_prefix]/~ let path = vec::append(
+ filesearch::relative_target_lib_path(target_triple); [install_prefix]/~,
filesearch::relative_target_lib_path(target_triple));
get_absolute(cwd, path::connect_many(path)) get_absolute(cwd, path::connect_many(path))
} }
@ -184,7 +187,7 @@ fn minimize_rpaths(rpaths: [str]/~) -> [str]/~ {
let mut minimized = []/~; let mut minimized = []/~;
for rpaths.each {|rpath| for rpaths.each {|rpath|
if !set.contains_key(rpath) { if !set.contains_key(rpath) {
minimized += [rpath]/~; vec::push(minimized, rpath);
set.insert(rpath, ()); set.insert(rpath, ());
} }
} }

View file

@ -36,7 +36,7 @@ fn declare_upcalls(targ_cfg: @session::config,
tys: [TypeRef]/~, rv: TypeRef) -> tys: [TypeRef]/~, rv: TypeRef) ->
ValueRef { ValueRef {
let mut arg_tys: [TypeRef]/~ = []/~; let mut arg_tys: [TypeRef]/~ = []/~;
for tys.each {|t| arg_tys += [t]/~; } for tys.each {|t| vec::push(arg_tys, t); }
let fn_ty = T_fn(arg_tys, rv); let fn_ty = T_fn(arg_tys, rv);
ret base::decl_cdecl_fn(llmod, prefix + name, fn_ty); ret base::decl_cdecl_fn(llmod, prefix + name, fn_ty);
} }

View file

@ -73,7 +73,7 @@ fn build_configuration(sess: session, argv0: str, input: input) ->
[attr::mk_word_item(@"test")]/~ [attr::mk_word_item(@"test")]/~
} else { []/~ } } else { []/~ }
}; };
ret user_cfg + gen_cfg + default_cfg; ret vec::append(vec::append(user_cfg, gen_cfg), default_cfg);
} }
// Convert strings provided as --cfg [cfgspec] into a crate_cfg // Convert strings provided as --cfg [cfgspec] into a crate_cfg
@ -414,8 +414,8 @@ fn build_session_options(match: getopts::match,
let parse_only = opt_present(match, "parse-only"); let parse_only = opt_present(match, "parse-only");
let no_trans = opt_present(match, "no-trans"); let no_trans = opt_present(match, "no-trans");
let lint_flags = (getopts::opt_strs(match, "W") let lint_flags = vec::append(getopts::opt_strs(match, "W"),
+ getopts::opt_strs(match, "warn")); getopts::opt_strs(match, "warn"));
let lint_dict = lint::get_lint_dict(); let lint_dict = lint::get_lint_dict();
let lint_opts = vec::map(lint_flags) {|flag| let lint_opts = vec::map(lint_flags) {|flag|
alt lint::lookup_lint(lint_dict, flag) { alt lint::lookup_lint(lint_dict, flag) {

View file

@ -131,8 +131,8 @@ fn run_compiler(args: [str]/~, demitter: diagnostic::emitter) {
ret; ret;
} }
let lint_flags = (getopts::opt_strs(match, "W") let lint_flags = vec::append(getopts::opt_strs(match, "W"),
+ getopts::opt_strs(match, "warn")); getopts::opt_strs(match, "warn"));
if lint_flags.contains("help") { if lint_flags.contains("help") {
describe_warnings(); describe_warnings();
ret; ret;

View file

@ -41,7 +41,7 @@ fn inject_libcore_ref(sess: session,
vis: ast::public, vis: ast::public,
span: dummy_sp()}; span: dummy_sp()};
let vis = [vi1, vi2]/~ + crate.node.module.view_items; let vis = vec::append([vi1, vi2]/~, crate.node.module.view_items);
ret @{node: {module: { view_items: vis with crate.node.module } ret @{node: {module: { view_items: vis with crate.node.module }
with crate.node} with *crate } with crate.node} with *crate }

View file

@ -22,7 +22,7 @@ fn inject_intrinsic(sess: session,
} }
}; };
let items = [item]/~ + crate.node.module.items; let items = vec::append([item]/~, crate.node.module.items);
ret @{node: {module: { items: items with crate.node.module } ret @{node: {module: { items: items with crate.node.module }
with crate.node} with *crate } with crate.node} with *crate }

View file

@ -98,7 +98,7 @@ fn fold_crate(cx: test_ctxt, c: ast::crate_, fld: fold::ast_fold) ->
fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) -> fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
@ast::item { @ast::item {
cx.path += [i.ident]/~; vec::push(cx.path, i.ident);
#debug("current path: %s", ast_util::path_name_i(cx.path)); #debug("current path: %s", ast_util::path_name_i(cx.path));
if is_test_fn(i) { if is_test_fn(i) {
@ -161,7 +161,7 @@ fn should_fail(i: @ast::item) -> bool {
fn add_test_module(cx: test_ctxt, m: ast::_mod) -> ast::_mod { fn add_test_module(cx: test_ctxt, m: ast::_mod) -> ast::_mod {
let testmod = mk_test_module(cx); let testmod = mk_test_module(cx);
ret {items: m.items + [testmod]/~ with m}; ret {items: vec::append_one(m.items, testmod) with m};
} }
/* /*
@ -252,7 +252,8 @@ fn mk_path(cx: test_ctxt, path: [ast::ident]/~) -> [ast::ident]/~ {
_ { false } _ { false }
} }
}; };
(if is_std { []/~ } else { [@"std"]/~ }) + path if is_std { path }
else { vec::append([@"std"]/~, path) }
} }
// The ast::ty of [std::test::test_desc]/~ // The ast::ty of [std::test::test_desc]/~
@ -278,7 +279,7 @@ fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr {
#debug("building test vector from %u tests", cx.testfns.len()); #debug("building test vector from %u tests", cx.testfns.len());
let mut descs = []/~; let mut descs = []/~;
for cx.testfns.each {|test| for cx.testfns.each {|test|
descs += [mk_test_desc_rec(cx, test)]/~; vec::push(descs, mk_test_desc_rec(cx, test));
} }
let inner_expr = @{id: cx.sess.next_node_id(), let inner_expr = @{id: cx.sess.next_node_id(),

View file

@ -991,7 +991,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef]/~, ty: TypeRef) ->
_ {} _ {}
} }
let outer = outer0 + [ty]/~; let outer = vec::append_one(outer0, ty);
let kind = llvm::LLVMGetTypeKind(ty); let kind = llvm::LLVMGetTypeKind(ty);

View file

@ -164,7 +164,7 @@ fn metas_with(ident: ast::ident, key: ast::ident,
metas: [@ast::meta_item]/~) -> [@ast::meta_item]/~ { metas: [@ast::meta_item]/~) -> [@ast::meta_item]/~ {
let name_items = attr::find_meta_items_by_name(metas, *key); let name_items = attr::find_meta_items_by_name(metas, *key);
if name_items.is_empty() { if name_items.is_empty() {
metas + [attr::mk_name_value_item_str(key, *ident)]/~ vec::append_one(metas, attr::mk_name_value_item_str(key, *ident))
} else { } else {
metas metas
} }

View file

@ -88,7 +88,7 @@ fn get_item_path(tcx: ty::ctxt, def: ast::def_id) -> ast_map::path {
// FIXME #1920: This path is not always correct if the crate is not linked // FIXME #1920: This path is not always correct if the crate is not linked
// into the root namespace. // into the root namespace.
[ast_map::path_mod(@cdata.name)]/~ + path vec::append([ast_map::path_mod(@cdata.name)]/~, path)
} }
enum found_ast { enum found_ast {

View file

@ -134,7 +134,7 @@ fn get_used_libraries(cstore: cstore) -> [str]/~ {
} }
fn add_used_link_args(cstore: cstore, args: str) { fn add_used_link_args(cstore: cstore, args: str) {
p(cstore).used_link_args += str::split_char(args, ' '); vec::push_all(p(cstore).used_link_args, str::split_char(args, ' '));
} }
fn get_used_link_args(cstore: cstore) -> [str]/~ { fn get_used_link_args(cstore: cstore) -> [str]/~ {

View file

@ -611,9 +611,9 @@ fn get_attributes(md: ebml::doc) -> [ast::attribute]/~ {
// an attribute // an attribute
assert (vec::len(meta_items) == 1u); assert (vec::len(meta_items) == 1u);
let meta_item = meta_items[0]; let meta_item = meta_items[0];
attrs += vec::push(attrs,
[{node: {style: ast::attr_outer, value: *meta_item}, {node: {style: ast::attr_outer, value: *meta_item},
span: ast_util::dummy_sp()}]/~; span: ast_util::dummy_sp()});
}; };
} }
option::none { } option::none { }

View file

@ -119,9 +119,11 @@ fn encode_enum_variant_paths(ebml_w: ebml::writer, variants: [variant]/~,
} }
} }
fn add_to_index(ebml_w: ebml::writer, path: [ident]/~, &index: [entry<str>]/~, fn add_to_index(ebml_w: ebml::writer, path: [ident]/&, &index: [entry<str>]/~,
name: ident) { name: ident) {
let full_path = path + [name]/~; let mut full_path = []/~;
vec::push_all(full_path, path);
vec::push(full_path, name);
vec::push(index, {val: ast_util::path_name_i(full_path), vec::push(index, {val: ast_util::path_name_i(full_path),
pos: ebml_w.writer.tell()}); pos: ebml_w.writer.tell()});
} }
@ -171,15 +173,16 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt,
ebml_w.wr_tag(tag_paths_data_mod) {|| ebml_w.wr_tag(tag_paths_data_mod) {||
encode_name_and_def_id(ebml_w, it.ident, it.id); encode_name_and_def_id(ebml_w, it.ident, it.id);
encode_module_item_paths(ebml_w, ecx, _mod, encode_module_item_paths(ebml_w, ecx, _mod,
path + [it.ident]/~, vec::append_one(path, it.ident),
index); index);
} }
} }
item_foreign_mod(nmod) { item_foreign_mod(nmod) {
ebml_w.wr_tag(tag_paths_data_mod) {|| ebml_w.wr_tag(tag_paths_data_mod) {||
encode_name_and_def_id(ebml_w, it.ident, it.id); encode_name_and_def_id(ebml_w, it.ident, it.id);
encode_foreign_module_item_paths(ebml_w, nmod, encode_foreign_module_item_paths(
path + [it.ident]/~, index); ebml_w, nmod,
vec::append_one(path, it.ident), index);
} }
} }
item_ty(_, tps, _) { item_ty(_, tps, _) {
@ -197,7 +200,8 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt,
add_to_index(ebml_w, path, index, it.ident); add_to_index(ebml_w, path, index, it.ident);
encode_named_def_id(ebml_w, it.ident, encode_named_def_id(ebml_w, it.ident,
local_def(ctor.node.id)); local_def(ctor.node.id));
encode_class_item_paths(ebml_w, items, path + [it.ident]/~, encode_class_item_paths(ebml_w, items,
vec::append_one(path, it.ident),
index); index);
} }
} }
@ -451,11 +455,12 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer,
vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()}); vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()});
vec::push(*global_index, vec::push(*global_index,
{val: m.id, pos: ebml_w.writer.tell()}); {val: m.id, pos: ebml_w.writer.tell()});
let impl_path = path + [ast_map::path_name(m.ident)]/~; let impl_path = vec::append_one(path,
ast_map::path_name(m.ident));
#debug("encode_info_for_class: doing %s %d", *m.ident, m.id); #debug("encode_info_for_class: doing %s %d", *m.ident, m.id);
encode_info_for_method(ecx, ebml_w, impl_path, encode_info_for_method(ecx, ebml_w, impl_path,
should_inline(m.attrs), id, m, should_inline(m.attrs), id, m,
class_tps + m.tps); vec::append(class_tps, m.tps));
} }
_ { /* don't encode private methods */ } _ { /* don't encode private methods */ }
} }
@ -709,11 +714,13 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
encode_path(ebml_w, path, ast_map::path_name(item.ident)); encode_path(ebml_w, path, ast_map::path_name(item.ident));
ebml_w.end_tag(); ebml_w.end_tag();
let impl_path = path + [ast_map::path_name(item.ident)]/~; let impl_path = vec::append_one(path,
ast_map::path_name(item.ident));
for methods.each {|m| for methods.each {|m|
vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()}); vec::push(*index, {val: m.id, pos: ebml_w.writer.tell()});
encode_info_for_method(ecx, ebml_w, impl_path, encode_info_for_method(ecx, ebml_w, impl_path,
should_inline(m.attrs), item.id, m, tps + m.tps); should_inline(m.attrs), item.id, m,
vec::append(tps, m.tps));
} }
} }
item_iface(tps, rp, ms) { item_iface(tps, rp, ms) {
@ -786,8 +793,8 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
item_class(tps, _, _, ctor, m_dtor, _) { item_class(tps, _, _, ctor, m_dtor, _) {
#debug("encoding info for ctor %s %d", *i.ident, #debug("encoding info for ctor %s %d", *i.ident,
ctor.node.id); ctor.node.id);
*index += vec::push(*index,
[{val: ctor.node.id, pos: ebml_w.writer.tell()}]/~; {val: ctor.node.id, pos: ebml_w.writer.tell()});
encode_info_for_fn(ecx, ebml_w, ctor.node.id, i.ident, encode_info_for_fn(ecx, ebml_w, ctor.node.id, i.ident,
*pt, if tps.len() > 0u { *pt, if tps.len() > 0u {
some(ii_ctor(ctor, i.ident, tps, some(ii_ctor(ctor, i.ident, tps,
@ -933,7 +940,7 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute]/~ {
attr::remove_meta_items_by_name(tmp, @"vers") attr::remove_meta_items_by_name(tmp, @"vers")
}; };
let meta_items = [name_item, vers_item]/~ + other_items; let meta_items = vec::append([name_item, vers_item]/~, other_items);
let link_item = attr::mk_list_item(@"link", meta_items); let link_item = attr::mk_list_item(@"link", meta_items);
ret attr::mk_attr(link_item); ret attr::mk_attr(link_item);
@ -942,18 +949,19 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute]/~ {
let mut attrs: [attribute]/~ = []/~; let mut attrs: [attribute]/~ = []/~;
let mut found_link_attr = false; let mut found_link_attr = false;
for crate.node.attrs.each {|attr| for crate.node.attrs.each {|attr|
attrs += vec::push(
attrs,
if *attr::get_attr_name(attr) != "link" { if *attr::get_attr_name(attr) != "link" {
[attr]/~ attr
} else { } else {
alt attr.node.value.node { alt attr.node.value.node {
meta_list(n, l) { meta_list(n, l) {
found_link_attr = true;; found_link_attr = true;;
[synthesize_link_attr(ecx, l)]/~ synthesize_link_attr(ecx, l)
} }
_ { [attr]/~ } _ { attr }
} }
}; });
} }
if !found_link_attr { vec::push(attrs, synthesize_link_attr(ecx, []/~)); } if !found_link_attr { vec::push(attrs, synthesize_link_attr(ecx, []/~)); }

View file

@ -39,16 +39,19 @@ fn mk_filesearch(maybe_sysroot: option<path>,
impl of filesearch for filesearch_impl { impl of filesearch for filesearch_impl {
fn sysroot() -> path { self.sysroot } fn sysroot() -> path { self.sysroot }
fn lib_search_paths() -> [path]/~ { fn lib_search_paths() -> [path]/~ {
self.addl_lib_search_paths let mut paths = self.addl_lib_search_paths;
+ [make_target_lib_path(self.sysroot, self.target_triple)]/~
+ alt get_cargo_lib_path_nearest() { vec::push(paths,
result::ok(p) { [p]/~ } make_target_lib_path(self.sysroot, self.target_triple));
result::err(p) { []/~ } alt get_cargo_lib_path_nearest() {
result::ok(p) { vec::push(paths, p) }
result::err(p) { }
} }
+ alt get_cargo_lib_path() { alt get_cargo_lib_path() {
result::ok(p) { [p]/~ } result::ok(p) { vec::push(paths, p) }
result::err(p) { []/~ } result::err(p) { }
} }
paths
} }
fn get_target_lib_path() -> path { fn get_target_lib_path() -> path {
make_target_lib_path(self.sysroot, self.target_triple) make_target_lib_path(self.sysroot, self.target_triple)
@ -91,7 +94,8 @@ fn relative_target_lib_path(target_triple: str) -> [path]/~ {
fn make_target_lib_path(sysroot: path, fn make_target_lib_path(sysroot: path,
target_triple: str) -> path { target_triple: str) -> path {
let path = [sysroot]/~ + relative_target_lib_path(target_triple); let path = vec::append([sysroot]/~,
relative_target_lib_path(target_triple));
let path = path::connect_many(path); let path = path::connect_many(path);
ret path; ret path;
} }

View file

@ -47,7 +47,7 @@ fn check_arms(tcx: ty::ctxt, arms: [arm]/~) {
} }
_ {} _ {}
} }
if option::is_none(arm.guard) { seen += [v]/~; } if option::is_none(arm.guard) { vec::push(seen, v); }
} }
} }
} }
@ -220,7 +220,7 @@ fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> option<ctor> {
let mut found = []/~; let mut found = []/~;
for m.each {|r| for m.each {|r|
option::iter(pat_ctor_id(tcx, r[0])) {|id| option::iter(pat_ctor_id(tcx, r[0])) {|id|
if !vec::contains(found, id) { found += [id]/~; } if !vec::contains(found, id) { vec::push(found, id); }
} }
} }
let variants = ty::enum_variants(tcx, eid); let variants = ty::enum_variants(tcx, eid);
@ -274,14 +274,15 @@ fn specialize(tcx: ty::ctxt, r: [@pat]/~, ctor_id: ctor, arity: uint,
left_ty: ty::t) -> option<[@pat]/~> { left_ty: ty::t) -> option<[@pat]/~> {
let r0 = raw_pat(r[0]); let r0 = raw_pat(r[0]);
alt r0.node { alt r0.node {
pat_wild { some(vec::from_elem(arity, wild()) + vec::tail(r)) } pat_wild { some(vec::append(vec::from_elem(arity, wild()),
vec::tail(r))) }
pat_ident(_, _) { pat_ident(_, _) {
alt tcx.def_map.find(r0.id) { alt tcx.def_map.find(r0.id) {
some(def_variant(_, id)) { some(def_variant(_, id)) {
if variant(id) == ctor_id { some(vec::tail(r)) } if variant(id) == ctor_id { some(vec::tail(r)) }
else { none } else { none }
} }
_ { some(vec::from_elem(arity, wild()) + vec::tail(r)) } _ { some(vec::append(vec::from_elem(arity, wild()), vec::tail(r))) }
} }
} }
pat_enum(_, args) { pat_enum(_, args) {
@ -291,7 +292,7 @@ fn specialize(tcx: ty::ctxt, r: [@pat]/~, ctor_id: ctor, arity: uint,
some(args) { args } some(args) { args }
none { vec::from_elem(arity, wild()) } none { vec::from_elem(arity, wild()) }
}; };
some(args + vec::tail(r)) some(vec::append(args, vec::tail(r)))
} }
def_variant(_, _) { none } def_variant(_, _) { none }
} }
@ -305,10 +306,10 @@ fn specialize(tcx: ty::ctxt, r: [@pat]/~, ctor_id: ctor, arity: uint,
some(f) { f.pat } _ { wild() } some(f) { f.pat } _ { wild() }
} }
}); });
some(args + vec::tail(r)) some(vec::append(args, vec::tail(r)))
} }
pat_tup(args) { some(args + vec::tail(r)) } pat_tup(args) { some(vec::append(args, vec::tail(r))) }
pat_box(a) | pat_uniq(a) { some([a]/~ + vec::tail(r)) } pat_box(a) | pat_uniq(a) { some(vec::append([a]/~, vec::tail(r))) }
pat_lit(expr) { pat_lit(expr) {
let e_v = eval_const_expr(tcx, expr); let e_v = eval_const_expr(tcx, expr);
let match = alt check ctor_id { let match = alt check ctor_id {

View file

@ -64,7 +64,7 @@ fn collect_freevars(def_map: resolve::def_map, blk: ast::blk)
if i == depth { // Made it to end of loop if i == depth { // Made it to end of loop
let dnum = ast_util::def_id_of_def(def).node; let dnum = ast_util::def_id_of_def(def).node;
if !seen.contains_key(dnum) { if !seen.contains_key(dnum) {
*refs += [@{def:def, span:expr.span}]/~; vec::push(*refs, @{def:def, span:expr.span});
seen.insert(dnum, ()); seen.insert(dnum, ());
} }
} }

View file

@ -274,7 +274,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
let ifce_bounds = let ifce_bounds =
ty::lookup_item_type(cx.tcx, ifce_id).bounds; ty::lookup_item_type(cx.tcx, ifce_id).bounds;
let mth = ty::iface_methods(cx.tcx, ifce_id)[n_mth]; let mth = ty::iface_methods(cx.tcx, ifce_id)[n_mth];
@(*ifce_bounds + *mth.tps) @(vec::append(*ifce_bounds, *mth.tps))
} }
} }
} }

View file

@ -358,7 +358,7 @@ fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) {
fn check_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id, fn check_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id,
decl: ast::fn_decl) { decl: ast::fn_decl) {
let tys = vec::map(decl.inputs) {|a| a.ty }; let tys = vec::map(decl.inputs) {|a| a.ty };
for vec::each(tys + [decl.output]/~) {|ty| for vec::each(vec::append_one(tys, decl.output)) {|ty|
alt ty.node { alt ty.node {
ast::ty_path(_, id) { ast::ty_path(_, id) {
alt cx.def_map.get(id) { alt cx.def_map.get(id) {

View file

@ -242,7 +242,7 @@ class ir_maps {
fn add_live_node(lnk: live_node_kind) -> live_node { fn add_live_node(lnk: live_node_kind) -> live_node {
let ln = live_node(self.num_live_nodes); let ln = live_node(self.num_live_nodes);
self.lnks += [lnk]/~; vec::push(self.lnks, lnk);
self.num_live_nodes += 1u; self.num_live_nodes += 1u;
#debug["%s is of kind %?", ln.to_str(), lnk]; #debug["%s is of kind %?", ln.to_str(), lnk];
@ -259,7 +259,7 @@ class ir_maps {
fn add_variable(vk: var_kind) -> variable { fn add_variable(vk: var_kind) -> variable {
let v = variable(self.num_vars); let v = variable(self.num_vars);
self.var_kinds += [vk]/~; vec::push(self.var_kinds, vk);
self.num_vars += 1u; self.num_vars += 1u;
alt vk { alt vk {
@ -444,7 +444,7 @@ fn visit_expr(expr: @expr, &&self: @ir_maps, vt: vt<@ir_maps>) {
cap_move | cap_drop {true} // var must be dead afterwards cap_move | cap_drop {true} // var must be dead afterwards
cap_copy | cap_ref {false} // var can still be used cap_copy | cap_ref {false} // var can still be used
}; };
call_caps += [{ln: cv_ln, is_move: is_move, rv: rv}]/~; vec::push(call_caps, {ln: cv_ln, is_move: is_move, rv: rv});
} }
none {} none {}
} }

View file

@ -51,6 +51,6 @@ fn pat_bindings(dm: resolve::def_map, pat: @pat,
fn pat_binding_ids(dm: resolve::def_map, pat: @pat) -> [node_id]/~ { fn pat_binding_ids(dm: resolve::def_map, pat: @pat) -> [node_id]/~ {
let mut found = []/~; let mut found = []/~;
pat_bindings(dm, pat) {|b_id, _sp, _pt| found += [b_id]/~; }; pat_bindings(dm, pat) {|b_id, _sp, _pt| vec::push(found, b_id); };
ret found; ret found;
} }

View file

@ -221,7 +221,7 @@ fn nearest_common_ancestor(region_map: region_map, scope_a: ast::node_id,
alt region_map.find(scope) { alt region_map.find(scope) {
none { ret result; } none { ret result; }
some(superscope) { some(superscope) {
result += [superscope]/~; vec::push(result, superscope);
scope = superscope; scope = superscope;
} }
} }

View file

@ -243,7 +243,8 @@ fn map_crate(e: @env, c: @ast::crate) {
ast::view_path_list(mod_path, idents, _) { ast::view_path_list(mod_path, idents, _) {
for idents.each {|ident| for idents.each {|ident|
let t = todo(ident.node.name, let t = todo(ident.node.name,
@(mod_path.idents + [ident.node.name]/~), @(vec::append_one(mod_path.idents,
ident.node.name)),
ident.span, sc); ident.span, sc);
e.imports.insert(ident.node.id, t); e.imports.insert(ident.node.id, t);
} }
@ -305,7 +306,7 @@ fn map_crate(e: @env, c: @ast::crate) {
} }
scope_block(b, _, _) { scope_block(b, _, _) {
let globs = alt e.block_map.find(b.node.id) { let globs = alt e.block_map.find(b.node.id) {
some(globs) { globs + [glob]/~ } some(globs) { vec::append_one(globs, glob) }
none { [glob]/~ } none { [glob]/~ }
}; };
e.block_map.insert(b.node.id, globs); e.block_map.insert(b.node.id, globs);
@ -557,7 +558,8 @@ fn visit_item_with_scope(e: @env, i: @ast::item,
v.visit_ty(sty, sc, v); v.visit_ty(sty, sc, v);
for methods.each {|m| for methods.each {|m|
v.visit_ty_params(m.tps, sc, v); v.visit_ty_params(m.tps, sc, v);
let msc = @cons(scope_method(m.self_id, tps + m.tps), sc); let msc = @cons(scope_method(m.self_id, vec::append(tps, m.tps)),
sc);
v.visit_fn(visit::fk_method(m.ident, []/~, m), v.visit_fn(visit::fk_method(m.ident, []/~, m),
m.decl, m.body, m.span, m.id, msc, v); m.decl, m.body, m.span, m.id, msc, v);
} }
@ -567,7 +569,7 @@ fn visit_item_with_scope(e: @env, i: @ast::item,
let isc = @cons(scope_method(i.id, tps), sc); let isc = @cons(scope_method(i.id, tps), sc);
for methods.each {|m| for methods.each {|m|
v.visit_ty_params(m.tps, isc, v); v.visit_ty_params(m.tps, isc, v);
let msc = @cons(scope_method(i.id, tps + m.tps), sc); let msc = @cons(scope_method(i.id, vec::append(tps, m.tps)), sc);
for m.decl.inputs.each {|a| v.visit_ty(a.ty, msc, v); } for m.decl.inputs.each {|a| v.visit_ty(a.ty, msc, v); }
v.visit_ty(m.decl.output, msc, v); v.visit_ty(m.decl.output, msc, v);
} }
@ -600,7 +602,8 @@ fn visit_item_with_scope(e: @env, i: @ast::item,
for members.each {|cm| for members.each {|cm|
alt cm.node { alt cm.node {
class_method(m) { class_method(m) {
let msc = @cons(scope_method(m.self_id, tps + m.tps), let msc = @cons(scope_method(m.self_id,
vec::append(tps, m.tps)),
class_scope); class_scope);
visit_fn_with_scope(e, visit_fn_with_scope(e,
visit::fk_item_fn(m.ident, tps), m.decl, m.body, visit::fk_item_fn(m.ident, tps), m.decl, m.body,
@ -911,7 +914,8 @@ fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) {
path = @(e.mod_map.get(did.node).path + *path); path = @(e.mod_map.get(did.node).path + *path);
} else if did.node != ast::crate_node_id { } else if did.node != ast::crate_node_id {
let paths = e.ext_map.get(did); let paths = e.ext_map.get(did);
path = @str::connect((paths + [path]/~).map({|x|*x}), "::"); path = @str::connect(vec::append_one(paths, path).map({|x|*x}),
"::");
} }
} }
} }
@ -1372,7 +1376,7 @@ fn lookup_in_mod(e: env, m: def, sp: span, name: ident, ns: namespace,
if !is_none(cached) { ret cached; } if !is_none(cached) { ret cached; }
let mut path = [name]/~; let mut path = [name]/~;
if defid.node != ast::crate_node_id { if defid.node != ast::crate_node_id {
path = cstore::get_path(e.cstore, defid) + path; path = vec::append(cstore::get_path(e.cstore, defid), path);
} }
alt lookup_external(e, defid.crate, path, ns) { alt lookup_external(e, defid.crate, path, ns) {
some(df) { some(df) {
@ -1990,7 +1994,8 @@ fn check_exports(e: @env) {
some(f) { f } none { []/~ } some(f) { f } none { []/~ }
}; };
e.exp_map.insert(export_id, e.exp_map.insert(export_id,
found + [{reexp: reexp, id: target_id}]/~); vec::append_one(found,
{reexp: reexp, id: target_id}));
} }
fn check_export(e: @env, ident: ident, _mod: @indexed_mod, fn check_export(e: @env, ident: ident, _mod: @indexed_mod,
@ -2186,7 +2191,9 @@ fn find_impls_in_view_item(e: env, vi: @ast::view_item,
@{ident: name with *imp}); @{ident: name with *imp});
} }
} }
if vec::len(found) > 0u { impls += found; } if vec::len(found) > 0u {
vec::push_all(impls, found);
}
} }
} }
} }
@ -2201,7 +2208,9 @@ fn find_impls_in_view_item(e: env, vi: @ast::view_item,
ast::view_path_list(base, names, _) { ast::view_path_list(base, names, _) {
for names.each {|nm| for names.each {|nm|
lookup_imported_impls(e, nm.node.id) {|is| impls += *is; } lookup_imported_impls(e, nm.node.id) {|is|
vec::push_all(impls, *is);
}
} }
} }

View file

@ -101,7 +101,7 @@ fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) {
} else { } else {
[]/~ []/~
}; };
cache.insert(mdtag, existing + [val]/~); cache.insert(mdtag, vec::append_one(existing, val));
} }
type metadata<T> = {node: ValueRef, data: T}; type metadata<T> = {node: ValueRef, data: T};

View file

@ -382,11 +382,11 @@ fn x86_64_tys(atys: [TypeRef]/~,
StructRetAttribute); StructRetAttribute);
let sret = option::is_some(ret_attr); let sret = option::is_some(ret_attr);
if sret { if sret {
arg_tys = [ret_ty]/~ + arg_tys; arg_tys = vec::append([ret_ty]/~, arg_tys);
ret_ty = { cast: false, ret_ty = { cast: false,
ty: T_void() ty: T_void()
}; };
attrs = [ret_attr]/~ + attrs; attrs = vec::append([ret_attr]/~, attrs);
} else if !ret_def { } else if !ret_def {
ret_ty = { cast: false, ret_ty = { cast: false,
ty: T_void() ty: T_void()
@ -450,7 +450,7 @@ fn c_arg_and_ret_lltys(ccx: @crate_ctxt,
fn c_stack_tys(ccx: @crate_ctxt, fn c_stack_tys(ccx: @crate_ctxt,
id: ast::node_id) -> @c_stack_tys { id: ast::node_id) -> @c_stack_tys {
let (llargtys, llretty, ret_ty) = c_arg_and_ret_lltys(ccx, id); let (llargtys, llretty, ret_ty) = c_arg_and_ret_lltys(ccx, id);
let bundle_ty = T_struct(llargtys + [T_ptr(llretty)]/~); let bundle_ty = T_struct(vec::append_one(llargtys, T_ptr(llretty)));
let ret_def = !ty::type_is_bot(ret_ty) && !ty::type_is_nil(ret_ty); let ret_def = !ty::type_is_bot(ret_ty) && !ty::type_is_nil(ret_ty);
let x86_64 = if ccx.sess.targ_cfg.arch == arch_x86_64 { let x86_64 = if ccx.sess.targ_cfg.arch == arch_x86_64 {
option::some(x86_64_tys(llargtys, llretty, ret_def)) option::some(x86_64_tys(llargtys, llretty, ret_def))
@ -933,7 +933,7 @@ fn trans_extern_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
let _icx = ccx.insn_ctxt("foreign::extern::build_rust_fn"); let _icx = ccx.insn_ctxt("foreign::extern::build_rust_fn");
let t = ty::node_id_to_type(ccx.tcx, id); let t = ty::node_id_to_type(ccx.tcx, id);
let ps = link::mangle_internal_name_by_path( let ps = link::mangle_internal_name_by_path(
ccx, path + [ast_map::path_name(@"__rust_abi")]/~); ccx, vec::append_one(path, ast_map::path_name(@"__rust_abi")));
let llty = type_of_fn_from_ty(ccx, t); let llty = type_of_fn_from_ty(ccx, t);
let llfndecl = decl_internal_cdecl_fn(ccx.llmod, ps, llty); let llfndecl = decl_internal_cdecl_fn(ccx.llmod, ps, llty);
trans_fn(ccx, path, decl, body, llfndecl, no_self, none, id); trans_fn(ccx, path, decl, body, llfndecl, no_self, none, id);
@ -970,7 +970,8 @@ fn trans_extern_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
} }
let shim_name = link::mangle_internal_name_by_path( let shim_name = link::mangle_internal_name_by_path(
ccx, path + [ast_map::path_name(@"__rust_stack_shim")]/~); ccx, vec::append_one(path,
ast_map::path_name(@"__rust_stack_shim")));
ret build_shim_fn_(ccx, shim_name, llrustfn, tys, ret build_shim_fn_(ccx, shim_name, llrustfn, tys,
lib::llvm::CCallConv, lib::llvm::CCallConv,
build_args, build_ret); build_args, build_ret);

View file

@ -77,7 +77,8 @@ impl methods for reflector {
fn bracketed_mt(bracket_name: str, mt: ty::mt, extra: [ValueRef]/~) { fn bracketed_mt(bracket_name: str, mt: ty::mt, extra: [ValueRef]/~) {
self.bracketed_t(bracket_name, mt.ty, self.bracketed_t(bracket_name, mt.ty,
[self.c_uint(mt.mutbl as uint)]/~ + extra); vec::append([self.c_uint(mt.mutbl as uint)]/~,
extra));
} }
fn vstore_name_and_extra(t: ty::t, fn vstore_name_and_extra(t: ty::t,
@ -85,7 +86,8 @@ impl methods for reflector {
f: fn(str,[ValueRef]/~)) { f: fn(str,[ValueRef]/~)) {
alt vstore { alt vstore {
ty::vstore_fixed(n) { ty::vstore_fixed(n) {
let extra = [self.c_uint(n)]/~ + self.c_size_and_align(t); let extra = vec::append([self.c_uint(n)]/~,
self.c_size_and_align(t));
f("fixed", extra) f("fixed", extra)
} }
ty::vstore_slice(_) { f("slice", []/~) } ty::vstore_slice(_) { f("slice", []/~) }
@ -142,8 +144,8 @@ impl methods for reflector {
ty::ty_rptr(_, mt) { self.bracketed_mt("rptr", mt, []/~) } ty::ty_rptr(_, mt) { self.bracketed_mt("rptr", mt, []/~) }
ty::ty_rec(fields) { ty::ty_rec(fields) {
let extra = ([self.c_uint(vec::len(fields))]/~ let extra = (vec::append([self.c_uint(vec::len(fields))]/~,
+ self.c_size_and_align(t)); self.c_size_and_align(t)));
self.visit("enter_rec", extra); self.visit("enter_rec", extra);
for fields.eachi {|i, field| for fields.eachi {|i, field|
self.bracketed_mt("rec_field", field.mt, self.bracketed_mt("rec_field", field.mt,
@ -154,8 +156,8 @@ impl methods for reflector {
} }
ty::ty_tup(tys) { ty::ty_tup(tys) {
let extra = ([self.c_uint(vec::len(tys))]/~ let extra = (vec::append([self.c_uint(vec::len(tys))]/~,
+ self.c_size_and_align(t)); self.c_size_and_align(t)));
self.visit("enter_tup", extra); self.visit("enter_tup", extra);
for tys.eachi {|i, t| for tys.eachi {|i, t|
self.bracketed_t("tup_field", t, [self.c_uint(i)]/~); self.bracketed_t("tup_field", t, [self.c_uint(i)]/~);
@ -214,8 +216,8 @@ impl methods for reflector {
let bcx = self.bcx; let bcx = self.bcx;
let tcx = bcx.ccx().tcx; let tcx = bcx.ccx().tcx;
let fields = ty::class_items_as_fields(tcx, did, substs); let fields = ty::class_items_as_fields(tcx, did, substs);
let extra = ([self.c_uint(vec::len(fields))]/~ let extra = vec::append([self.c_uint(vec::len(fields))]/~,
+ self.c_size_and_align(t)); self.c_size_and_align(t));
self.visit("enter_class", extra); self.visit("enter_class", extra);
for fields.eachi {|i, field| for fields.eachi {|i, field|
@ -234,8 +236,8 @@ impl methods for reflector {
let bcx = self.bcx; let bcx = self.bcx;
let tcx = bcx.ccx().tcx; let tcx = bcx.ccx().tcx;
let variants = ty::substd_enum_variants(tcx, did, substs); let variants = ty::substd_enum_variants(tcx, did, substs);
let extra = ([self.c_uint(vec::len(variants))]/~ let extra = vec::append([self.c_uint(vec::len(variants))]/~,
+ self.c_size_and_align(t)); self.c_size_and_align(t));
self.visit("enter_enum", extra); self.visit("enter_enum", extra);
for variants.eachi {|i, v| for variants.eachi {|i, v|

View file

@ -24,7 +24,7 @@ fn collect_ids_stmt(s: @stmt, rs: @mut [node_id]/~) {
} }
fn collect_ids_local(tcx: ty::ctxt, l: @local, rs: @mut [node_id]/~) { fn collect_ids_local(tcx: ty::ctxt, l: @local, rs: @mut [node_id]/~) {
*rs += pat_binding_ids(tcx.def_map, l.node.pat); vec::push_all(*rs, pat_binding_ids(tcx.def_map, l.node.pat));
} }
fn node_ids_in_fn(tcx: ty::ctxt, body: blk, rs: @mut [node_id]/~) { fn node_ids_in_fn(tcx: ty::ctxt, body: blk, rs: @mut [node_id]/~) {

View file

@ -474,11 +474,11 @@ fn node_id_to_def(ccx: crate_ctxt, id: node_id) -> option<def> {
fn norm_a_constraint(id: def_id, c: constraint) -> [norm_constraint]/~ { fn norm_a_constraint(id: def_id, c: constraint) -> [norm_constraint]/~ {
let mut rslt: [norm_constraint]/~ = []/~; let mut rslt: [norm_constraint]/~ = []/~;
for (*c.descs).each {|pd| for (*c.descs).each {|pd|
rslt += vec::push(rslt,
[{bit_num: pd.node.bit_num, {bit_num: pd.node.bit_num,
c: respan(pd.span, {path: c.path, c: respan(pd.span, {path: c.path,
def_id: id, def_id: id,
args: pd.node.args})}]/~; args: pd.node.args})});
} }
ret rslt; ret rslt;
} }
@ -489,7 +489,7 @@ fn norm_a_constraint(id: def_id, c: constraint) -> [norm_constraint]/~ {
fn constraints(fcx: fn_ctxt) -> [norm_constraint]/~ { fn constraints(fcx: fn_ctxt) -> [norm_constraint]/~ {
let mut rslt: [norm_constraint]/~ = []/~; let mut rslt: [norm_constraint]/~ = []/~;
for fcx.enclosing.constrs.each {|key, val| for fcx.enclosing.constrs.each {|key, val|
rslt += norm_a_constraint(key, val); vec::push_all(rslt, norm_a_constraint(key, val));
}; };
ret rslt; ret rslt;
} }
@ -887,8 +887,9 @@ fn args_to_constr_args(tcx: ty::ctxt, args: [arg]/~,
let mut actuals: [@constr_arg_use]/~ = []/~; let mut actuals: [@constr_arg_use]/~ = []/~;
let num_args = vec::len(args); let num_args = vec::len(args);
for indices.each {|a| for indices.each {|a|
actuals += vec::push(
[@respan(a.span, actuals,
@respan(a.span,
alt a.node { alt a.node {
carg_base { carg_base } carg_base { carg_base }
carg_ident(i) { carg_ident(i) {
@ -902,7 +903,7 @@ fn args_to_constr_args(tcx: ty::ctxt, args: [arg]/~,
} }
} }
carg_lit(l) { carg_lit(l) } carg_lit(l) { carg_lit(l) }
})]/~; }));
} }
ret actuals; ret actuals;
} }

View file

@ -253,12 +253,12 @@ fn to_vec(v: t) -> [uint]/~ {
let mut i: uint = 0u; let mut i: uint = 0u;
let mut rslt: [uint]/~ = []/~; let mut rslt: [uint]/~ = []/~;
while i < v.nbits { while i < v.nbits {
rslt += vec::push(rslt,
[alt tritv_get(v, i) { alt tritv_get(v, i) {
dont_care { 2u } dont_care { 2u }
ttrue { 1u } ttrue { 1u }
tfalse { 0u } tfalse { 0u }
}]/~; });
i += 1u; i += 1u;
} }
ret rslt; ret rslt;

View file

@ -2188,7 +2188,7 @@ fn is_fn_ty(fty: t) -> bool {
// Returns a vec of all the input and output types of fty. // Returns a vec of all the input and output types of fty.
fn tys_in_fn_ty(fty: fn_ty) -> [t]/~ { fn tys_in_fn_ty(fty: fn_ty) -> [t]/~ {
fty.inputs.map({|a| a.ty}) + [fty.output]/~ vec::append_one(fty.inputs.map({|a| a.ty}), fty.output)
} }
// Just checks whether it's a fn that returns bool, // Just checks whether it's a fn that returns bool,
@ -2624,26 +2624,27 @@ fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
ast_map::path_name(item.ident) ast_map::path_name(item.ident)
} }
}; };
*path + [item_elt]/~ vec::append_one(*path, item_elt)
} }
ast_map::node_foreign_item(nitem, _, path) { ast_map::node_foreign_item(nitem, _, path) {
*path + [ast_map::path_name(nitem.ident)]/~ vec::append_one(*path, ast_map::path_name(nitem.ident))
} }
ast_map::node_method(method, _, path) { ast_map::node_method(method, _, path) {
*path + [ast_map::path_name(method.ident)]/~ vec::append_one(*path, ast_map::path_name(method.ident))
} }
ast_map::node_variant(variant, _, path) { ast_map::node_variant(variant, _, path) {
vec::init(*path) + [ast_map::path_name(variant.node.name)]/~ vec::append_one(vec::init(*path),
ast_map::path_name(variant.node.name))
} }
ast_map::node_ctor(nm, _, _, _, path) { ast_map::node_ctor(nm, _, _, _, path) {
*path + [ast_map::path_name(nm)]/~ vec::append_one(*path, ast_map::path_name(nm))
} }
ast_map::node_dtor(_, _, _, path) { ast_map::node_dtor(_, _, _, path) {
*path + [ast_map::path_name(@"dtor")]/~ vec::append_one(*path, ast_map::path_name(@"dtor"))
} }

View file

@ -403,7 +403,7 @@ class lookup {
} }
}; };
let all_substs = {tps: cand.self_substs.tps + m_substs let all_substs = {tps: vec::append(cand.self_substs.tps, m_substs)
with cand.self_substs}; with cand.self_substs};
self.fcx.write_ty_substs(self.node_id, cand.fty, all_substs); self.fcx.write_ty_substs(self.node_id, cand.fty, all_substs);

View file

@ -204,7 +204,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span,
let substs = { let substs = {
self_r: some(dummy_self_r), self_r: some(dummy_self_r),
self_ty: some(self_ty), self_ty: some(self_ty),
tps: if_substs.tps + dummy_tps tps: vec::append(if_substs.tps, dummy_tps)
}; };
let if_fty = ty::mk_fn(tcx, if_m.fty); let if_fty = ty::mk_fn(tcx, if_m.fty);
ty::subst(tcx, substs, if_fty) ty::subst(tcx, substs, if_fty)
@ -286,7 +286,7 @@ fn convert_methods(ccx: @crate_ctxt,
// n.b.: the type of a method is parameterized by both // n.b.: the type of a method is parameterized by both
// the tps on the receiver and those on the method itself // the tps on the receiver and those on the method itself
{bounds: @(*rcvr_bounds + *bounds), rp: rp, ty: fty}); {bounds: @(vec::append(*rcvr_bounds, *bounds)), rp: rp, ty: fty});
write_ty_to_tcx(tcx, m.id, fty); write_ty_to_tcx(tcx, m.id, fty);
{mty: mty, id: m.id, span: m.span} {mty: mty, id: m.id, span: m.span}
} }

View file

@ -133,7 +133,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
alt ident { some(i) { s += " "; s += *i; } _ { } } alt ident { some(i) { s += " "; s += *i; } _ { } }
s += "("; s += "(";
let mut strs = []/~; let mut strs = []/~;
for inputs.each {|a| strs += [fn_input_to_str(cx, a)]/~; } for inputs.each {|a| vec::push(strs, fn_input_to_str(cx, a)); }
s += str::connect(strs, ", "); s += str::connect(strs, ", ");
s += ")"; s += ")";
if ty::get(output).struct != ty_nil { if ty::get(output).struct != ty_nil {
@ -190,12 +190,12 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
ty_type { "type" } ty_type { "type" }
ty_rec(elems) { ty_rec(elems) {
let mut strs: [str]/~ = []/~; let mut strs: [str]/~ = []/~;
for elems.each {|fld| strs += [field_to_str(cx, fld)]/~; } for elems.each {|fld| vec::push(strs, field_to_str(cx, fld)); }
"{" + str::connect(strs, ",") + "}" "{" + str::connect(strs, ",") + "}"
} }
ty_tup(elems) { ty_tup(elems) {
let mut strs = []/~; let mut strs = []/~;
for elems.each {|elem| strs += [ty_to_str(cx, elem)]/~; } for elems.each {|elem| vec::push(strs, ty_to_str(cx, elem)); }
"(" + str::connect(strs, ",") + ")" "(" + str::connect(strs, ",") + ")"
} }
ty_fn(f) { ty_fn(f) {