Skip to content

Commit 2082a97

Browse files
committed
remove modes from ty.rs
1 parent e1086b0 commit 2082a97

File tree

16 files changed

+159
-141
lines changed

16 files changed

+159
-141
lines changed

src/rustc/middle/trans/base.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,10 @@ fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) {
745745
ty::ty_opaque_closure_ptr(ck) => {
746746
closure::make_opaque_cbox_free_glue(bcx, ck, v)
747747
}
748-
ty::ty_class(did,substs) => {
748+
ty::ty_class(did, ref substs) => {
749749
// Call the dtor if there is one
750750
do option::map_default(ty::ty_dtor(bcx.tcx(), did), bcx) |dt_id| {
751-
trans_class_drop(bcx, v, dt_id, did, substs)
751+
trans_class_drop(bcx, v, dt_id, did, substs)
752752
}
753753
}
754754
_ => bcx
@@ -758,7 +758,7 @@ fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) {
758758

759759
fn trans_class_drop(bcx: block, v0: ValueRef, dtor_did: ast::def_id,
760760
class_did: ast::def_id,
761-
substs: ty::substs) -> block {
761+
substs: &ty::substs) -> block {
762762
let drop_flag = GEPi(bcx, v0, ~[0u, 0u]);
763763
do with_cond(bcx, IsNotNull(bcx, Load(bcx, drop_flag))) |cx| {
764764
let mut bcx = cx;
@@ -805,7 +805,7 @@ fn make_drop_glue(bcx: block, v0: ValueRef, t: ty::t) {
805805
ty::ty_unboxed_vec(_) => {
806806
tvec::make_drop_glue_unboxed(bcx, v0, t)
807807
}
808-
ty::ty_class(did, substs) => {
808+
ty::ty_class(did, ref substs) => {
809809
let tcx = bcx.tcx();
810810
match ty::ty_dtor(tcx, did) {
811811
some(dtor) => {
@@ -1081,7 +1081,7 @@ fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
10811081
}
10821082
return next_cx;
10831083
}
1084-
ty::ty_class(did, substs) => {
1084+
ty::ty_class(did, ref substs) => {
10851085
// Take the drop bit into account
10861086
let classptr = if is_some(ty::ty_dtor(cx.tcx(), did)) {
10871087
GEPi(cx, av, ~[0u, 1u])
@@ -1821,7 +1821,7 @@ fn autoderef(cx: block, e_id: ast::node_id,
18211821
t1 = mt.ty;
18221822
v1 = v;
18231823
}
1824-
ty::ty_enum(did, substs) => {
1824+
ty::ty_enum(did, ref substs) => {
18251825
let variants = ty::enum_variants(ccx.tcx, did);
18261826
if (*variants).len() != 1u || variants[0].args.len() != 1u {
18271827
break;
@@ -2034,7 +2034,7 @@ fn normalize_for_monomorphization(tcx: ty::ctxt, ty: ty::t) -> option<ty::t> {
20342034
ty::ty_box(mt) => {
20352035
some(ty::mk_opaque_box(tcx))
20362036
}
2037-
ty::ty_fn(fty) => {
2037+
ty::ty_fn(ref fty) => {
20382038
some(ty::mk_fn(tcx, {purity: ast::impure_fn,
20392039
proto: fty.proto,
20402040
bounds: @~[],
@@ -2562,7 +2562,7 @@ fn trans_rec_field_inner(bcx: block, val: ValueRef, ty: ty::t,
25622562
let mut llderef = false;
25632563
let fields = match ty::get(ty).struct {
25642564
ty::ty_rec(fs) => fs,
2565-
ty::ty_class(did, substs) => {
2565+
ty::ty_class(did, ref substs) => {
25662566
if option::is_some(ty::ty_dtor(bcx.tcx(), did)) {
25672567
llderef = true;
25682568
}
@@ -3505,7 +3505,7 @@ fn trans_struct(block_context: block, span: span, fields: ~[ast::field],
35053505
// Get the class ID and its fields.
35063506
let class_fields, class_id, substitutions;
35073507
match ty::get(struct_type).struct {
3508-
ty::ty_class(existing_class_id, existing_substitutions) => {
3508+
ty::ty_class(existing_class_id, ref existing_substitutions) => {
35093509
class_id = existing_class_id;
35103510
substitutions = existing_substitutions;
35113511
class_fields = ty::lookup_class_fields(type_context, class_id);
@@ -4858,8 +4858,9 @@ fn trans_class_ctor(ccx: @crate_ctxt, path: path, decl: ast::fn_decl,
48584858
else { selfptr };
48594859

48604860
// initialize fields to zero
4861+
let dsubsts = dummy_substs(psubsts.tys);
48614862
let fields = ty::class_items_as_mutable_fields(bcx_top.tcx(), parent_id,
4862-
dummy_substs(psubsts.tys));
4863+
&dsubsts);
48634864
let mut bcx = bcx_top;
48644865
// Initialize fields to zero so init assignments can validly
48654866
// drop their LHS

src/rustc/middle/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
158158
let (bt, bv) = const_autoderef(cx, bt, bv);
159159
let fields = match ty::get(bt).struct {
160160
ty::ty_rec(fs) => fs,
161-
ty::ty_class(did, substs) =>
161+
ty::ty_class(did, ref substs) =>
162162
ty::class_items_as_mutable_fields(cx.tcx, did, substs),
163163
_ => cx.sess.span_bug(e.span,
164164
~"field access on unknown type in const"),

src/rustc/middle/trans/reflect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl reflector {
221221
self.visit(~"leave_fn", extra);
222222
}
223223

224-
ty::ty_class(did, substs) => {
224+
ty::ty_class(did, ref substs) => {
225225
let bcx = self.bcx;
226226
let tcx = bcx.ccx().tcx;
227227
let fields = ty::class_items_as_fields(tcx, did, substs);
@@ -241,7 +241,7 @@ impl reflector {
241241
// not ideal. It'll work but will get costly on big enums. Maybe
242242
// let the visitor tell us if it wants to visit only a particular
243243
// variant?
244-
ty::ty_enum(did, substs) => {
244+
ty::ty_enum(did, ref substs) => {
245245
let bcx = self.bcx;
246246
let tcx = bcx.ccx().tcx;
247247
let variants = ty::substd_enum_variants(tcx, did, substs);

src/rustc/middle/trans/shape.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] {
324324
s
325325
}
326326
ty::ty_trait(_, _) => ~[shape_box_fn],
327-
ty::ty_class(did, substs) => {
327+
ty::ty_class(did, ref substs) => {
328328
// same as records, unless there's a dtor
329329
let tps = substs.tps;
330330
let m_dtor_did = ty::ty_dtor(ccx.tcx, did);
@@ -378,7 +378,7 @@ fn gen_enum_shapes(ccx: @crate_ctxt) -> ValueRef {
378378
let mut enum_variants = ~[];
379379
while i < ccx.shape_cx.tag_order.len() {
380380
let {did, substs} = ccx.shape_cx.tag_order[i];
381-
let variants = @ty::substd_enum_variants(ccx.tcx, did, substs);
381+
let variants = @ty::substd_enum_variants(ccx.tcx, did, &substs);
382382
do vec::iter(*variants) |v| {
383383
offsets += ~[vec::len(data) as u16];
384384

@@ -678,7 +678,7 @@ fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
678678
fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
679679
if cx.enum_sizes.contains_key(t) { return cx.enum_sizes.get(t); }
680680
match ty::get(t).struct {
681-
ty::ty_enum(tid, substs) => {
681+
ty::ty_enum(tid, ref substs) => {
682682
// Compute max(variant sizes).
683683
let mut max_size = 0u;
684684
let variants = ty::enum_variants(cx.tcx, tid);
@@ -723,7 +723,7 @@ fn simplify_type(tcx: ty::ctxt, typ: ty::t) -> ty::t {
723723
}
724724
// Reduce a class type to a record type in which all the fields are
725725
// simplified
726-
ty::ty_class(did, substs) => {
726+
ty::ty_class(did, ref substs) => {
727727
let simpl_fields = (if is_some(ty::ty_dtor(tcx, did)) {
728728
// remember the drop flag
729729
~[{ident: @~"drop", mt: {ty:

src/rustc/middle/trans/type_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
179179
ty::ty_enum(did, _) => {
180180
fill_type_of_enum(cx, did, t, llty);
181181
}
182-
ty::ty_class(did, ts) => {
182+
ty::ty_class(did, ref substs) => {
183183
// Only instance vars are record fields at runtime.
184184
let fields = ty::lookup_class_fields(cx.tcx, did);
185185
let mut tys = do vec::map(fields) |f| {
186-
let t = ty::lookup_field_type(cx.tcx, did, f.id, ts);
186+
let t = ty::lookup_field_type(cx.tcx, did, f.id, substs);
187187
type_of(cx, t)
188188
};
189189

src/rustc/middle/trans/type_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
140140
let seen = @cons(did, enums_seen);
141141
for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| {
142142
for vec::each(v.args) |aty| {
143-
let t = ty::subst(cx.ccx.tcx, substs, aty);
143+
let t = ty::subst(cx.ccx.tcx, &substs, aty);
144144
type_needs_inner(cx, use, t, seen);
145145
}
146146
}

0 commit comments

Comments
 (0)