Skip to content

Commit 67d17fe

Browse files
committed
---
yaml --- r: 15643 b: refs/heads/try c: 3a3a7fc h: refs/heads/master i: 15641: 4f3ab44 15639: 94ed430 v: v3
1 parent dffec18 commit 67d17fe

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: df0ef528b9ed22cad874f780b988aa8f32aac376
5+
refs/heads/try: 3a3a7fc426dafa8d38341fac6ab92cd49d3de526
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/middle/ty.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ type ctxt =
227227
iface_method_cache: hashmap<def_id, @[method]>,
228228
ty_param_bounds: hashmap<ast::node_id, param_bounds>,
229229
inferred_modes: hashmap<ast::node_id, ast::mode>,
230-
borrowings: hashmap<ast::node_id, ()>};
230+
borrowings: hashmap<ast::node_id, ()>,
231+
normalized_cache: hashmap<t, t>};
231232

232233
type t_box = @{struct: sty,
233234
id: uint,
@@ -461,7 +462,8 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map,
461462
iface_method_cache: new_def_hash(),
462463
ty_param_bounds: map::int_hash(),
463464
inferred_modes: map::int_hash(),
464-
borrowings: map::int_hash()}
465+
borrowings: map::int_hash(),
466+
normalized_cache: new_ty_hash()}
465467
}
466468

467469

@@ -2680,6 +2682,11 @@ fn ty_params_to_tys(tcx: ty::ctxt, tps: [ast::ty_param]) -> [t] {
26802682
Returns an equivalent type with all the typedefs and self regions removed.
26812683
"]
26822684
fn normalize_ty(cx: ctxt, t: t) -> t {
2685+
alt cx.normalized_cache.find(t) {
2686+
some(t) { ret t; }
2687+
none { }
2688+
}
2689+
26832690
let t = alt get(t).struct {
26842691
ty_enum(did, r) {
26852692
alt r.self_r {
@@ -2698,7 +2705,9 @@ fn normalize_ty(cx: ctxt, t: t) -> t {
26982705
let t = mk_t(cx, mach_sty(cx.sess.targ_cfg, t));
26992706

27002707
let sty = fold_sty(get(t).struct) {|t| normalize_ty(cx, t) };
2701-
mk_t(cx, sty)
2708+
let t_norm = mk_t(cx, sty);
2709+
cx.normalized_cache.insert(t, t_norm);
2710+
ret t_norm;
27022711
}
27032712

27042713
// Local Variables:

0 commit comments

Comments
 (0)