Reformulate an assert in ty::tag_variants

This was doing a redundant hashmap lookup. Removing the redundancy trims 5%
(2.8s) off rustc's compile time
This commit is contained in:
Brian Anderson 2011-06-26 18:02:47 -07:00
parent cfaa0f4b91
commit 08b49a5d8f
1 changed files with 7 additions and 2 deletions

View File

@ -2702,8 +2702,13 @@ fn tag_variants(&ctxt cx, &ast::def_id id) -> vec[variant_info] {
if (cx.sess.get_targ_crate_num() != id._0) {
ret creader::get_tag_variants(cx, id);
}
assert (cx.items.contains_key(id._1));
alt (cx.items.get(id._1)) {
auto item = alt (cx.items.find(id._1)) {
case (some(?i)) { i }
case (none) {
cx.sess.bug("expected to find cached node_item")
}
};
alt (item) {
case (ast_map::node_item(?item)) {
alt (item.node) {
case (ast::item_tag(?variants, _)) {