librustc: Fix unconditional ty_to_str call in ty.rs. Was heaviest path in allocation. Negligible perf win. rs=perf-fix

This commit is contained in:
Patrick Walton 2013-01-05 18:41:22 -08:00
parent 6c18c75f2d
commit 1070cc0109

View File

@ -1606,11 +1606,18 @@ fn subst(cx: ctxt,
fold_regions_and_ty(
cx, typ,
|r| match r {
re_bound(br_self) => substs.self_r.expect(
fmt!("ty::subst: \
Reference to self region when given substs with no \
self region, ty = %s",
::util::ppaux::ty_to_str(cx, typ))),
re_bound(br_self) => {
match substs.self_r {
None => {
cx.sess.bug(
fmt!("ty::subst: \
Reference to self region when given substs \
with no self region, ty = %s",
::util::ppaux::ty_to_str(cx, typ)))
}
Some(self_r) => self_r
}
}
_ => r
},
|t| do_subst(cx, substs, t),