]> git.lizzy.rs Git - rust.git/commitdiff
Eliminate an unchecked use of map::get in ppaux
authorTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 30 Aug 2011 23:19:52 +0000 (16:19 -0700)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 30 Aug 2011 23:19:52 +0000 (16:19 -0700)
src/comp/util/ppaux.rs

index 667a0f27fb8b8374c5d9edcac190d59f5a7ca49a..f1dd5c4a278c3b31a70aaa16f3c3a9c6718f2e0e 100644 (file)
@@ -44,7 +44,11 @@ fn fn_ident_to_string(id: ast::node_id, i: &ast::fn_ident) -> istr {
 
 fn get_id_ident(cx: &ctxt, id: ast::def_id) -> istr {
     if id.crate != ast::local_crate {
-        istr::connect(cx.ext_map.get(id), ~"::")
+        alt cx.ext_map.find(id) {
+          some(j) { istr::connect(j, ~"::") }
+          _ { fail ("get_id_ident: can't find item in ext_map, id.crate = "
+                    + istr::to_estr(int::str(id.crate))) }
+        }
     } else {
         alt cx.items.find(id.node) {
           some(ast_map::node_item(it)) { it.ident }