mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
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:
parent
cfaa0f4b91
commit
08b49a5d8f
@ -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, _)) {
|
||||
|
Loading…
Reference in New Issue
Block a user