Skip to content

Commit cae2524

Browse files
committed
---
yaml --- r: 4053 b: refs/heads/master c: f8bb5a3 h: refs/heads/master i: 4051: d981446 v: v3
1 parent 2705d47 commit cae2524

File tree

4 files changed

+46
-51
lines changed

4 files changed

+46
-51
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: a9a1392b2c1fece9447a2b834896b4316c5dbfff
2+
refs/heads/master: f8bb5a3b580da660e2f55f0701a06798581c56ae

trunk/src/comp/driver/rustc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn compile_input(session::session sess, ast::crate_cfg cfg, str input,
143143
bind middle::tstate::ck::check_crate(ty_cx, crate));
144144
}
145145
time(time_passes, "alias checking",
146-
bind middle::alias::check_crate(@ty_cx, crate));
146+
bind middle::alias::check_crate(ty_cx, crate));
147147
auto llmod =
148148
time[llvm::llvm::ModuleRef](time_passes, "translation",
149149
bind trans::trans_crate

trunk/src/comp/middle/alias.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ type scope = @restrict[];
3636

3737
tag local_info { arg(ast::mode); objfield(ast::mutability); }
3838

39-
type ctx = rec(@ty::ctxt tcx,
39+
type ctx = rec(ty::ctxt tcx,
4040
std::map::hashmap[node_id, local_info] local_map);
4141

42-
fn check_crate(@ty::ctxt tcx, &@ast::crate crate) {
42+
fn check_crate(ty::ctxt tcx, &@ast::crate crate) {
4343
auto cx = @rec(tcx=tcx,
4444
// Stores information about object fields and function
4545
// arguments that's otherwise not easily available.
@@ -149,7 +149,7 @@ fn visit_decl(&@ctx cx, &@ast::decl d, &scope sc, &vt[scope] v) {
149149

150150
fn check_call(&ctx cx, &@ast::expr f, &(@ast::expr)[] args, &scope sc) ->
151151
rec(node_id[] root_vars, ty::t[] unsafe_ts) {
152-
auto fty = ty::expr_ty(*cx.tcx, f);
152+
auto fty = ty::expr_ty(cx.tcx, f);
153153
auto arg_ts = fty_args(cx, fty);
154154
let node_id[] roots = ~[];
155155
let tup(uint, node_id)[] mut_roots = ~[];
@@ -248,7 +248,7 @@ fn check_tail_call(&ctx cx, &@ast::expr call) {
248248
case (ast::expr_call(?f, ?args_)) { args = args_; f }
249249
};
250250
auto i = 0u;
251-
for (ty::arg arg_t in fty_args(cx, ty::expr_ty(*cx.tcx, f))) {
251+
for (ty::arg arg_t in fty_args(cx, ty::expr_ty(cx.tcx, f))) {
252252
if (arg_t.mode != ty::mo_val) {
253253
auto mut_a = arg_t.mode == ty::mo_alias(true);
254254
auto ok = true;
@@ -354,15 +354,15 @@ fn check_for(&ctx cx, &@ast::local local, &@ast::expr seq, &ast::block block,
354354
auto unsafe = alt (inner_mut(root.ds)) { some(?t) { ~[t] } _ { ~[] } };
355355

356356
// If this is a mutable vector, don't allow it to be touched.
357-
auto seq_t = ty::expr_ty(*cx.tcx, seq);
358-
alt (ty::struct(*cx.tcx, seq_t)) {
357+
auto seq_t = ty::expr_ty(cx.tcx, seq);
358+
alt (ty::struct(cx.tcx, seq_t)) {
359359
ty::ty_vec(?mt) | ty::ty_ivec(?mt) {
360360
if (mt.mut != ast::imm) { unsafe = ~[seq_t]; }
361361
}
362362
ty::ty_str | ty::ty_istr { /* no-op */ }
363363
_ {
364364
cx.tcx.sess.span_unimpl(seq.span, "unknown seq type " +
365-
util::ppaux::ty_to_str(*cx.tcx, seq_t));
365+
util::ppaux::ty_to_str(cx.tcx, seq_t));
366366
}
367367
}
368368
auto new_sc =
@@ -380,7 +380,7 @@ fn check_var(&ctx cx, &@ast::expr ex, &ast::path p, ast::node_id id,
380380
auto def = cx.tcx.def_map.get(id);
381381
if (!def_is_local(def, true)) { ret; }
382382
auto my_defnum = ast::def_id_of_def(def)._1;
383-
auto var_t = ty::expr_ty(*cx.tcx, ex);
383+
auto var_t = ty::expr_ty(cx.tcx, ex);
384384
for (restrict r in *sc) {
385385
// excludes variables introduced since the alias was made
386386
if (my_defnum < r.block_defnum) {
@@ -523,7 +523,7 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
523523
rec(@ast::expr ex, @deref[] ds) {
524524
fn maybe_auto_unbox(&ctx cx, &ty::t t) ->
525525
rec(ty::t t, option::t[deref] d) {
526-
alt (ty::struct(*cx.tcx, t)) {
526+
alt (ty::struct(cx.tcx, t)) {
527527
case (ty::ty_box(?mt)) {
528528
ret rec(t=mt.ty,
529529
d=some(@rec(mut=mt.mut != ast::imm,
@@ -541,9 +541,9 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
541541
alt ({ ex.node }) {
542542
case (ast::expr_field(?base, ?ident)) {
543543
auto auto_unbox =
544-
maybe_auto_unbox(cx, ty::expr_ty(*cx.tcx, base));
544+
maybe_auto_unbox(cx, ty::expr_ty(cx.tcx, base));
545545
auto mut = false;
546-
alt (ty::struct(*cx.tcx, auto_unbox.t)) {
546+
alt (ty::struct(cx.tcx, auto_unbox.t)) {
547547
case (ty::ty_tup(?fields)) {
548548
auto fnm = ty::field_num(cx.tcx.sess, ex.span, ident);
549549
mut = fields.(fnm).mut != ast::imm;
@@ -564,8 +564,8 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
564564
}
565565
case (ast::expr_index(?base, _)) {
566566
auto auto_unbox =
567-
maybe_auto_unbox(cx, ty::expr_ty(*cx.tcx, base));
568-
alt (ty::struct(*cx.tcx, auto_unbox.t)) {
567+
maybe_auto_unbox(cx, ty::expr_ty(cx.tcx, base));
568+
alt (ty::struct(cx.tcx, auto_unbox.t)) {
569569
case (ty::ty_vec(?mt)) {
570570
ds += ~[@rec(mut=mt.mut != ast::imm,
571571
kind=index,
@@ -582,9 +582,9 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
582582
}
583583
case (ast::expr_unary(?op, ?base)) {
584584
if (op == ast::deref) {
585-
auto base_t = ty::expr_ty(*cx.tcx, base);
585+
auto base_t = ty::expr_ty(cx.tcx, base);
586586
auto mut = false;
587-
alt (ty::struct(*cx.tcx, base_t)) {
587+
alt (ty::struct(cx.tcx, base_t)) {
588588
case (ty::ty_box(?mt)) { mut = mt.mut != ast::imm; }
589589
case (ty::ty_res(_, _, _)) {}
590590
case (ty::ty_tag(_, _)) {}
@@ -598,7 +598,7 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
598598
}
599599
}
600600
if (autoderef) {
601-
auto auto_unbox = maybe_auto_unbox(cx, ty::expr_ty(*cx.tcx, ex));
601+
auto auto_unbox = maybe_auto_unbox(cx, ty::expr_ty(cx.tcx, ex));
602602
maybe_push_auto_unbox(auto_unbox.d, ds);
603603
}
604604
ret rec(ex=ex, ds=@ds);
@@ -669,7 +669,7 @@ fn ty_can_unsafely_include(&ctx cx, ty::t needle, ty::t haystack, bool mut) ->
669669
_ { ret false; }
670670
}
671671
}
672-
ret helper(*cx.tcx, needle, haystack, mut);
672+
ret helper(cx.tcx, needle, haystack, mut);
673673
}
674674

675675
fn def_is_local(&ast::def d, bool objfields_count) -> bool {
@@ -681,7 +681,7 @@ fn def_is_local(&ast::def d, bool objfields_count) -> bool {
681681
}
682682

683683
fn fty_args(&ctx cx, ty::t fty) -> ty::arg[] {
684-
ret alt (ty::struct(*cx.tcx, ty::type_autoderef(*cx.tcx, fty))) {
684+
ret alt (ty::struct(cx.tcx, ty::type_autoderef(cx.tcx, fty))) {
685685
ty::ty_fn(_, ?args, _, _, _) | ty::ty_native_fn(_, ?args, _) { args }
686686
};
687687
}

trunk/src/comp/middle/ty.rs

+26-31
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,20 @@ type mt = rec(t ty, ast::mutability mut);
207207
type creader_cache = hashmap[tup(int, uint, uint), ty::t];
208208

209209
type ctxt =
210-
rec(@type_store ts,
211-
session::session sess,
212-
resolve::def_map def_map,
213-
node_type_table node_types,
214-
ast_map::map items,
215-
freevars::freevar_map freevars,
216-
217-
// constr_table fn_constrs,
218-
type_cache tcache,
219-
creader_cache rcache,
220-
hashmap[t, str] short_names_cache,
221-
hashmap[t, bool] has_pointer_cache,
222-
hashmap[t, bool] owns_heap_mem_cache,
223-
hashmap[@ast::ty, option::t[t]] ast_ty_to_ty_cache);
210+
@rec(@type_store ts,
211+
session::session sess,
212+
resolve::def_map def_map,
213+
node_type_table node_types,
214+
ast_map::map items,
215+
freevars::freevar_map freevars,
216+
217+
// constr_table fn_constrs,
218+
type_cache tcache,
219+
creader_cache rcache,
220+
hashmap[t, str] short_names_cache,
221+
hashmap[t, bool] has_pointer_cache,
222+
hashmap[t, bool] owns_heap_mem_cache,
223+
hashmap[@ast::ty, option::t[t]] ast_ty_to_ty_cache);
224224

225225
type ty_ctxt = ctxt;
226226

@@ -405,23 +405,18 @@ fn mk_ctxt(session::session s, resolve::def_map dm,
405405
auto tcache = new_def_hash[ty::ty_param_count_and_ty]();
406406
auto ts = @interner::mk[@raw_t](hash_raw_ty, eq_raw_ty);
407407
auto cx =
408-
rec(ts=ts,
409-
sess=s,
410-
def_map=dm,
411-
node_types=ntt,
412-
items=amap,
413-
freevars=freevars,
414-
tcache=tcache,
415-
rcache=mk_rcache(),
416-
short_names_cache=map::mk_hashmap[ty::t,
417-
str](ty::hash_ty, ty::eq_ty),
418-
has_pointer_cache=map::mk_hashmap[ty::t,
419-
bool](ty::hash_ty, ty::eq_ty),
420-
owns_heap_mem_cache=map::mk_hashmap[ty::t,
421-
bool](ty::hash_ty, ty::eq_ty),
422-
ast_ty_to_ty_cache=map::mk_hashmap[@ast::ty,
423-
option::t[t]](ast::hash_ty,
424-
ast::eq_ty));
408+
@rec(ts=ts,
409+
sess=s,
410+
def_map=dm,
411+
node_types=ntt,
412+
items=amap,
413+
freevars=freevars,
414+
tcache=tcache,
415+
rcache=mk_rcache(),
416+
short_names_cache=map::mk_hashmap(ty::hash_ty, ty::eq_ty),
417+
has_pointer_cache=map::mk_hashmap(ty::hash_ty, ty::eq_ty),
418+
owns_heap_mem_cache=map::mk_hashmap(ty::hash_ty, ty::eq_ty),
419+
ast_ty_to_ty_cache=map::mk_hashmap(ast::hash_ty, ast::eq_ty));
425420
populate_type_store(cx);
426421
ret cx;
427422
}

0 commit comments

Comments
 (0)