diff options
| -rw-r--r-- | src/comp/metadata/decoder.rs | 8 | ||||
| -rw-r--r-- | src/comp/metadata/tydecode.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/shape.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/trans.rs | 6 | ||||
| -rw-r--r-- | src/comp/middle/trans_closure.rs | 4 | ||||
| -rw-r--r-- | src/comp/middle/trans_common.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/ty.rs | 4 | ||||
| -rw-r--r-- | src/comp/middle/typeck.rs | 55 |
8 files changed, 41 insertions, 42 deletions
diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index 8271c5d9849..49536b6e1c9 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -117,14 +117,14 @@ fn item_type(item: ebml::doc, this_cnum: ast::crate_num, tcx: ty::ctxt, fn item_ty_param_bounds(item: ebml::doc, this_cnum: ast::crate_num, tcx: ty::ctxt, extres: external_resolver) - -> [@[ty::param_bound]] { + -> @[ty::param_bounds] { let bounds = []; let def_parser = bind parse_external_def_id(this_cnum, extres, _); ebml::tagged_docs(item, tag_items_data_item_ty_param_bounds) {|p| bounds += [tydecode::parse_bounds_data(@ebml::doc_data(p), this_cnum, def_parser, tcx)]; } - bounds + @bounds } fn item_ty_param_count(item: ebml::doc) -> uint { @@ -209,8 +209,8 @@ fn get_type(data: @[u8], def: ast::def_id, tcx: ty::ctxt, let t = item_type(item, this_cnum, tcx, extres); let tp_bounds = if family_has_type_params(item_family(item)) { item_ty_param_bounds(item, this_cnum, tcx, extres) - } else { [] }; - ret @{bounds: tp_bounds, ty: t}; + } else { @[] }; + ret {bounds: tp_bounds, ty: t}; } fn get_type_param_count(data: @[u8], id: ast::node_id) -> uint { diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index 0ecf2095e7e..1a083bf8fb6 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -267,7 +267,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t { while peek(st) as char != '[' { name += str::unsafe_from_byte(next(st)); } - methods += [{ident: name, tps: [], + methods += [{ident: name, tps: @[], fty: {proto: proto with parse_ty_fn(st, sd)}}]; } st.pos += 1u; diff --git a/src/comp/middle/shape.rs b/src/comp/middle/shape.rs index 94529b8be60..f78e0ffef85 100644 --- a/src/comp/middle/shape.rs +++ b/src/comp/middle/shape.rs @@ -450,7 +450,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef { let did = ccx.shape_cx.tag_order[i]; let variants = ty::tag_variants(ccx.tcx, did); let item_tyt = ty::lookup_item_type(ccx.tcx, did); - let ty_param_count = vec::len(item_tyt.bounds); + let ty_param_count = vec::len(*item_tyt.bounds); for v: ty::variant_info in *variants { offsets += [vec::len(data) as u16]; diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 9e85d02a648..4c385d56ac3 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -236,7 +236,7 @@ fn type_of_ty_param_bounds_and_ty(lcx: @local_ctxt, sp: span, alt ty::struct(cx.tcx, t) { ty::ty_fn(_) | ty::ty_native_fn(_, _) { check returns_non_ty_var(cx, t); - ret type_of_fn_from_ty(cx, sp, t, tpt.bounds); + ret type_of_fn_from_ty(cx, sp, t, *tpt.bounds); } _ { // fall through @@ -2565,7 +2565,7 @@ type generic_info = {item_type: ty::t, static_tis: [option::t<@tydesc_info>], tydescs: [ValueRef], - param_bounds: [ty::param_bounds]}; + param_bounds: @[ty::param_bounds]}; tag lval_kind { temporary; //< Temporary value passed by value if of immediate type @@ -2739,7 +2739,7 @@ fn trans_var(cx: @block_ctxt, sp: span, def: ast::def, id: ast::node_id) ret lval_no_env(cx, ccx.consts.get(did.node), owned); } else { let tp = ty::node_id_to_monotype(ccx.tcx, id); - let val = trans_external_path(cx, did, @{bounds: [], ty: tp}); + let val = trans_external_path(cx, did, {bounds: @[], ty: tp}); ret lval_no_env(cx, load_if_immediate(cx, val, tp), owned_imm); } } diff --git a/src/comp/middle/trans_closure.rs b/src/comp/middle/trans_closure.rs index 18552e84237..b10f72c3c93 100644 --- a/src/comp/middle/trans_closure.rs +++ b/src/comp/middle/trans_closure.rs @@ -437,7 +437,7 @@ fn trans_bind_1(cx: @block_ctxt, outgoing_fty: ty::t, // Figure out which tydescs we need to pass, if any. let (outgoing_fty_real, lltydescs, param_bounds) = alt f_res.generic { - none. { (outgoing_fty, [], []) } + none. { (outgoing_fty, [], @[]) } some(ginfo) { lazily_emit_all_generic_info_tydesc_glues(cx, ginfo); (ginfo.item_type, ginfo.tydescs, ginfo.param_bounds) @@ -484,7 +484,7 @@ fn trans_bind_1(cx: @block_ctxt, outgoing_fty: ty::t, // Make thunk let llthunk = trans_bind_thunk(cx.fcx.lcx, cx.sp, pair_ty, outgoing_fty_real, args, - box_ty, param_bounds, target_res); + box_ty, *param_bounds, target_res); // Fill the function pair fill_fn_pair(bcx, get_dest_addr(dest), llthunk.val, llbox); diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index c8f56185987..5acc76e9377 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -326,7 +326,7 @@ fn get_res_dtor(ccx: @crate_ctxt, sp: span, did: ast::def_id, inner_t: ty::t) check non_ty_var(ccx, nil_res); let f_t = type_of_fn(ccx, sp, false, [{mode: ast::by_ref, ty: inner_t}], - nil_res, param_bounds); + nil_res, *param_bounds); ret trans::get_extern_const(ccx.externs, ccx.llmod, csearch::get_symbol(ccx.sess.get_cstore(), did), f_t); diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index c6e68c7777e..ac612dda5fb 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -196,7 +196,7 @@ type field = {ident: ast::ident, mt: mt}; type param_bounds = @[param_bound]; -type method = {ident: ast::ident, tps: [param_bounds], fty: fn_ty}; +type method = {ident: ast::ident, tps: @[param_bounds], fty: fn_ty}; type constr_table = hashmap<ast::node_id, [constr]>; @@ -324,7 +324,7 @@ fn param_bounds_to_kind(bounds: param_bounds) -> kind { kind } -type ty_param_bounds_and_ty = @{bounds: [param_bounds], ty: t}; +type ty_param_bounds_and_ty = {bounds: @[param_bounds], ty: t}; type type_cache = hashmap<ast::def_id, ty_param_bounds_and_ty>; diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 3901c808bcf..a679659b3c7 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -80,22 +80,22 @@ fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) -> ast::def_arg(id, _) { assert (fcx.locals.contains_key(id.node)); let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node)); - ret @{bounds: [], ty: typ}; + ret {bounds: @[], ty: typ}; } ast::def_local(id, _) { assert (fcx.locals.contains_key(id.node)); let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node)); - ret @{bounds: [], ty: typ}; + ret {bounds: @[], ty: typ}; } ast::def_obj_field(id, _) { assert (fcx.locals.contains_key(id.node)); let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node)); - ret @{bounds: [], ty: typ}; + ret {bounds: @[], ty: typ}; } ast::def_self(id) { alt get_self_info(fcx.ccx) { some(self_obj(_, obj_t)) | some(self_impl(obj_t)) { - ret @{bounds: [], ty: obj_t}; + ret {bounds: @[], ty: obj_t}; } } } @@ -106,12 +106,12 @@ fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) -> ast::def_binding(id) { assert (fcx.locals.contains_key(id.node)); let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node)); - ret @{bounds: [], ty: typ}; + ret {bounds: @[], ty: typ}; } ast::def_mod(_) { // Hopefully part of a path. // TODO: return a type that's more poisonous, perhaps? - ret @{bounds: [], ty: ty::mk_nil(fcx.ccx.tcx)}; + ret {bounds: @[], ty: ty::mk_nil(fcx.ccx.tcx)}; } ast::def_ty(_) { fcx.ccx.tcx.sess.span_fatal(sp, "expected value but found type"); @@ -132,7 +132,7 @@ fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) -> fn instantiate_path(fcx: @fn_ctxt, pth: @ast::path, tpt: ty_param_bounds_and_ty, sp: span) -> ty_param_substs_opt_and_ty { - let ty_param_count = vec::len(tpt.bounds); + let ty_param_count = vec::len(*tpt.bounds); let bind_result = bind_params_in_type(sp, fcx.ccx.tcx, bind next_ty_var_id(fcx), tpt.ty, ty_param_count); @@ -286,13 +286,13 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t { // "foo = int" like OCaml? let ty_param_bounds_and_ty = getter(tcx, mode, id); - if vec::len(ty_param_bounds_and_ty.bounds) == 0u { + if vec::len(*ty_param_bounds_and_ty.bounds) == 0u { ret ty_param_bounds_and_ty.ty; } // The typedef is type-parametric. Do the type substitution. let param_bindings: [ty::t] = []; - if vec::len(args) != vec::len(ty_param_bounds_and_ty.bounds) { + if vec::len(args) != vec::len(*ty_param_bounds_and_ty.bounds) { tcx.sess.span_fatal(sp, "Wrong number of type arguments for a \ polymorphic type"); } @@ -386,7 +386,7 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item) alt it.node { ast::item_const(t, _) { let typ = ast_ty_to_ty(tcx, mode, t); - let tpt = @{bounds: [], ty: typ}; + let tpt = {bounds: @[], ty: typ}; tcx.tcache.insert(local_def(it.id), tpt); ret tpt; } @@ -405,7 +405,7 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item) } // Tell ast_ty_to_ty() that we want to perform a recursive // call to resolve any named types. - let tpt = @{bounds: ty_param_bounds(tcx, mode, tps), + let tpt = {bounds: ty_param_bounds(tcx, mode, tps), ty: ty::mk_named(tcx, ast_ty_to_ty(tcx, mode, t), @it.ident)}; tcx.tcache.insert(local_def(it.id), tpt); @@ -417,7 +417,7 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item) let t = ty::mk_named(tcx, ty::mk_res(tcx, local_def(it.id), t_arg.ty, params), @it.ident); - let t_res = @{bounds: bounds, ty: t}; + let t_res = {bounds: bounds, ty: t}; tcx.tcache.insert(local_def(it.id), t_res); ret t_res; } @@ -426,7 +426,7 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item) let {bounds, params} = mk_ty_params(tcx, tps); let t = ty::mk_named(tcx, ty::mk_tag(tcx, local_def(it.id), params), @it.ident); - let tpt = @{bounds: bounds, ty: t}; + let tpt = {bounds: bounds, ty: t}; tcx.tcache.insert(local_def(it.id), tpt); ret tpt; } @@ -435,7 +435,7 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item) let t = ty::mk_named(tcx, ty::mk_iface(tcx, local_def(it.id), params), @it.ident); - let tpt = @{bounds: bounds, ty: t}; + let tpt = {bounds: bounds, ty: t}; tcx.tcache.insert(local_def(it.id), tpt); ty::store_iface_methods(tcx, it.id, @vec::map(ms, {|m| ty_of_ty_method(tcx, m_collect, m) @@ -459,7 +459,7 @@ fn ty_of_native_item(tcx: ty::ctxt, mode: mode, it: @ast::native_item) none. { } } let t = ty::mk_native(tcx, ast_util::local_def(it.id)); - let tpt = @{bounds: [], ty: t}; + let tpt = {bounds: @[], ty: t}; tcx.tcache.insert(local_def(it.id), tpt); ret tpt; } @@ -487,7 +487,7 @@ fn ty_of_fn(tcx: ty::ctxt, mode: mode, decl: ast::fn_decl, -> ty::ty_param_bounds_and_ty { let bounds = ty_param_bounds(tcx, mode, ty_params); let tofd = ty_of_fn_decl(tcx, mode, ast::proto_bare, decl); - let tpt = @{bounds: bounds, ty: ty::mk_fn(tcx, tofd)}; + let tpt = {bounds: bounds, ty: ty::mk_fn(tcx, tofd)}; tcx.tcache.insert(def_id, tpt); ret tpt; } @@ -499,12 +499,12 @@ fn ty_of_native_fn_decl(tcx: ty::ctxt, mode: mode, decl: ast::fn_decl, let output_ty = ast_ty_to_ty(tcx, mode, decl.output); let t_fn = ty::mk_native_fn(tcx, input_tys, output_ty); - let tpt = @{bounds: bounds, ty: t_fn}; + let tpt = {bounds: bounds, ty: t_fn}; tcx.tcache.insert(def_id, tpt); ret tpt; } fn ty_param_bounds(tcx: ty::ctxt, mode: mode, params: [ast::ty_param]) - -> [ty::param_bounds] { + -> @[ty::param_bounds] { let result = []; for param in params { result += [alt tcx.ty_param_bounds.find(local_def(param.id)) { @@ -526,7 +526,7 @@ fn ty_param_bounds(tcx: ty::ctxt, mode: mode, params: [ast::ty_param]) } }]; } - result + @result } fn ty_of_method(tcx: ty::ctxt, mode: mode, m: @ast::method) -> ty::method { {ident: m.ident, tps: ty_param_bounds(tcx, mode, m.tps), @@ -543,7 +543,7 @@ fn ty_of_obj(tcx: ty::ctxt, mode: mode, id: ast::ident, ob: ast::_obj, let methods = vec::map(ob.methods, {|m| ty_of_method(tcx, mode, m)}); let t_obj = ty::mk_named(tcx, ty::mk_obj(tcx, ty::sort_methods(methods)), @id); - ret @{bounds: bounds, ty: t_obj}; + ret {bounds: bounds, ty: t_obj}; } fn ty_of_obj_ctor(tcx: ty::ctxt, mode: mode, id: ast::ident, ob: ast::_obj, ctor_id: ast::node_id, ty_params: [ast::ty_param]) @@ -557,7 +557,7 @@ fn ty_of_obj_ctor(tcx: ty::ctxt, mode: mode, id: ast::ident, ob: ast::_obj, let t_fn = ty::mk_fn(tcx, {proto: ast::proto_shared(ast::sugar_normal), inputs: t_inputs, output: t_obj.ty, ret_style: ast::return_val, constraints: []}); - let tpt = @{bounds: ty_param_bounds(tcx, mode, ty_params), ty: t_fn}; + let tpt = {bounds: ty_param_bounds(tcx, mode, ty_params), ty: t_fn}; tcx.tcache.insert(local_def(ctor_id), tpt); ret tpt; } @@ -626,7 +626,7 @@ mod write { } fn mk_ty_params(tcx: ty::ctxt, atps: [ast::ty_param]) - -> {bounds: [ty::param_bounds], params: [ty::t]} { + -> {bounds: @[ty::param_bounds], params: [ty::t]} { let i = 0u, bounds = ty_param_bounds(tcx, m_collect, atps); {bounds: bounds, params: vec::map(atps, {|atp| @@ -678,7 +678,7 @@ mod collect { inputs: args, output: tag_ty, ret_style: ast::return_val, constraints: []}) }; - let tpt = @{bounds: ty_param_bounds(cx.tcx, m_collect, ty_params), + let tpt = {bounds: ty_param_bounds(cx.tcx, m_collect, ty_params), ty: result_ty}; cx.tcx.tcache.insert(local_def(variant.node.id), tpt); write::ty_only(cx.tcx, variant.node.id, result_ty); @@ -700,7 +700,7 @@ mod collect { let ty = ty::mk_fn(cx.tcx, ty_of_fn_decl(cx.tcx, m_collect, ast::proto_bare, m.decl)); - cx.tcx.tcache.insert(local_def(m.id), @{bounds: bounds, + cx.tcx.tcache.insert(local_def(m.id), {bounds: bounds, ty: ty}); write::ty_only(cx.tcx, m.id, ty); } @@ -758,8 +758,7 @@ mod collect { write::ty_only(cx.tcx, it.id, t_res); write::ty_only(cx.tcx, ctor_id, t_ctor); cx.tcx.tcache.insert(local_def(ctor_id), - @{bounds: bounds, - ty: t_ctor}); + {bounds: bounds, ty: t_ctor}); write::ty_only(cx.tcx, dtor_id, t_dtor); } _ { @@ -1481,7 +1480,7 @@ fn impl_self_ty(tcx: ty::ctxt, did: ast::def_id) -> {n_tps: uint, ty: ty::t} { } } else { let tpt = csearch::get_type(tcx, did); - {n_tps: vec::len(tpt.bounds), ty: tpt.ty} + {n_tps: vec::len(*tpt.bounds), ty: tpt.ty} } } @@ -1505,7 +1504,7 @@ fn lookup_method(fcx: @fn_ctxt, isc: resolve::iscopes, {|m| m.ident == name}) { some(m) { ret some({method_ty: ty::mk_fn(tcx, m.fty), - n_tps: vec::len(m.tps), + n_tps: vec::len(*m.tps), ids: [], // FIXME[impl] origin: method_param(n)}); } |
