rustc: Lift the @ from the type definition of crate_ctxt into its uses
This will make it easier to convert crate_ctxt into a region pointer, since there are functions that return crate contexts. There would be no way to type these functions if crate_ctxt had to be an inferred region pointer.
This commit is contained in:
parent
1e0e089185
commit
273c5e5f11
12 changed files with 146 additions and 145 deletions
|
|
@ -493,7 +493,7 @@ fn symbol_hash(tcx: ty::ctxt, sha: sha1, t: ty::t, link_meta: link_meta) ->
|
|||
ret "_" + hash;
|
||||
}
|
||||
|
||||
fn get_symbol_hash(ccx: crate_ctxt, t: ty::t) -> str {
|
||||
fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> str {
|
||||
let hash = "";
|
||||
alt ccx.type_sha1s.find(t) {
|
||||
some(h) { hash = h; }
|
||||
|
|
@ -525,28 +525,28 @@ fn exported_name(path: path, hash: str, _vers: str) -> str {
|
|||
|
||||
}
|
||||
|
||||
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 {
|
||||
let hash = get_symbol_hash(ccx, t);
|
||||
ret exported_name(path, hash, ccx.link_meta.vers);
|
||||
}
|
||||
|
||||
fn mangle_internal_name_by_type_only(ccx: crate_ctxt, t: ty::t, name: str) ->
|
||||
fn mangle_internal_name_by_type_only(ccx: @crate_ctxt, t: ty::t, name: str) ->
|
||||
str {
|
||||
let s = util::ppaux::ty_to_short_str(ccx.tcx, t);
|
||||
let hash = get_symbol_hash(ccx, t);
|
||||
ret mangle([path_name(name), path_name(s), path_name(hash)]);
|
||||
}
|
||||
|
||||
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 {
|
||||
ret mangle(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 {
|
||||
ret mangle(path);
|
||||
}
|
||||
|
||||
fn mangle_internal_name_by_seq(ccx: crate_ctxt, flav: str) -> str {
|
||||
fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: str) -> str {
|
||||
ret ccx.names(flav);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export encode_def_id;
|
|||
|
||||
type abbrev_map = map::hashmap<ty::t, tyencode::ty_abbrev>;
|
||||
|
||||
type encode_ctxt = {ccx: crate_ctxt,
|
||||
type encode_ctxt = {ccx: @crate_ctxt,
|
||||
type_abbrevs: abbrev_map,
|
||||
reachable: reachable::map};
|
||||
|
||||
|
|
@ -737,7 +737,7 @@ fn encode_hash(ebml_w: ebml::writer, hash: str) {
|
|||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_metadata(cx: crate_ctxt, crate: @crate) -> [u8] {
|
||||
fn encode_metadata(cx: @crate_ctxt, crate: @crate) -> [u8] {
|
||||
|
||||
let reachable = reachable::find_reachable(cx, crate.node.module);
|
||||
let abbrevs = ty::new_ty_hash();
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ export map, find_reachable;
|
|||
|
||||
type map = std::map::hashmap<node_id, ()>;
|
||||
|
||||
type ctx = {ccx: middle::trans::common::crate_ctxt,
|
||||
type ctx = {ccx: @middle::trans::common::crate_ctxt,
|
||||
rmap: map};
|
||||
|
||||
fn find_reachable(ccx: middle::trans::common::crate_ctxt, crate_mod: _mod)
|
||||
fn find_reachable(ccx: @middle::trans::common::crate_ctxt, crate_mod: _mod)
|
||||
-> map {
|
||||
let rmap = std::map::new_int_hash();
|
||||
traverse_public_mod({ccx: ccx, rmap: rmap}, crate_mod);
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ fn enter_uniq(dm: def_map, m: match, col: uint, val: ValueRef) -> match {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_options(ccx: crate_ctxt, m: match, col: uint) -> [opt] {
|
||||
fn get_options(ccx: @crate_ctxt, m: match, col: uint) -> [opt] {
|
||||
fn add_to_set(tcx: ty::ctxt, &set: [opt], val: opt) {
|
||||
for l in set { if opt_eq(tcx, l, val) { ret; } }
|
||||
set += [val];
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ enum dest {
|
|||
ignore,
|
||||
}
|
||||
|
||||
fn dest_str(ccx: crate_ctxt, d: dest) -> str {
|
||||
fn dest_str(ccx: @crate_ctxt, d: dest) -> str {
|
||||
alt d {
|
||||
by_val(v) { #fmt["by_val(%s)", val_str(ccx.tn, *v)] }
|
||||
save_in(v) { #fmt["save_in(%s)", val_str(ccx.tn, v)] }
|
||||
|
|
@ -156,7 +156,7 @@ fn sanitize(s: str) -> str {
|
|||
}
|
||||
|
||||
|
||||
fn log_fn_time(ccx: crate_ctxt, name: str, start: time::timeval,
|
||||
fn log_fn_time(ccx: @crate_ctxt, name: str, start: time::timeval,
|
||||
end: time::timeval) {
|
||||
let elapsed = 1000 * ((end.sec - start.sec) as int) +
|
||||
((end.usec as int) - (start.usec as int)) / 1000;
|
||||
|
|
@ -276,7 +276,7 @@ fn dynastack_alloca(cx: block, t: TypeRef, n: ValueRef, ty: ty::t) ->
|
|||
ret PointerCast(dy_cx, llresult, T_ptr(t));
|
||||
}
|
||||
|
||||
fn mk_obstack_token(ccx: crate_ctxt, fcx: fn_ctxt) ->
|
||||
fn mk_obstack_token(ccx: @crate_ctxt, fcx: fn_ctxt) ->
|
||||
ValueRef {
|
||||
let cx = raw_block(fcx, fcx.lldynamicallocas);
|
||||
ret Call(cx, ccx.upcalls.dynastack_mark, []);
|
||||
|
|
@ -620,7 +620,7 @@ fn get_tydesc(cx: block, t: ty::t, escapes: bool,
|
|||
ret rslt(cx, info.tydesc);
|
||||
}
|
||||
|
||||
fn get_static_tydesc(ccx: crate_ctxt, t: ty::t, ty_params: [uint])
|
||||
fn get_static_tydesc(ccx: @crate_ctxt, t: ty::t, ty_params: [uint])
|
||||
-> @tydesc_info {
|
||||
alt ccx.tydescs.find(t) {
|
||||
some(info) { ret info; }
|
||||
|
|
@ -677,7 +677,7 @@ fn set_glue_inlining(f: ValueRef, t: ty::t) {
|
|||
|
||||
|
||||
// Generates the declaration for (but doesn't emit) a type descriptor.
|
||||
fn declare_tydesc(ccx: crate_ctxt, t: ty::t, ty_params: [uint])
|
||||
fn declare_tydesc(ccx: @crate_ctxt, t: ty::t, ty_params: [uint])
|
||||
-> @tydesc_info {
|
||||
log(debug, "+++ declare_tydesc " + ty_to_str(ccx.tcx, t));
|
||||
let llsize;
|
||||
|
|
@ -716,7 +716,7 @@ fn declare_tydesc(ccx: crate_ctxt, t: ty::t, ty_params: [uint])
|
|||
|
||||
type glue_helper = fn@(block, ValueRef, ty::t);
|
||||
|
||||
fn declare_generic_glue(ccx: crate_ctxt, t: ty::t, llfnty: TypeRef,
|
||||
fn declare_generic_glue(ccx: @crate_ctxt, t: ty::t, llfnty: TypeRef,
|
||||
name: str) -> ValueRef {
|
||||
let name = name;
|
||||
let fn_nm;
|
||||
|
|
@ -729,7 +729,7 @@ fn declare_generic_glue(ccx: crate_ctxt, t: ty::t, llfnty: TypeRef,
|
|||
ret llfn;
|
||||
}
|
||||
|
||||
fn make_generic_glue_inner(ccx: crate_ctxt, t: ty::t,
|
||||
fn make_generic_glue_inner(ccx: @crate_ctxt, t: ty::t,
|
||||
llfn: ValueRef, helper: glue_helper,
|
||||
ty_params: [uint]) -> ValueRef {
|
||||
let fcx = new_fn_ctxt(ccx, [], llfn, none);
|
||||
|
|
@ -769,7 +769,7 @@ fn make_generic_glue_inner(ccx: crate_ctxt, t: ty::t,
|
|||
ret llfn;
|
||||
}
|
||||
|
||||
fn make_generic_glue(ccx: crate_ctxt, t: ty::t, llfn: ValueRef,
|
||||
fn make_generic_glue(ccx: @crate_ctxt, t: ty::t, llfn: ValueRef,
|
||||
helper: glue_helper, ty_params: [uint], name: str)
|
||||
-> ValueRef {
|
||||
if !ccx.sess.opts.stats {
|
||||
|
|
@ -784,7 +784,7 @@ fn make_generic_glue(ccx: crate_ctxt, t: ty::t, llfn: ValueRef,
|
|||
ret llval;
|
||||
}
|
||||
|
||||
fn emit_tydescs(ccx: crate_ctxt) {
|
||||
fn emit_tydescs(ccx: @crate_ctxt) {
|
||||
ccx.tydescs.items {|key, val|
|
||||
let glue_fn_ty = T_ptr(T_glue_fn(ccx));
|
||||
let ti = val;
|
||||
|
|
@ -1026,7 +1026,7 @@ fn decr_refcnt_maybe_free(bcx: block, box_ptr: ValueRef, t: ty::t) -> block {
|
|||
}
|
||||
|
||||
// Structural comparison: a rather involved form of glue.
|
||||
fn maybe_name_value(cx: crate_ctxt, v: ValueRef, s: str) {
|
||||
fn maybe_name_value(cx: @crate_ctxt, v: ValueRef, s: str) {
|
||||
if cx.sess.opts.save_temps {
|
||||
let _: () = str::as_buf(s, {|buf| llvm::LLVMSetValueName(v, buf) });
|
||||
}
|
||||
|
|
@ -1237,21 +1237,21 @@ fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
|
|||
ret cx;
|
||||
}
|
||||
|
||||
fn lazily_emit_all_tydesc_glue(ccx: crate_ctxt,
|
||||
fn lazily_emit_all_tydesc_glue(ccx: @crate_ctxt,
|
||||
static_ti: option<@tydesc_info>) {
|
||||
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_take_glue, static_ti);
|
||||
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_drop_glue, static_ti);
|
||||
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_free_glue, static_ti);
|
||||
}
|
||||
|
||||
fn lazily_emit_all_generic_info_tydesc_glues(ccx: crate_ctxt,
|
||||
fn lazily_emit_all_generic_info_tydesc_glues(ccx: @crate_ctxt,
|
||||
gi: generic_info) {
|
||||
for ti: option<@tydesc_info> in gi.static_tis {
|
||||
lazily_emit_all_tydesc_glue(ccx, ti);
|
||||
}
|
||||
}
|
||||
|
||||
fn lazily_emit_tydesc_glue(ccx: crate_ctxt, field: int,
|
||||
fn lazily_emit_tydesc_glue(ccx: @crate_ctxt, field: int,
|
||||
static_ti: option<@tydesc_info>) {
|
||||
alt static_ti {
|
||||
none { }
|
||||
|
|
@ -1571,7 +1571,7 @@ fn store_temp_expr(cx: block, action: copy_action, dst: ValueRef,
|
|||
ret move_val(cx, action, dst, src, t);
|
||||
}
|
||||
|
||||
fn trans_crate_lit(cx: crate_ctxt, lit: ast::lit) -> ValueRef {
|
||||
fn trans_crate_lit(cx: @crate_ctxt, lit: ast::lit) -> ValueRef {
|
||||
alt lit.node {
|
||||
ast::lit_int(i, t) { C_integral(T_int_ty(cx, t), i as u64, True) }
|
||||
ast::lit_uint(u, t) { C_integral(T_uint_ty(cx, t), u, False) }
|
||||
|
|
@ -2107,7 +2107,7 @@ fn trans_external_path(cx: block, did: ast::def_id,
|
|||
type_of_ty_param_bounds_and_ty(ccx, tpt));
|
||||
}
|
||||
|
||||
fn monomorphic_fn(ccx: crate_ctxt, fn_id: ast::def_id, substs: [ty::t],
|
||||
fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, substs: [ty::t],
|
||||
dicts: option<typeck::dict_res>)
|
||||
-> option<{llfn: ValueRef, fty: ty::t}> {
|
||||
let substs = vec::map(substs, {|t|
|
||||
|
|
@ -2171,7 +2171,7 @@ fn monomorphic_fn(ccx: crate_ctxt, fn_id: ast::def_id, substs: [ty::t],
|
|||
}
|
||||
|
||||
// FIXME[mono] Only actually translate things that are not generic
|
||||
fn maybe_instantiate_inline(ccx: crate_ctxt, fn_id: ast::def_id)
|
||||
fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
|
||||
-> ast::def_id {
|
||||
alt ccx.external.find(fn_id) {
|
||||
some(some(node_id)) {
|
||||
|
|
@ -2300,7 +2300,7 @@ fn lval_static_fn(bcx: block, fn_id: ast::def_id, id: ast::node_id,
|
|||
ret {bcx: bcx, val: val, kind: owned, env: null_env, generic: gen};
|
||||
}
|
||||
|
||||
fn lookup_discriminant(ccx: crate_ctxt, vid: ast::def_id) -> ValueRef {
|
||||
fn lookup_discriminant(ccx: @crate_ctxt, vid: ast::def_id) -> ValueRef {
|
||||
alt ccx.discrims.find(vid) {
|
||||
none {
|
||||
// It's an external discriminant that we haven't seen yet.
|
||||
|
|
@ -3947,7 +3947,7 @@ fn mk_standard_basic_blocks(llfn: ValueRef) ->
|
|||
// - create_llargs_for_fn_args.
|
||||
// - new_fn_ctxt
|
||||
// - trans_args
|
||||
fn new_fn_ctxt_w_id(ccx: crate_ctxt, path: path,
|
||||
fn new_fn_ctxt_w_id(ccx: @crate_ctxt, path: path,
|
||||
llfndecl: ValueRef, id: ast::node_id,
|
||||
maybe_self_id: option<@ast::expr>,
|
||||
param_substs: option<param_substs>,
|
||||
|
|
@ -3978,7 +3978,7 @@ fn new_fn_ctxt_w_id(ccx: crate_ctxt, path: path,
|
|||
ccx: ccx};
|
||||
}
|
||||
|
||||
fn new_fn_ctxt(ccx: crate_ctxt, path: path, llfndecl: ValueRef,
|
||||
fn new_fn_ctxt(ccx: @crate_ctxt, path: path, llfndecl: ValueRef,
|
||||
sp: option<span>) -> fn_ctxt {
|
||||
ret new_fn_ctxt_w_id(ccx, path, llfndecl, -1, none, none, sp);
|
||||
}
|
||||
|
|
@ -4098,7 +4098,7 @@ enum self_arg { impl_self(ty::t), no_self, }
|
|||
// trans_closure: Builds an LLVM function out of a source function.
|
||||
// If the function closes over its environment a closure will be
|
||||
// returned.
|
||||
fn trans_closure(ccx: crate_ctxt, path: path, decl: ast::fn_decl,
|
||||
fn trans_closure(ccx: @crate_ctxt, path: path, decl: ast::fn_decl,
|
||||
body: ast::blk, llfndecl: ValueRef,
|
||||
ty_self: self_arg,
|
||||
tps_bounds: [ty::param_bounds],
|
||||
|
|
@ -4147,7 +4147,7 @@ fn trans_closure(ccx: crate_ctxt, path: path, decl: ast::fn_decl,
|
|||
|
||||
// trans_fn: creates an LLVM function corresponding to a source language
|
||||
// function.
|
||||
fn trans_fn(ccx: crate_ctxt,
|
||||
fn trans_fn(ccx: @crate_ctxt,
|
||||
path: path,
|
||||
decl: ast::fn_decl,
|
||||
body: ast::blk,
|
||||
|
|
@ -4172,7 +4172,7 @@ fn trans_fn(ccx: crate_ctxt,
|
|||
}
|
||||
}
|
||||
|
||||
fn trans_res_ctor(ccx: crate_ctxt, path: path, dtor: ast::fn_decl,
|
||||
fn trans_res_ctor(ccx: @crate_ctxt, path: path, dtor: ast::fn_decl,
|
||||
ctor_id: ast::node_id, tps_bounds: [ty::param_bounds],
|
||||
param_substs: option<param_substs>, llfndecl: ValueRef) {
|
||||
// Create a function for the constructor
|
||||
|
|
@ -4206,7 +4206,7 @@ fn trans_res_ctor(ccx: crate_ctxt, path: path, dtor: ast::fn_decl,
|
|||
}
|
||||
|
||||
|
||||
fn trans_enum_variant(ccx: crate_ctxt, enum_id: ast::node_id,
|
||||
fn trans_enum_variant(ccx: @crate_ctxt, enum_id: ast::node_id,
|
||||
variant: ast::variant, disr: int, is_degen: bool,
|
||||
ty_params: [ast::ty_param],
|
||||
param_substs: option<param_substs>,
|
||||
|
|
@ -4275,7 +4275,7 @@ fn trans_enum_variant(ccx: crate_ctxt, enum_id: ast::node_id,
|
|||
// FIXME: this should do some structural hash-consing to avoid
|
||||
// duplicate constants. I think. Maybe LLVM has a magical mode
|
||||
// that does so later on?
|
||||
fn trans_const_expr(cx: crate_ctxt, e: @ast::expr) -> ValueRef {
|
||||
fn trans_const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
|
||||
alt e.node {
|
||||
ast::expr_lit(lit) { ret trans_crate_lit(cx, *lit); }
|
||||
ast::expr_binary(b, e1, e2) {
|
||||
|
|
@ -4369,7 +4369,7 @@ fn trans_const_expr(cx: crate_ctxt, e: @ast::expr) -> ValueRef {
|
|||
}
|
||||
}
|
||||
|
||||
fn trans_const(ccx: crate_ctxt, e: @ast::expr, id: ast::node_id) {
|
||||
fn trans_const(ccx: @crate_ctxt, e: @ast::expr, id: ast::node_id) {
|
||||
let v = trans_const_expr(ccx, e);
|
||||
|
||||
// The scalars come back as 1st class LLVM vals
|
||||
|
|
@ -4379,7 +4379,7 @@ fn trans_const(ccx: crate_ctxt, e: @ast::expr, id: ast::node_id) {
|
|||
llvm::LLVMSetGlobalConstant(g, True);
|
||||
}
|
||||
|
||||
fn trans_item(ccx: crate_ctxt, item: ast::item) {
|
||||
fn trans_item(ccx: @crate_ctxt, item: ast::item) {
|
||||
let path = alt check ccx.tcx.items.get(item.id) {
|
||||
ast_map::node_item(_, p) { p }
|
||||
};
|
||||
|
|
@ -4513,11 +4513,11 @@ fn trans_item(ccx: crate_ctxt, item: ast::item) {
|
|||
// separate modules in the compiled program. That's because modules exist
|
||||
// only as a convenience for humans working with the code, to organize names
|
||||
// and control visibility.
|
||||
fn trans_mod(ccx: crate_ctxt, m: ast::_mod) {
|
||||
fn trans_mod(ccx: @crate_ctxt, m: ast::_mod) {
|
||||
for item in m.items { trans_item(ccx, *item); }
|
||||
}
|
||||
|
||||
fn compute_ii_method_info(ccx: crate_ctxt,
|
||||
fn compute_ii_method_info(ccx: @crate_ctxt,
|
||||
impl_did: ast::def_id,
|
||||
m: @ast::method,
|
||||
f: fn(ty::t, [ty::param_bounds], ast_map::path)) {
|
||||
|
|
@ -4534,7 +4534,7 @@ fn get_pair_fn_ty(llpairty: TypeRef) -> TypeRef {
|
|||
ret struct_elt(llpairty, 0u);
|
||||
}
|
||||
|
||||
fn register_fn(ccx: crate_ctxt, sp: span, path: path, flav: str,
|
||||
fn register_fn(ccx: @crate_ctxt, sp: span, path: path, flav: str,
|
||||
ty_params: [ast::ty_param], node_id: ast::node_id)
|
||||
-> ValueRef {
|
||||
let t = ty::node_id_to_type(ccx.tcx, node_id);
|
||||
|
|
@ -4542,11 +4542,12 @@ fn register_fn(ccx: crate_ctxt, sp: span, path: path, flav: str,
|
|||
register_fn_full(ccx, sp, path, flav, bnds, node_id, t)
|
||||
}
|
||||
|
||||
fn param_bounds(ccx: crate_ctxt, tps: [ast::ty_param]) -> [ty::param_bounds] {
|
||||
fn param_bounds(ccx: @crate_ctxt, tps: [ast::ty_param])
|
||||
-> [ty::param_bounds] {
|
||||
vec::map(tps) {|tp| ccx.tcx.ty_param_bounds.get(tp.id) }
|
||||
}
|
||||
|
||||
fn register_fn_full(ccx: crate_ctxt, sp: span, path: path, flav: str,
|
||||
fn register_fn_full(ccx: @crate_ctxt, sp: span, path: path, flav: str,
|
||||
bnds: [ty::param_bounds], node_id: ast::node_id,
|
||||
node_type: ty::t) -> ValueRef {
|
||||
let llfty = type_of_fn_from_ty(ccx, node_type, bnds);
|
||||
|
|
@ -4554,7 +4555,7 @@ fn register_fn_full(ccx: crate_ctxt, sp: span, path: path, flav: str,
|
|||
lib::llvm::CCallConv, llfty)
|
||||
}
|
||||
|
||||
fn register_fn_fuller(ccx: crate_ctxt, sp: span, path: path, _flav: str,
|
||||
fn register_fn_fuller(ccx: @crate_ctxt, sp: span, path: path, _flav: str,
|
||||
node_id: ast::node_id, node_type: ty::t,
|
||||
cc: lib::llvm::CallConv, llfty: TypeRef) -> ValueRef {
|
||||
let ps: str = mangle_exported_name(ccx, path, node_type);
|
||||
|
|
@ -4571,7 +4572,7 @@ fn register_fn_fuller(ccx: crate_ctxt, sp: span, path: path, _flav: str,
|
|||
|
||||
// Create a _rust_main(args: [str]) function which will be called from the
|
||||
// runtime rust_start function
|
||||
fn create_main_wrapper(ccx: crate_ctxt, sp: span, main_llfn: ValueRef,
|
||||
fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
|
||||
main_node_type: ty::t) {
|
||||
|
||||
if ccx.main_fn != none::<ValueRef> {
|
||||
|
|
@ -4589,7 +4590,7 @@ fn create_main_wrapper(ccx: crate_ctxt, sp: span, main_llfn: ValueRef,
|
|||
ccx.main_fn = some(llfn);
|
||||
create_entry_fn(ccx, llfn);
|
||||
|
||||
fn create_main(ccx: crate_ctxt, main_llfn: ValueRef,
|
||||
fn create_main(ccx: @crate_ctxt, main_llfn: ValueRef,
|
||||
takes_argv: bool) -> ValueRef {
|
||||
let unit_ty = ty::mk_str(ccx.tcx);
|
||||
let vecarg_ty: ty::arg =
|
||||
|
|
@ -4617,7 +4618,7 @@ fn create_main_wrapper(ccx: crate_ctxt, sp: span, main_llfn: ValueRef,
|
|||
ret llfdecl;
|
||||
}
|
||||
|
||||
fn create_entry_fn(ccx: crate_ctxt, rust_main: ValueRef) {
|
||||
fn create_entry_fn(ccx: @crate_ctxt, rust_main: ValueRef) {
|
||||
#[cfg(target_os = "win32")]
|
||||
fn main_name() -> str { ret "WinMain@16"; }
|
||||
#[cfg(target_os = "macos")]
|
||||
|
|
@ -4669,13 +4670,13 @@ fn fill_fn_pair(bcx: block, pair: ValueRef, llfn: ValueRef,
|
|||
Store(bcx, llenvblobptr, env_cell);
|
||||
}
|
||||
|
||||
fn item_path(ccx: crate_ctxt, i: @ast::item) -> path {
|
||||
fn item_path(ccx: @crate_ctxt, i: @ast::item) -> path {
|
||||
*alt check ccx.tcx.items.get(i.id) {
|
||||
ast_map::node_item(_, p) { p }
|
||||
} + [path_name(i.ident)]
|
||||
}
|
||||
|
||||
fn get_item_val(ccx: crate_ctxt, id: ast::node_id) -> ValueRef {
|
||||
fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
|
||||
alt ccx.item_vals.find(id) {
|
||||
some(v) { v }
|
||||
none {
|
||||
|
|
@ -4760,7 +4761,7 @@ fn get_item_val(ccx: crate_ctxt, id: ast::node_id) -> ValueRef {
|
|||
}
|
||||
|
||||
// The constant translation pass.
|
||||
fn trans_constant(ccx: crate_ctxt, it: @ast::item) {
|
||||
fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
|
||||
alt it.node {
|
||||
ast::item_enum(variants, _) {
|
||||
let vi = ty::enum_variants(ccx.tcx, {crate: ast::local_crate,
|
||||
|
|
@ -4796,7 +4797,7 @@ fn trans_constant(ccx: crate_ctxt, it: @ast::item) {
|
|||
}
|
||||
}
|
||||
|
||||
fn trans_constants(ccx: crate_ctxt, crate: @ast::crate) {
|
||||
fn trans_constants(ccx: @crate_ctxt, crate: @ast::crate) {
|
||||
visit::visit_crate(*crate, (), visit::mk_simple_visitor(@{
|
||||
visit_item: bind trans_constant(ccx, _)
|
||||
with *visit::default_simple_visitor()
|
||||
|
|
@ -4808,7 +4809,7 @@ fn vp2i(cx: block, v: ValueRef) -> ValueRef {
|
|||
ret PtrToInt(cx, v, ccx.int_type);
|
||||
}
|
||||
|
||||
fn p2i(ccx: crate_ctxt, v: ValueRef) -> ValueRef {
|
||||
fn p2i(ccx: @crate_ctxt, v: ValueRef) -> ValueRef {
|
||||
ret llvm::LLVMConstPtrToInt(v, ccx.int_type);
|
||||
}
|
||||
|
||||
|
|
@ -4872,7 +4873,7 @@ fn trap(bcx: block) {
|
|||
}
|
||||
}
|
||||
|
||||
fn create_module_map(ccx: crate_ctxt) -> ValueRef {
|
||||
fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
|
||||
let elttype = T_struct([ccx.int_type, ccx.int_type]);
|
||||
let maptype = T_array(elttype, ccx.module_data.size() + 1u);
|
||||
let map = str::as_buf("_rust_mod_map", {|buf|
|
||||
|
|
@ -4911,7 +4912,7 @@ fn decl_crate_map(sess: session::session, mapname: str,
|
|||
}
|
||||
|
||||
// FIXME use hashed metadata instead of crate names once we have that
|
||||
fn fill_crate_map(ccx: crate_ctxt, map: ValueRef) {
|
||||
fn fill_crate_map(ccx: @crate_ctxt, map: ValueRef) {
|
||||
let subcrates: [ValueRef] = [];
|
||||
let i = 1;
|
||||
let cstore = ccx.sess.cstore;
|
||||
|
|
@ -4929,7 +4930,7 @@ fn fill_crate_map(ccx: crate_ctxt, map: ValueRef) {
|
|||
C_array(ccx.int_type, subcrates)]));
|
||||
}
|
||||
|
||||
fn write_metadata(cx: crate_ctxt, crate: @ast::crate) {
|
||||
fn write_metadata(cx: @crate_ctxt, crate: @ast::crate) {
|
||||
if !cx.sess.building_library { ret; }
|
||||
let llmeta = C_bytes(metadata::encoder::encode_metadata(cx, crate));
|
||||
let llconst = C_struct([llmeta]);
|
||||
|
|
@ -4952,7 +4953,7 @@ fn write_metadata(cx: crate_ctxt, crate: @ast::crate) {
|
|||
}
|
||||
|
||||
// Writes the current ABI version into the crate.
|
||||
fn write_abi_version(ccx: crate_ctxt) {
|
||||
fn write_abi_version(ccx: @crate_ctxt) {
|
||||
mk_global(ccx, "rust_abi_version", C_uint(ccx, abi::abi_version),
|
||||
false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ enum environment_value {
|
|||
env_ref(ValueRef, ty::t, lval_kind),
|
||||
}
|
||||
|
||||
fn ev_to_str(ccx: crate_ctxt, ev: environment_value) -> str {
|
||||
fn ev_to_str(ccx: @crate_ctxt, ev: environment_value) -> str {
|
||||
alt ev {
|
||||
env_expr(ex, _) { expr_to_str(ex) }
|
||||
env_copy(v, t, lk) { #fmt("copy(%s,%s)", val_str(ccx.tn, v),
|
||||
|
|
@ -720,7 +720,7 @@ enum target_info {
|
|||
}
|
||||
|
||||
// pth is cx.path
|
||||
fn trans_bind_thunk(ccx: crate_ctxt,
|
||||
fn trans_bind_thunk(ccx: @crate_ctxt,
|
||||
path: path,
|
||||
incoming_fty: ty::t,
|
||||
outgoing_fty: ty::t,
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ type maps = {
|
|||
};
|
||||
|
||||
// Crate context. Every crate we compile has one of these.
|
||||
type crate_ctxt = @{
|
||||
type crate_ctxt = {
|
||||
sess: session::session,
|
||||
llmod: ModuleRef,
|
||||
td: target_data,
|
||||
|
|
@ -210,10 +210,10 @@ type fn_ctxt = @{
|
|||
path: path,
|
||||
|
||||
// This function's enclosing crate context.
|
||||
ccx: crate_ctxt
|
||||
ccx: @crate_ctxt
|
||||
};
|
||||
|
||||
fn warn_not_to_commit(ccx: crate_ctxt, msg: str) {
|
||||
fn warn_not_to_commit(ccx: @crate_ctxt, msg: str) {
|
||||
if !ccx.do_not_commit_warning_issued {
|
||||
ccx.do_not_commit_warning_issued = true;
|
||||
ccx.sess.warn(msg + " -- do not commit like this!");
|
||||
|
|
@ -296,7 +296,7 @@ fn revoke_clean(cx: block, val: ValueRef) {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_res_dtor(ccx: crate_ctxt, did: ast::def_id, inner_t: ty::t)
|
||||
fn get_res_dtor(ccx: @crate_ctxt, did: ast::def_id, inner_t: ty::t)
|
||||
-> ValueRef {
|
||||
if did.crate == ast::local_crate {
|
||||
ret base::get_item_val(ccx, did.node);
|
||||
|
|
@ -414,7 +414,7 @@ fn block_parent(cx: block) -> block {
|
|||
// Accessors
|
||||
|
||||
impl bxc_cxs for block {
|
||||
fn ccx() -> crate_ctxt { self.fcx.ccx }
|
||||
fn ccx() -> @crate_ctxt { self.fcx.ccx }
|
||||
fn tcx() -> ty::ctxt { self.fcx.ccx.tcx }
|
||||
fn sess() -> session { self.fcx.ccx.sess }
|
||||
}
|
||||
|
|
@ -467,7 +467,7 @@ fn T_int(targ_cfg: @session::config) -> TypeRef {
|
|||
};
|
||||
}
|
||||
|
||||
fn T_int_ty(cx: crate_ctxt, t: ast::int_ty) -> TypeRef {
|
||||
fn T_int_ty(cx: @crate_ctxt, t: ast::int_ty) -> TypeRef {
|
||||
alt t {
|
||||
ast::ty_i { cx.int_type }
|
||||
ast::ty_char { T_char() }
|
||||
|
|
@ -478,7 +478,7 @@ fn T_int_ty(cx: crate_ctxt, t: ast::int_ty) -> TypeRef {
|
|||
}
|
||||
}
|
||||
|
||||
fn T_uint_ty(cx: crate_ctxt, t: ast::uint_ty) -> TypeRef {
|
||||
fn T_uint_ty(cx: @crate_ctxt, t: ast::uint_ty) -> TypeRef {
|
||||
alt t {
|
||||
ast::ty_u { cx.int_type }
|
||||
ast::ty_u8 { T_i8() }
|
||||
|
|
@ -488,7 +488,7 @@ fn T_uint_ty(cx: crate_ctxt, t: ast::uint_ty) -> TypeRef {
|
|||
}
|
||||
}
|
||||
|
||||
fn T_float_ty(cx: crate_ctxt, t: ast::float_ty) -> TypeRef {
|
||||
fn T_float_ty(cx: @crate_ctxt, t: ast::float_ty) -> TypeRef {
|
||||
alt t {
|
||||
ast::ty_f { cx.float_type }
|
||||
ast::ty_f32 { T_f32() }
|
||||
|
|
@ -516,7 +516,7 @@ fn T_fn(inputs: [TypeRef], output: TypeRef) -> TypeRef unsafe {
|
|||
False);
|
||||
}
|
||||
|
||||
fn T_fn_pair(cx: crate_ctxt, tfn: TypeRef) -> TypeRef {
|
||||
fn T_fn_pair(cx: @crate_ctxt, tfn: TypeRef) -> TypeRef {
|
||||
ret T_struct([T_ptr(tfn), T_opaque_cbox_ptr(cx)]);
|
||||
}
|
||||
|
||||
|
|
@ -568,7 +568,7 @@ fn T_task(targ_cfg: @session::config) -> TypeRef {
|
|||
ret t;
|
||||
}
|
||||
|
||||
fn T_tydesc_field(cx: crate_ctxt, field: int) -> TypeRef unsafe {
|
||||
fn T_tydesc_field(cx: @crate_ctxt, field: int) -> TypeRef unsafe {
|
||||
// Bit of a kludge: pick the fn typeref out of the tydesc..
|
||||
|
||||
let tydesc_elts: [TypeRef] =
|
||||
|
|
@ -580,7 +580,7 @@ fn T_tydesc_field(cx: crate_ctxt, field: int) -> TypeRef unsafe {
|
|||
ret t;
|
||||
}
|
||||
|
||||
fn T_glue_fn(cx: crate_ctxt) -> TypeRef {
|
||||
fn T_glue_fn(cx: @crate_ctxt) -> TypeRef {
|
||||
let s = "glue_fn";
|
||||
alt name_has_type(cx.tn, s) { some(t) { ret t; } _ {} }
|
||||
let t = T_tydesc_field(cx, abi::tydesc_field_drop_glue);
|
||||
|
|
@ -619,7 +619,7 @@ fn T_vec2(targ_cfg: @session::config, t: TypeRef) -> TypeRef {
|
|||
T_array(t, 0u)]); // elements
|
||||
}
|
||||
|
||||
fn T_vec(ccx: crate_ctxt, t: TypeRef) -> TypeRef {
|
||||
fn T_vec(ccx: @crate_ctxt, t: TypeRef) -> TypeRef {
|
||||
ret T_vec2(ccx.sess.targ_cfg, t);
|
||||
}
|
||||
|
||||
|
|
@ -645,38 +645,38 @@ fn tuplify_cbox_ty(tcx: ty::ctxt, t: ty::t, tydesc_t: ty::t) -> ty::t {
|
|||
t]);
|
||||
}
|
||||
|
||||
fn T_box_header_fields(cx: crate_ctxt) -> [TypeRef] {
|
||||
fn T_box_header_fields(cx: @crate_ctxt) -> [TypeRef] {
|
||||
let ptr = T_ptr(T_i8());
|
||||
ret [cx.int_type, T_ptr(cx.tydesc_type), ptr, ptr];
|
||||
}
|
||||
|
||||
fn T_box_header(cx: crate_ctxt) -> TypeRef {
|
||||
fn T_box_header(cx: @crate_ctxt) -> TypeRef {
|
||||
ret T_struct(T_box_header_fields(cx));
|
||||
}
|
||||
|
||||
fn T_box(cx: crate_ctxt, t: TypeRef) -> TypeRef {
|
||||
fn T_box(cx: @crate_ctxt, t: TypeRef) -> TypeRef {
|
||||
ret T_struct(T_box_header_fields(cx) + [t]);
|
||||
}
|
||||
|
||||
fn T_opaque_box(cx: crate_ctxt) -> TypeRef {
|
||||
fn T_opaque_box(cx: @crate_ctxt) -> TypeRef {
|
||||
ret T_box(cx, T_i8());
|
||||
}
|
||||
|
||||
fn T_opaque_box_ptr(cx: crate_ctxt) -> TypeRef {
|
||||
fn T_opaque_box_ptr(cx: @crate_ctxt) -> TypeRef {
|
||||
ret T_ptr(T_opaque_box(cx));
|
||||
}
|
||||
|
||||
fn T_port(cx: crate_ctxt, _t: TypeRef) -> TypeRef {
|
||||
fn T_port(cx: @crate_ctxt, _t: TypeRef) -> TypeRef {
|
||||
ret T_struct([cx.int_type]); // Refcount
|
||||
|
||||
}
|
||||
|
||||
fn T_chan(cx: crate_ctxt, _t: TypeRef) -> TypeRef {
|
||||
fn T_chan(cx: @crate_ctxt, _t: TypeRef) -> TypeRef {
|
||||
ret T_struct([cx.int_type]); // Refcount
|
||||
|
||||
}
|
||||
|
||||
fn T_taskptr(cx: crate_ctxt) -> TypeRef { ret T_ptr(cx.task_type); }
|
||||
fn T_taskptr(cx: @crate_ctxt) -> TypeRef { ret T_ptr(cx.task_type); }
|
||||
|
||||
|
||||
// This type must never be used directly; it must always be cast away.
|
||||
|
|
@ -690,17 +690,17 @@ fn T_typaram(tn: type_names) -> TypeRef {
|
|||
|
||||
fn T_typaram_ptr(tn: type_names) -> TypeRef { ret T_ptr(T_typaram(tn)); }
|
||||
|
||||
fn T_opaque_cbox_ptr(cx: crate_ctxt) -> TypeRef {
|
||||
fn T_opaque_cbox_ptr(cx: @crate_ctxt) -> TypeRef {
|
||||
// closures look like boxes (even when they are fn~ or fn&)
|
||||
// see trans_closure.rs
|
||||
ret T_opaque_box_ptr(cx);
|
||||
}
|
||||
|
||||
fn T_enum_variant(cx: crate_ctxt) -> TypeRef {
|
||||
fn T_enum_variant(cx: @crate_ctxt) -> TypeRef {
|
||||
ret cx.int_type;
|
||||
}
|
||||
|
||||
fn T_enum(cx: crate_ctxt, size: uint) -> TypeRef {
|
||||
fn T_enum(cx: @crate_ctxt, size: uint) -> TypeRef {
|
||||
let s = "enum_" + uint::to_str(size, 10u);
|
||||
alt name_has_type(cx.tn, s) { some(t) { ret t; } _ {} }
|
||||
let t =
|
||||
|
|
@ -711,7 +711,7 @@ fn T_enum(cx: crate_ctxt, size: uint) -> TypeRef {
|
|||
ret t;
|
||||
}
|
||||
|
||||
fn T_opaque_enum(cx: crate_ctxt) -> TypeRef {
|
||||
fn T_opaque_enum(cx: @crate_ctxt) -> TypeRef {
|
||||
let s = "opaque_enum";
|
||||
alt name_has_type(cx.tn, s) { some(t) { ret t; } _ {} }
|
||||
let t = T_struct([T_enum_variant(cx), T_i8()]);
|
||||
|
|
@ -719,15 +719,15 @@ fn T_opaque_enum(cx: crate_ctxt) -> TypeRef {
|
|||
ret t;
|
||||
}
|
||||
|
||||
fn T_opaque_enum_ptr(cx: crate_ctxt) -> TypeRef {
|
||||
fn T_opaque_enum_ptr(cx: @crate_ctxt) -> TypeRef {
|
||||
ret T_ptr(T_opaque_enum(cx));
|
||||
}
|
||||
|
||||
fn T_captured_tydescs(cx: crate_ctxt, n: uint) -> TypeRef {
|
||||
fn T_captured_tydescs(cx: @crate_ctxt, n: uint) -> TypeRef {
|
||||
ret T_struct(vec::from_elem::<TypeRef>(n, T_ptr(cx.tydesc_type)));
|
||||
}
|
||||
|
||||
fn T_opaque_iface(cx: crate_ctxt) -> TypeRef {
|
||||
fn T_opaque_iface(cx: @crate_ctxt) -> TypeRef {
|
||||
T_struct([T_ptr(cx.tydesc_type), T_opaque_box_ptr(cx)])
|
||||
}
|
||||
|
||||
|
|
@ -769,11 +769,11 @@ fn C_i64(i: i64) -> ValueRef {
|
|||
ret C_integral(T_i64(), i as u64, True);
|
||||
}
|
||||
|
||||
fn C_int(cx: crate_ctxt, i: int) -> ValueRef {
|
||||
fn C_int(cx: @crate_ctxt, i: int) -> ValueRef {
|
||||
ret C_integral(cx.int_type, i as u64, True);
|
||||
}
|
||||
|
||||
fn C_uint(cx: crate_ctxt, i: uint) -> ValueRef {
|
||||
fn C_uint(cx: @crate_ctxt, i: uint) -> ValueRef {
|
||||
ret C_integral(cx.int_type, i as u64, False);
|
||||
}
|
||||
|
||||
|
|
@ -782,7 +782,7 @@ fn C_u8(i: uint) -> ValueRef { ret C_integral(T_i8(), i as u64, False); }
|
|||
|
||||
// This is a 'c-like' raw string, which differs from
|
||||
// our boxed-and-length-annotated strings.
|
||||
fn C_cstr(cx: crate_ctxt, s: str) -> ValueRef {
|
||||
fn C_cstr(cx: @crate_ctxt, s: str) -> ValueRef {
|
||||
let sc = str::as_buf(s) {|buf|
|
||||
llvm::LLVMConstString(buf, str::len(s) as c_uint, False)
|
||||
};
|
||||
|
|
@ -831,7 +831,7 @@ fn C_bytes(bytes: [u8]) -> ValueRef unsafe {
|
|||
bytes.len() as c_uint, False);
|
||||
}
|
||||
|
||||
fn C_shape(ccx: crate_ctxt, bytes: [u8]) -> ValueRef {
|
||||
fn C_shape(ccx: @crate_ctxt, bytes: [u8]) -> ValueRef {
|
||||
let llshape = C_bytes(bytes);
|
||||
let llglobal = str::as_buf(ccx.names("shape"), {|buf|
|
||||
llvm::LLVMAddGlobal(ccx.llmod, val_ty(llshape), buf)
|
||||
|
|
@ -842,7 +842,7 @@ fn C_shape(ccx: crate_ctxt, bytes: [u8]) -> ValueRef {
|
|||
ret llvm::LLVMConstPointerCast(llglobal, T_ptr(T_i8()));
|
||||
}
|
||||
|
||||
pure fn type_has_static_size(cx: crate_ctxt, t: ty::t) -> bool {
|
||||
pure fn type_has_static_size(cx: @crate_ctxt, t: ty::t) -> bool {
|
||||
!ty::type_has_dynamic_size(cx.tcx, t)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ fn llnull() -> ValueRef unsafe {
|
|||
unsafe::reinterpret_cast(ptr::null::<ValueRef>())
|
||||
}
|
||||
|
||||
fn add_named_metadata(cx: crate_ctxt, name: str, val: ValueRef) {
|
||||
fn add_named_metadata(cx: @crate_ctxt, name: str, val: ValueRef) {
|
||||
str::as_buf(name, {|sbuf|
|
||||
llvm::LLVMAddNamedMetadataOperand(cx.llmod, sbuf,
|
||||
val)
|
||||
|
|
@ -154,7 +154,7 @@ fn cached_metadata<T: copy>(cache: metadata_cache, mdtag: int,
|
|||
ret option::none;
|
||||
}
|
||||
|
||||
fn create_compile_unit(cx: crate_ctxt, full_path: str)
|
||||
fn create_compile_unit(cx: @crate_ctxt, full_path: str)
|
||||
-> @metadata<compile_unit_md> unsafe {
|
||||
let cache = get_cache(cx);
|
||||
let tg = CompileUnitTag;
|
||||
|
|
@ -192,11 +192,11 @@ fn create_compile_unit(cx: crate_ctxt, full_path: str)
|
|||
ret mdval;
|
||||
}
|
||||
|
||||
fn get_cache(cx: crate_ctxt) -> metadata_cache {
|
||||
fn get_cache(cx: @crate_ctxt) -> metadata_cache {
|
||||
option::get(cx.dbg_cx).llmetadata
|
||||
}
|
||||
|
||||
fn create_file(cx: crate_ctxt, full_path: str) -> @metadata<file_md> {
|
||||
fn create_file(cx: @crate_ctxt, full_path: str) -> @metadata<file_md> {
|
||||
let cache = get_cache(cx);;
|
||||
let tg = FileDescriptorTag;
|
||||
alt cached_metadata::<@metadata<file_md>>(
|
||||
|
|
@ -268,13 +268,13 @@ fn create_block(cx: block) -> @metadata<block_md> {
|
|||
ret mdval;
|
||||
}
|
||||
|
||||
fn size_and_align_of(cx: crate_ctxt, t: ty::t) -> (int, int) {
|
||||
fn size_and_align_of(cx: @crate_ctxt, t: ty::t) -> (int, int) {
|
||||
let llty = type_of::type_of(cx, t);
|
||||
(shape::llsize_of_real(cx, llty) as int,
|
||||
shape::llalign_of_real(cx, llty) as int)
|
||||
}
|
||||
|
||||
fn create_basic_type(cx: crate_ctxt, t: ty::t, ty: ast::prim_ty, span: span)
|
||||
fn create_basic_type(cx: @crate_ctxt, t: ty::t, ty: ast::prim_ty, span: span)
|
||||
-> @metadata<tydesc_md> {
|
||||
let cache = get_cache(cx);
|
||||
let tg = BasicTypeDescriptorTag;
|
||||
|
|
@ -329,7 +329,7 @@ fn create_basic_type(cx: crate_ctxt, t: ty::t, ty: ast::prim_ty, span: span)
|
|||
ret mdval;
|
||||
}
|
||||
|
||||
fn create_pointer_type(cx: crate_ctxt, t: ty::t, span: span,
|
||||
fn create_pointer_type(cx: @crate_ctxt, t: ty::t, span: span,
|
||||
pointee: @metadata<tydesc_md>)
|
||||
-> @metadata<tydesc_md> {
|
||||
let tg = PointerTypeTag;
|
||||
|
|
@ -402,7 +402,7 @@ fn add_member(cx: @struct_ctxt, name: str, line: int, size: int, align: int,
|
|||
cx.total_size += size * 8;
|
||||
}
|
||||
|
||||
fn create_record(cx: crate_ctxt, t: ty::t, fields: [ast::ty_field],
|
||||
fn create_record(cx: @crate_ctxt, t: ty::t, fields: [ast::ty_field],
|
||||
span: span) -> @metadata<tydesc_md> {
|
||||
let fname = filename_from_span(cx, span);
|
||||
let file_node = create_file(cx, fname);
|
||||
|
|
@ -422,7 +422,7 @@ fn create_record(cx: crate_ctxt, t: ty::t, fields: [ast::ty_field],
|
|||
ret mdval;
|
||||
}
|
||||
|
||||
fn create_boxed_type(cx: crate_ctxt, outer: ty::t, _inner: ty::t,
|
||||
fn create_boxed_type(cx: @crate_ctxt, outer: ty::t, _inner: ty::t,
|
||||
span: span, boxed: @metadata<tydesc_md>)
|
||||
-> @metadata<tydesc_md> {
|
||||
//let tg = StructureTypeTag;
|
||||
|
|
@ -481,7 +481,7 @@ fn create_composite_type(type_tag: int, name: str, file: ValueRef, line: int,
|
|||
ret llmdnode(lldata);
|
||||
}
|
||||
|
||||
fn create_vec(cx: crate_ctxt, vec_t: ty::t, elem_t: ty::t,
|
||||
fn create_vec(cx: @crate_ctxt, vec_t: ty::t, elem_t: ty::t,
|
||||
vec_ty_span: codemap::span, elem_ty: @ast::ty)
|
||||
-> @metadata<tydesc_md> {
|
||||
let fname = filename_from_span(cx, vec_ty_span);
|
||||
|
|
@ -506,7 +506,7 @@ fn create_vec(cx: crate_ctxt, vec_t: ty::t, elem_t: ty::t,
|
|||
ret @{node: llnode, data: {hash: ty::type_id(vec_t)}};
|
||||
}
|
||||
|
||||
fn create_ty(_cx: crate_ctxt, _t: ty::t, _ty: @ast::ty)
|
||||
fn create_ty(_cx: @crate_ctxt, _t: ty::t, _ty: @ast::ty)
|
||||
-> @metadata<tydesc_md> {
|
||||
/*let cache = get_cache(cx);
|
||||
alt cached_metadata::<@metadata<tydesc_md>>(
|
||||
|
|
@ -610,7 +610,7 @@ fn create_ty(_cx: crate_ctxt, _t: ty::t, _ty: @ast::ty)
|
|||
*/
|
||||
}
|
||||
|
||||
fn filename_from_span(cx: crate_ctxt, sp: codemap::span) -> str {
|
||||
fn filename_from_span(cx: @crate_ctxt, sp: codemap::span) -> str {
|
||||
codemap::lookup_char_pos(cx.sess.codemap, sp.lo).file.name
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import std::map::hashmap;
|
|||
// annotates nodes with information about the methods and dicts that
|
||||
// are referenced (ccx.method_map and ccx.dict_map).
|
||||
|
||||
fn trans_impl(ccx: crate_ctxt, path: path, name: ast::ident,
|
||||
fn trans_impl(ccx: @crate_ctxt, path: path, name: ast::ident,
|
||||
methods: [@ast::method], tps: [ast::ty_param]) {
|
||||
let sub_path = path + [path_name(name)];
|
||||
for m in methods {
|
||||
|
|
@ -104,7 +104,7 @@ fn trans_static_callee(bcx: block, callee_id: ast::node_id,
|
|||
with lval_static_fn(bcx, did, callee_id, substs)}
|
||||
}
|
||||
|
||||
fn wrapper_fn_ty(ccx: crate_ctxt, dict_ty: TypeRef, fty: ty::t,
|
||||
fn wrapper_fn_ty(ccx: @crate_ctxt, dict_ty: TypeRef, fty: ty::t,
|
||||
tps: @[ty::param_bounds]) -> {ty: ty::t, llty: TypeRef} {
|
||||
let bare_fn_ty = type_of_fn_from_ty(ccx, fty, *tps);
|
||||
let {inputs, output} = llfn_arg_tys(bare_fn_ty);
|
||||
|
|
@ -207,7 +207,7 @@ fn llfn_arg_tys(ft: TypeRef) -> {inputs: [TypeRef], output: TypeRef} {
|
|||
{inputs: args, output: out_ty}
|
||||
}
|
||||
|
||||
fn trans_vtable(ccx: crate_ctxt, id: ast::node_id, name: str,
|
||||
fn trans_vtable(ccx: @crate_ctxt, id: ast::node_id, name: str,
|
||||
ptrs: [ValueRef]) {
|
||||
let tbl = C_struct(ptrs);
|
||||
let vt_gvar = str::as_buf(name, {|buf|
|
||||
|
|
@ -269,7 +269,7 @@ fn resolve_dicts_in_fn_ctxt(fcx: fn_ctxt, dicts: typeck::dict_res)
|
|||
some(@result)
|
||||
}
|
||||
|
||||
fn trans_wrapper(ccx: crate_ctxt, pt: path, llfty: TypeRef,
|
||||
fn trans_wrapper(ccx: @crate_ctxt, pt: path, llfty: TypeRef,
|
||||
fill: fn(ValueRef, block) -> block)
|
||||
-> ValueRef {
|
||||
let name = link::mangle_internal_name_by_path(ccx, pt);
|
||||
|
|
@ -282,7 +282,7 @@ fn trans_wrapper(ccx: crate_ctxt, pt: path, llfty: TypeRef,
|
|||
ret llfn;
|
||||
}
|
||||
|
||||
fn trans_impl_wrapper(ccx: crate_ctxt, pt: path,
|
||||
fn trans_impl_wrapper(ccx: @crate_ctxt, pt: path,
|
||||
extra_tps: [ty::param_bounds], real_fn: ValueRef)
|
||||
-> ValueRef {
|
||||
let {inputs: real_args, output: real_ret} =
|
||||
|
|
@ -327,7 +327,7 @@ fn trans_impl_wrapper(ccx: crate_ctxt, pt: path,
|
|||
})
|
||||
}
|
||||
|
||||
fn trans_impl_vtable(ccx: crate_ctxt, pt: path,
|
||||
fn trans_impl_vtable(ccx: @crate_ctxt, pt: path,
|
||||
iface_id: ast::def_id, ms: [@ast::method],
|
||||
tps: [ast::ty_param], it: @ast::item) {
|
||||
let new_pt = pt + [path_name(it.ident), path_name(int::str(it.id)),
|
||||
|
|
@ -350,7 +350,7 @@ fn trans_impl_vtable(ccx: crate_ctxt, pt: path,
|
|||
trans_vtable(ccx, it.id, s, ptrs);
|
||||
}
|
||||
|
||||
fn trans_iface_wrapper(ccx: crate_ctxt, pt: path, m: ty::method,
|
||||
fn trans_iface_wrapper(ccx: @crate_ctxt, pt: path, m: ty::method,
|
||||
n: uint) -> ValueRef {
|
||||
let {llty: llfty, _} = wrapper_fn_ty(ccx, T_ptr(T_i8()),
|
||||
ty::mk_fn(ccx.tcx, m.fty), m.tps);
|
||||
|
|
@ -376,7 +376,7 @@ fn trans_iface_wrapper(ccx: crate_ctxt, pt: path, m: ty::method,
|
|||
})
|
||||
}
|
||||
|
||||
fn trans_iface_vtable(ccx: crate_ctxt, pt: path, it: @ast::item) {
|
||||
fn trans_iface_vtable(ccx: @crate_ctxt, pt: path, it: @ast::item) {
|
||||
let new_pt = pt + [path_name(it.ident), path_name(int::str(it.id))];
|
||||
let i_did = ast_util::local_def(it.id), i = 0u;
|
||||
let ptrs = vec::map(*ty::iface_methods(ccx.tcx, i_did), {|m|
|
||||
|
|
@ -481,7 +481,7 @@ fn get_static_dict(bcx: block, origin: typeck::dict_origin)
|
|||
fn get_dict_ptrs(bcx: block, origin: typeck::dict_origin)
|
||||
-> {bcx: block, ptrs: [ValueRef]} {
|
||||
let ccx = bcx.ccx();
|
||||
fn get_vtable(ccx: crate_ctxt, did: ast::def_id) -> ValueRef {
|
||||
fn get_vtable(ccx: @crate_ctxt, did: ast::def_id) -> ValueRef {
|
||||
if did.crate == ast::local_crate {
|
||||
get_item_val(ccx, did.node)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ type c_stack_tys = {
|
|||
shim_fn_ty: TypeRef
|
||||
};
|
||||
|
||||
fn c_arg_and_ret_lltys(ccx: crate_ctxt,
|
||||
fn c_arg_and_ret_lltys(ccx: @crate_ctxt,
|
||||
id: ast::node_id) -> ([TypeRef], TypeRef, ty::t) {
|
||||
alt ty::get(ty::node_id_to_type(ccx.tcx, id)).struct {
|
||||
ty::ty_fn({inputs: arg_tys, output: ret_ty, _}) {
|
||||
|
|
@ -41,7 +41,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 {
|
||||
let (llargtys, llretty, ret_ty) = c_arg_and_ret_lltys(ccx, id);
|
||||
let bundle_ty = T_struct(llargtys + [T_ptr(llretty)]);
|
||||
|
|
@ -60,7 +60,7 @@ type shim_arg_builder = fn(bcx: block, tys: @c_stack_tys,
|
|||
type shim_ret_builder = fn(bcx: block, tys: @c_stack_tys,
|
||||
llargbundle: ValueRef, llretval: ValueRef);
|
||||
|
||||
fn build_shim_fn_(ccx: crate_ctxt,
|
||||
fn build_shim_fn_(ccx: @crate_ctxt,
|
||||
shim_name: str,
|
||||
llbasefn: ValueRef,
|
||||
tys: @c_stack_tys,
|
||||
|
|
@ -97,7 +97,7 @@ type wrap_arg_builder = fn(bcx: block, tys: @c_stack_tys,
|
|||
type wrap_ret_builder = fn(bcx: block, tys: @c_stack_tys,
|
||||
llargbundle: ValueRef);
|
||||
|
||||
fn build_wrap_fn_(ccx: crate_ctxt,
|
||||
fn build_wrap_fn_(ccx: @crate_ctxt,
|
||||
tys: @c_stack_tys,
|
||||
llshimfn: ValueRef,
|
||||
llwrapfn: ValueRef,
|
||||
|
|
@ -161,9 +161,9 @@ fn build_wrap_fn_(ccx: crate_ctxt,
|
|||
// stack pointer appropriately to avoid a round of copies. (In fact, the shim
|
||||
// function itself is unnecessary). We used to do this, in fact, and will
|
||||
// perhaps do so in the future.
|
||||
fn trans_native_mod(ccx: crate_ctxt,
|
||||
fn trans_native_mod(ccx: @crate_ctxt,
|
||||
native_mod: ast::native_mod, abi: ast::native_abi) {
|
||||
fn build_shim_fn(ccx: crate_ctxt,
|
||||
fn build_shim_fn(ccx: @crate_ctxt,
|
||||
native_item: @ast::native_item,
|
||||
tys: @c_stack_tys,
|
||||
cc: lib::llvm::CallConv) -> ValueRef {
|
||||
|
|
@ -204,7 +204,7 @@ fn trans_native_mod(ccx: crate_ctxt,
|
|||
build_args, build_ret);
|
||||
}
|
||||
|
||||
fn build_wrap_fn(ccx: crate_ctxt,
|
||||
fn build_wrap_fn(ccx: @crate_ctxt,
|
||||
tys: @c_stack_tys,
|
||||
num_tps: uint,
|
||||
llshimfn: ValueRef,
|
||||
|
|
@ -260,10 +260,10 @@ fn trans_native_mod(ccx: crate_ctxt,
|
|||
}
|
||||
}
|
||||
|
||||
fn trans_crust_fn(ccx: crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
||||
fn trans_crust_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
||||
body: ast::blk, llwrapfn: ValueRef, id: ast::node_id) {
|
||||
|
||||
fn build_rust_fn(ccx: crate_ctxt, path: ast_map::path,
|
||||
fn build_rust_fn(ccx: @crate_ctxt, path: ast_map::path,
|
||||
decl: ast::fn_decl, body: ast::blk,
|
||||
id: ast::node_id) -> ValueRef {
|
||||
let t = ty::node_id_to_type(ccx.tcx, id);
|
||||
|
|
@ -276,7 +276,7 @@ fn trans_crust_fn(ccx: crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
|||
ret llfndecl;
|
||||
}
|
||||
|
||||
fn build_shim_fn(ccx: crate_ctxt, path: ast_map::path,
|
||||
fn build_shim_fn(ccx: @crate_ctxt, path: ast_map::path,
|
||||
llrustfn: ValueRef, tys: @c_stack_tys) -> ValueRef {
|
||||
|
||||
fn build_args(bcx: block, tys: @c_stack_tys,
|
||||
|
|
@ -309,7 +309,7 @@ fn trans_crust_fn(ccx: crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
|||
build_args, build_ret);
|
||||
}
|
||||
|
||||
fn build_wrap_fn(ccx: crate_ctxt, llshimfn: ValueRef,
|
||||
fn build_wrap_fn(ccx: @crate_ctxt, llshimfn: ValueRef,
|
||||
llwrapfn: ValueRef, tys: @c_stack_tys) {
|
||||
|
||||
fn build_args(bcx: block, tys: @c_stack_tys,
|
||||
|
|
@ -347,7 +347,7 @@ fn trans_crust_fn(ccx: crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
|||
build_wrap_fn(ccx, llshimfn, llwrapfn, tys)
|
||||
}
|
||||
|
||||
fn register_crust_fn(ccx: crate_ctxt, sp: span,
|
||||
fn register_crust_fn(ccx: @crate_ctxt, sp: span,
|
||||
path: ast_map::path, node_id: ast::node_id)
|
||||
-> ValueRef {
|
||||
let t = ty::node_id_to_type(ccx.tcx, node_id);
|
||||
|
|
@ -357,7 +357,7 @@ fn register_crust_fn(ccx: crate_ctxt, sp: span,
|
|||
t, lib::llvm::CCallConv, llfty)
|
||||
}
|
||||
|
||||
fn abi_of_native_fn(ccx: crate_ctxt, i: @ast::native_item)
|
||||
fn abi_of_native_fn(ccx: @crate_ctxt, i: @ast::native_item)
|
||||
-> ast::native_abi {
|
||||
alt attr::get_meta_item_value_str_by_name(i.attrs, "abi") {
|
||||
none {
|
||||
|
|
@ -374,7 +374,7 @@ fn abi_of_native_fn(ccx: crate_ctxt, i: @ast::native_item)
|
|||
}
|
||||
}
|
||||
|
||||
fn decl_native_fn(ccx: crate_ctxt, i: @ast::native_item,
|
||||
fn decl_native_fn(ccx: @crate_ctxt, i: @ast::native_item,
|
||||
pth: ast_map::path) -> ValueRef {
|
||||
alt i.node {
|
||||
ast::native_item_fn(_, tps) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ fn eq_res_info(a: res_info, b: res_info) -> bool {
|
|||
ret a.did.crate == b.did.crate && a.did.node == b.did.node && a.t == b.t;
|
||||
}
|
||||
|
||||
fn mk_global(ccx: crate_ctxt, name: str, llval: ValueRef, internal: bool) ->
|
||||
fn mk_global(ccx: @crate_ctxt, name: str, llval: ValueRef, internal: bool) ->
|
||||
ValueRef {
|
||||
let llglobal =
|
||||
str::as_buf(name,
|
||||
|
|
@ -101,7 +101,7 @@ fn mk_global(ccx: crate_ctxt, name: str, llval: ValueRef, internal: bool) ->
|
|||
//
|
||||
// FIXME: Use this in dynamic_size_of() as well.
|
||||
|
||||
fn largest_variants(ccx: crate_ctxt, tag_id: ast::def_id) -> [uint] {
|
||||
fn largest_variants(ccx: @crate_ctxt, tag_id: ast::def_id) -> [uint] {
|
||||
// Compute the minimum and maximum size and alignment for each variant.
|
||||
//
|
||||
// FIXME: We could do better here; e.g. we know that any variant that
|
||||
|
|
@ -180,7 +180,7 @@ fn round_up(size: u16, align: u8) -> u16 {
|
|||
|
||||
type size_align = {size: u16, align: u8};
|
||||
|
||||
fn compute_static_enum_size(ccx: crate_ctxt, largest_variants: [uint],
|
||||
fn compute_static_enum_size(ccx: @crate_ctxt, largest_variants: [uint],
|
||||
did: ast::def_id) -> size_align {
|
||||
let max_size = 0u16;
|
||||
let max_align = 1u8;
|
||||
|
|
@ -220,7 +220,7 @@ enum enum_kind {
|
|||
tk_complex // N variants, no data
|
||||
}
|
||||
|
||||
fn enum_kind(ccx: crate_ctxt, did: ast::def_id) -> enum_kind {
|
||||
fn enum_kind(ccx: @crate_ctxt, did: ast::def_id) -> enum_kind {
|
||||
let variants = ty::enum_variants(ccx.tcx, did);
|
||||
if vec::any(*variants) {|v| vec::len(v.args) > 0u} {
|
||||
if vec::len(*variants) == 1u { tk_newtype }
|
||||
|
|
@ -294,7 +294,7 @@ fn add_substr(&dest: [u8], src: [u8]) {
|
|||
dest += src;
|
||||
}
|
||||
|
||||
fn shape_of(ccx: crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] {
|
||||
fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] {
|
||||
let s = [];
|
||||
|
||||
alt ty::get(t).struct {
|
||||
|
|
@ -438,7 +438,7 @@ fn shape_of(ccx: crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] {
|
|||
}
|
||||
|
||||
// FIXME: We might discover other variants as we traverse these. Handle this.
|
||||
fn shape_of_variant(ccx: crate_ctxt, v: ty::variant_info,
|
||||
fn shape_of_variant(ccx: @crate_ctxt, v: ty::variant_info,
|
||||
ty_param_count: uint) -> [u8] {
|
||||
let ty_param_map = [];
|
||||
let i = 0u;
|
||||
|
|
@ -449,7 +449,7 @@ fn shape_of_variant(ccx: crate_ctxt, v: ty::variant_info,
|
|||
ret s;
|
||||
}
|
||||
|
||||
fn gen_enum_shapes(ccx: crate_ctxt) -> ValueRef {
|
||||
fn gen_enum_shapes(ccx: @crate_ctxt) -> ValueRef {
|
||||
// Loop over all the enum variants and write their shapes into a
|
||||
// data buffer. As we do this, it's possible for us to discover
|
||||
// new enums, so we must do this first.
|
||||
|
|
@ -547,7 +547,7 @@ fn gen_enum_shapes(ccx: crate_ctxt) -> ValueRef {
|
|||
ret mk_global(ccx, "tag_shapes", C_bytes(header), true);
|
||||
}
|
||||
|
||||
fn gen_resource_shapes(ccx: crate_ctxt) -> ValueRef {
|
||||
fn gen_resource_shapes(ccx: @crate_ctxt) -> ValueRef {
|
||||
let dtors = [];
|
||||
let i = 0u;
|
||||
let len = interner::len(ccx.shape_cx.resources);
|
||||
|
|
@ -560,7 +560,7 @@ fn gen_resource_shapes(ccx: crate_ctxt) -> ValueRef {
|
|||
ret mk_global(ccx, "resource_shapes", C_struct(dtors), true);
|
||||
}
|
||||
|
||||
fn gen_shape_tables(ccx: crate_ctxt) {
|
||||
fn gen_shape_tables(ccx: @crate_ctxt) {
|
||||
let lltagstable = gen_enum_shapes(ccx);
|
||||
let llresourcestable = gen_resource_shapes(ccx);
|
||||
trans::common::set_struct_body(ccx.shape_cx.llshapetablesty,
|
||||
|
|
@ -623,21 +623,21 @@ fn metrics(bcx: block, t: ty::t) -> metrics {
|
|||
}
|
||||
|
||||
// Returns the real size of the given type for the current target.
|
||||
fn llsize_of_real(cx: crate_ctxt, t: TypeRef) -> uint {
|
||||
fn llsize_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
|
||||
ret llvm::LLVMStoreSizeOfType(cx.td.lltd, t) as uint;
|
||||
}
|
||||
|
||||
// Returns the real alignment of the given type for the current target.
|
||||
fn llalign_of_real(cx: crate_ctxt, t: TypeRef) -> uint {
|
||||
fn llalign_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
|
||||
ret llvm::LLVMPreferredAlignmentOfType(cx.td.lltd, t) as uint;
|
||||
}
|
||||
|
||||
fn llsize_of(cx: crate_ctxt, t: TypeRef) -> ValueRef {
|
||||
fn llsize_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
|
||||
ret llvm::LLVMConstIntCast(lib::llvm::llvm::LLVMSizeOf(t), cx.int_type,
|
||||
False);
|
||||
}
|
||||
|
||||
fn llalign_of(cx: crate_ctxt, t: TypeRef) -> ValueRef {
|
||||
fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
|
||||
ret llvm::LLVMConstIntCast(lib::llvm::llvm::LLVMAlignOf(t), cx.int_type,
|
||||
False);
|
||||
}
|
||||
|
|
@ -648,7 +648,7 @@ fn llalign_of(cx: crate_ctxt, t: TypeRef) -> ValueRef {
|
|||
// FIXME: Migrate trans over to use this.
|
||||
|
||||
// Computes the size of the data part of a non-dynamically-sized enum.
|
||||
fn static_size_of_enum(cx: crate_ctxt, t: ty::t) -> uint {
|
||||
fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
|
||||
if cx.enum_sizes.contains_key(t) { ret cx.enum_sizes.get(t); }
|
||||
alt ty::get(t).struct {
|
||||
ty::ty_enum(tid, subtys) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import std::map::hashmap;
|
|||
|
||||
import ty::*;
|
||||
|
||||
fn type_of_explicit_args(cx: crate_ctxt, inputs: [ty::arg]) -> [TypeRef] {
|
||||
fn type_of_explicit_args(cx: @crate_ctxt, inputs: [ty::arg]) -> [TypeRef] {
|
||||
vec::map(inputs) {|arg|
|
||||
let arg_ty = arg.ty;
|
||||
let llty = type_of(cx, arg_ty);
|
||||
|
|
@ -18,7 +18,7 @@ fn type_of_explicit_args(cx: crate_ctxt, inputs: [ty::arg]) -> [TypeRef] {
|
|||
}
|
||||
}
|
||||
|
||||
fn type_of_fn(cx: crate_ctxt, inputs: [ty::arg],
|
||||
fn type_of_fn(cx: @crate_ctxt, inputs: [ty::arg],
|
||||
output: ty::t, params: [ty::param_bounds]) -> TypeRef {
|
||||
let atys: [TypeRef] = [];
|
||||
|
||||
|
|
@ -44,12 +44,12 @@ fn type_of_fn(cx: crate_ctxt, inputs: [ty::arg],
|
|||
}
|
||||
|
||||
// Given a function type and a count of ty params, construct an llvm type
|
||||
fn type_of_fn_from_ty(cx: crate_ctxt, fty: ty::t,
|
||||
fn type_of_fn_from_ty(cx: @crate_ctxt, fty: ty::t,
|
||||
param_bounds: [ty::param_bounds]) -> TypeRef {
|
||||
type_of_fn(cx, ty::ty_fn_args(fty), ty::ty_fn_ret(fty), param_bounds)
|
||||
}
|
||||
|
||||
fn type_of(cx: crate_ctxt, t: ty::t) -> TypeRef {
|
||||
fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
|
||||
assert !ty::type_has_vars(t);
|
||||
// Check the cache.
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ fn type_of(cx: crate_ctxt, t: ty::t) -> TypeRef {
|
|||
ret llty;
|
||||
}
|
||||
|
||||
fn type_of_enum(cx: crate_ctxt, did: ast::def_id, t: ty::t)
|
||||
fn type_of_enum(cx: @crate_ctxt, did: ast::def_id, t: ty::t)
|
||||
-> TypeRef {
|
||||
let degen = (*ty::enum_variants(cx.tcx, did)).len() == 1u;
|
||||
if check type_has_static_size(cx, t) {
|
||||
|
|
@ -151,7 +151,7 @@ fn type_of_enum(cx: crate_ctxt, did: ast::def_id, t: ty::t)
|
|||
}
|
||||
|
||||
fn type_of_ty_param_bounds_and_ty
|
||||
(ccx: crate_ctxt, tpt: ty::ty_param_bounds_and_ty) -> TypeRef {
|
||||
(ccx: @crate_ctxt, tpt: ty::ty_param_bounds_and_ty) -> TypeRef {
|
||||
let t = tpt.ty;
|
||||
alt ty::get(t).struct {
|
||||
ty::ty_fn(_) {
|
||||
|
|
@ -164,7 +164,7 @@ fn type_of_ty_param_bounds_and_ty
|
|||
type_of(ccx, t)
|
||||
}
|
||||
|
||||
fn type_of_or_i8(ccx: crate_ctxt, typ: ty::t) -> TypeRef {
|
||||
fn type_of_or_i8(ccx: @crate_ctxt, typ: ty::t) -> TypeRef {
|
||||
if check type_has_static_size(ccx, typ) {
|
||||
type_of(ccx, typ)
|
||||
} else { T_i8() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue