Skip to content

Commit 16f6a2d

Browse files
committed
---
yaml --- r: 4822 b: refs/heads/master c: 031529e h: refs/heads/master v: v3
1 parent e2112b9 commit 16f6a2d

File tree

6 files changed

+46
-65
lines changed

6 files changed

+46
-65
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: e7c8019dd9889e1736b075d1b205f8b118b286b3
2+
refs/heads/master: 031529e3fe34267168a43cf74dbdd9e41f12ac43

trunk/src/comp/driver/rustc.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
143143
bind middle::ast_map::map_crate(*crate));
144144
time(time_passes, "external crate/lib resolution",
145145
bind creader::read_crates(sess, *crate));
146-
let {def_map, ext_map} =
146+
let d =
147147
time(time_passes, "resolution",
148148
bind resolve::resolve_crate(sess, ast_map, crate));
149149
let freevars =
150150
time(time_passes, "freevar finding",
151-
bind freevars::annotate_freevars(sess, def_map, crate));
152-
let ty_cx = ty::mk_ctxt(sess, def_map, ext_map, ast_map, freevars);
151+
bind freevars::annotate_freevars(sess, d, crate));
152+
let ty_cx = ty::mk_ctxt(sess, d, ast_map, freevars);
153153
time::<()>(time_passes, "typechecking",
154154
bind typeck::check_crate(ty_cx, crate));
155155
time::<()>(time_passes, "alt checking",
@@ -222,9 +222,9 @@ fn pretty_print_input(sess: session::session, cfg: ast::crate_cfg, input: str,
222222
alt ppm {
223223
ppm_typed. {
224224
let amap = middle::ast_map::map_crate(*crate);
225-
let {def_map, ext_map} = resolve::resolve_crate(sess, amap, crate);
226-
let freevars = freevars::annotate_freevars(sess, def_map, crate);
227-
let ty_cx = ty::mk_ctxt(sess, def_map, ext_map, amap, freevars);
225+
let d = resolve::resolve_crate(sess, amap, crate);
226+
let freevars = freevars::annotate_freevars(sess, d, crate);
227+
let ty_cx = ty::mk_ctxt(sess, d, amap, freevars);
228228
typeck::check_crate(ty_cx, crate);
229229
ann = {pre: ann_paren_for_expr, post: bind ann_typed_post(ty_cx, _)};
230230
}

trunk/src/comp/middle/resolve.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import syntax::print::pprust::*;
3636

3737
export resolve_crate;
3838
export def_map;
39-
export ext_map;
4039

4140
// Resolving happens in two passes. The first pass collects defids of all
4241
// (internal) imports and modules, so that they can be looked up when needed,
@@ -114,7 +113,6 @@ type indexed_mod =
114113
only need to look at them to determine exports, which they can't control.*/
115114

116115
type def_map = hashmap<node_id, def>;
117-
type ext_map = hashmap<def_id, [ident]>;
118116

119117
type env =
120118
{cstore: cstore::cstore,
@@ -135,7 +133,7 @@ tag dir { inside; outside; }
135133
tag namespace { ns_value; ns_type; ns_module; }
136134

137135
fn resolve_crate(sess: session, amap: &ast_map::map, crate: @ast::crate) ->
138-
{def_map: def_map, ext_map: ext_map} {
136+
def_map {
139137
let e =
140138
@{cstore: sess.get_cstore(),
141139
def_map: new_int_hash::<def>(),
@@ -150,7 +148,7 @@ fn resolve_crate(sess: session, amap: &ast_map::map, crate: @ast::crate) ->
150148
resolve_imports(*e);
151149
check_for_collisions(e, *crate);
152150
resolve_names(e, crate);
153-
ret {def_map: e.def_map, ext_map: e.ext_map};
151+
ret e.def_map;
154152
}
155153

156154

trunk/src/comp/middle/trans.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5626,7 +5626,9 @@ fn alloc_ty(cx: &@block_ctxt, t: &ty::t) -> result {
56265626
// past caller conventions and may well make sense again,
56275627
// so we leave it as-is.
56285628

5629-
bcx = gc::add_gc_root(bcx, val, t);
5629+
if (bcx_tcx(cx).sess.get_opts().do_gc) {
5630+
bcx = gc::add_gc_root(bcx, val, t);
5631+
}
56305632

56315633
ret rslt(cx, val);
56325634
}

trunk/src/comp/middle/ty.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,6 @@ type ctxt =
212212
@{ts: @type_store,
213213
sess: session::session,
214214
def_map: resolve::def_map,
215-
// We need the ext_map just for printing the types of tags defined in
216-
// other crates. Once we get cnames back it should go.
217-
ext_map: resolve::ext_map,
218215
node_types: node_type_table,
219216
items: ast_map::map,
220217
freevars: freevars::freevar_map,
@@ -395,8 +392,7 @@ fn mk_rcache() -> creader_cache {
395392
}
396393

397394

398-
fn mk_ctxt(s: session::session, dm: resolve::def_map,
399-
em: hashmap<def_id, [ident]>, amap: ast_map::map,
395+
fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map,
400396
freevars: freevars::freevar_map) -> ctxt {
401397
let ntt: node_type_table =
402398
@smallintmap::mk::<ty::ty_param_substs_opt_and_ty>();
@@ -406,7 +402,6 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map,
406402
@{ts: ts,
407403
sess: s,
408404
def_map: dm,
409-
ext_map: em,
410405
node_types: ntt,
411406
items: amap,
412407
freevars: freevars,
@@ -1071,13 +1066,6 @@ fn type_kind(cx: &ctxt, ty: &t) -> ast::kind {
10711066
if result == ast::kind_pinned { break; }
10721067
}
10731068
}
1074-
// Tuples lower to the lowest of their members.
1075-
ty_tup(tys) {
1076-
for ty: t in tys {
1077-
result = kind::lower_kind(result, type_kind(cx, ty));
1078-
if result == ast::kind_pinned { break; }
1079-
}
1080-
}
10811069

10821070
// Tags lower to the lowest of their variants.
10831071
ty_tag(did, tps) {

trunk/src/comp/util/ppaux.rs

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import pp::zerobreak;
1818
import pp::hardbreak;
1919
import ast::ty_mach_to_str;
2020
import syntax::ast;
21-
import middle::ast_map;
22-
import metadata::csearch;
2321

2422
fn mode_str(m: &ty::mode) -> str {
2523
alt m {
@@ -37,17 +35,6 @@ fn fn_ident_to_string(id: ast::node_id, i: &ast::fn_ident) -> str {
3735
ret alt i { none. { "anon" + int::str(id) } some(s) { s } };
3836
}
3937

40-
fn get_id_ident(cx: &ctxt, id: ast::def_id) -> str {
41-
if (id.crate != ast::local_crate) {
42-
str::connect(cx.ext_map.get(id), "::")
43-
} else {
44-
alt cx.items.find(id.node) {
45-
some(ast_map::node_item(it)) { it.ident }
46-
_ { fail "get_id_ident: can't find item in ast_map" }
47-
}
48-
}
49-
}
50-
5138
fn ty_to_str(cx: &ctxt, typ: &t) -> str {
5239
fn fn_input_to_str(cx: &ctxt, input: &{mode: middle::ty::mode, ty: t}) ->
5340
str {
@@ -90,61 +77,67 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> str {
9077
ret mstr + ty_to_str(cx, m.ty);
9178
}
9279
alt cname(cx, typ) { some(cs) { ret cs; } _ { } }
93-
ret alt struct(cx, typ) {
94-
ty_native(_) { "native" }
95-
ty_nil. { "()" }
96-
ty_bot. { "_|_" }
97-
ty_bool. { "bool" }
98-
ty_int. { "int" }
99-
ty_float. { "float" }
100-
ty_uint. { "uint" }
101-
ty_machine(tm) { ty_mach_to_str(tm) }
102-
ty_char. { "char" }
103-
ty_str. { "str" }
104-
ty_istr. { "istr" }
105-
ty_box(tm) { "@" + mt_to_str(cx, tm) }
106-
ty_uniq(t) { "~" + ty_to_str(cx, t) }
107-
ty_vec(tm) { "[" + mt_to_str(cx, tm) + "]" }
108-
ty_type. { "type" }
80+
let s = "";
81+
alt struct(cx, typ) {
82+
ty_native(_) { s += "native"; }
83+
ty_nil. { s += "()"; }
84+
ty_bot. { s += "_|_"; }
85+
ty_bool. { s += "bool"; }
86+
ty_int. { s += "int"; }
87+
ty_float. { s += "float"; }
88+
ty_uint. { s += "uint"; }
89+
ty_machine(tm) { s += ty_mach_to_str(tm); }
90+
ty_char. { s += "char"; }
91+
ty_str. { s += "str"; }
92+
ty_istr. { s += "istr"; }
93+
ty_box(tm) { s += "@" + mt_to_str(cx, tm); }
94+
ty_uniq(t) { s += "~" + ty_to_str(cx, t); }
95+
ty_vec(tm) { s += "[" + mt_to_str(cx, tm) + "]"; }
96+
ty_type. { s += "type"; }
10997
ty_rec(elems) {
11098
let strs: [str] = ~[];
11199
for fld: field in elems { strs += ~[field_to_str(cx, fld)]; }
112-
"{" + str::connect(strs, ",") + "}"
100+
s += "{" + str::connect(strs, ",") + "}";
113101
}
114102
ty_tup(elems) {
115103
let strs = ~[];
116104
for elem in elems { strs += ~[ty_to_str(cx, elem)]; }
117-
"(" + str::connect(strs, ",") + ")"
105+
s += "(" + str::connect(strs, ",") + ")";
118106
}
119107
ty_tag(id, tps) {
120-
let s = get_id_ident(cx, id);
108+
// The user should never see this if the cname is set properly!
109+
110+
s += "<tag#" + int::str(id.crate) + ":" + int::str(id.node) + ">";
121111
if vec::len::<t>(tps) > 0u {
122112
let strs: [str] = ~[];
123113
for typ: t in tps { strs += ~[ty_to_str(cx, typ)]; }
124114
s += "[" + str::connect(strs, ",") + "]";
125115
}
126-
s
127116
}
128117
ty_fn(proto, inputs, output, cf, constrs) {
129-
fn_to_str(cx, proto, none, inputs, output, cf, constrs)
118+
s += fn_to_str(cx, proto, none, inputs, output, cf, constrs);
130119
}
131120
ty_native_fn(_, inputs, output) {
132-
fn_to_str(cx, ast::proto_fn, none, inputs, output, ast::return, ~[])
121+
s +=
122+
fn_to_str(cx, ast::proto_fn, none, inputs, output, ast::return,
123+
~[]);
133124
}
134125
ty_obj(meths) {
135126
let strs = ~[];
136127
for m: method in meths { strs += ~[method_to_str(cx, m)]; }
137-
"obj {\n\t" + str::connect(strs, "\n\t") + "\n}"
128+
s += "obj {\n\t" + str::connect(strs, "\n\t") + "\n}";
138129
}
139130
ty_res(id, _, _) {
140-
get_id_ident(cx, id)
131+
s +=
132+
"<resource#" + int::str(id.node) + ":" + int::str(id.crate) + ">";
141133
}
142-
ty_var(v) { "<T" + int::str(v) + ">" }
134+
ty_var(v) { s += "<T" + int::str(v) + ">"; }
143135
ty_param(id,_) {
144-
"'" + str::unsafe_from_bytes(~[('a' as u8) + (id as u8)])
136+
s += "'" + str::unsafe_from_bytes(~[('a' as u8) + (id as u8)]);
145137
}
146-
_ { ty_to_short_str(cx, typ) }
138+
_ { s += ty_to_short_str(cx, typ); }
147139
}
140+
ret s;
148141
}
149142

150143
fn ty_to_short_str(cx: &ctxt, typ: t) -> str {

0 commit comments

Comments
 (0)