diff options
Diffstat (limited to 'src/librustdoc/tystr_pass.rs')
| -rw-r--r-- | src/librustdoc/tystr_pass.rs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/librustdoc/tystr_pass.rs b/src/librustdoc/tystr_pass.rs index def32bdfd44..12689466c8c 100644 --- a/src/librustdoc/tystr_pass.rs +++ b/src/librustdoc/tystr_pass.rs @@ -63,7 +63,7 @@ fn fold_fn( fn get_fn_sig(srv: astsrv::Srv, fn_id: doc::AstId) -> Option<~str> { do astsrv::exec(srv) |ctxt| { - match *ctxt.ast_map.get(&fn_id) { + match ctxt.ast_map.get_copy(&fn_id) { ast_map::node_item(@ast::item { ident: ident, node: ast::item_fn(ref decl, purity, _, ref tys, _), _ @@ -75,7 +75,7 @@ fn get_fn_sig(srv: astsrv::Srv, fn_id: doc::AstId) -> Option<~str> { Some(pprust::fun_to_str(decl, purity, ident, None, tys, extract::interner())) } - _ => fail!(~"get_fn_sig: fn_id not bound to a fn item") + _ => fail!("get_fn_sig: fn_id not bound to a fn item") } } } @@ -90,13 +90,13 @@ fn fold_const( sig: Some({ let doc = copy doc; do astsrv::exec(srv) |ctxt| { - match *ctxt.ast_map.get(&doc.id()) { + match ctxt.ast_map.get_copy(&doc.id()) { ast_map::node_item(@ast::item { node: ast::item_const(ty, _), _ }, _) => { pprust::ty_to_str(ty, extract::interner()) } - _ => fail!(~"fold_const: id not bound to a const item") + _ => fail!("fold_const: id not bound to a const item") } }}), .. doc @@ -115,7 +115,7 @@ fn fold_enum( let sig = { let variant = copy *variant; do astsrv::exec(srv.clone()) |ctxt| { - match *ctxt.ast_map.get(&doc_id) { + match ctxt.ast_map.get_copy(&doc_id) { ast_map::node_item(@ast::item { node: ast::item_enum(ref enum_definition, _), _ }, _) => { @@ -125,9 +125,9 @@ fn fold_enum( }.get(); pprust::variant_to_str( - ast_variant, extract::interner()) + &ast_variant, extract::interner()) } - _ => fail!(~"enum variant not bound to an enum item") + _ => fail!("enum variant not bound to an enum item") } } }; @@ -170,7 +170,7 @@ fn get_method_sig( method_name: ~str ) -> Option<~str> { do astsrv::exec(srv) |ctxt| { - match *ctxt.ast_map.get(&item_id) { + match ctxt.ast_map.get_copy(&item_id) { ast_map::node_item(@ast::item { node: ast::item_trait(_, _, ref methods), _ }, _) => { @@ -187,7 +187,7 @@ fn get_method_sig( &ty_m.decl, ty_m.purity, ty_m.ident, - Some(ty_m.self_ty.node), + Some(ty_m.explicit_self.node), &ty_m.generics, extract::interner() )) @@ -197,14 +197,14 @@ fn get_method_sig( &m.decl, m.purity, m.ident, - Some(m.self_ty.node), + Some(m.explicit_self.node), &m.generics, extract::interner() )) } } } - _ => fail!(~"method not found") + _ => fail!("method not found") } } ast_map::node_item(@ast::item { @@ -218,15 +218,15 @@ fn get_method_sig( &method.decl, method.purity, method.ident, - Some(method.self_ty.node), + Some(method.explicit_self.node), &method.generics, extract::interner() )) } - None => fail!(~"method not found") + None => fail!("method not found") } } - _ => fail!(~"get_method_sig: item ID not bound to trait or impl") + _ => fail!("get_method_sig: item ID not bound to trait or impl") } } } @@ -241,7 +241,7 @@ fn fold_impl( let (bounds, trait_types, self_ty) = { let doc = copy doc; do astsrv::exec(srv) |ctxt| { - match *ctxt.ast_map.get(&doc.id()) { + match ctxt.ast_map.get_copy(&doc.id()) { ast_map::node_item(@ast::item { node: ast::item_impl(ref generics, opt_trait_type, self_ty, _), _ }, _) => { @@ -255,7 +255,7 @@ fn fold_impl( Some(pprust::ty_to_str( self_ty, extract::interner()))) } - _ => fail!(~"expected impl") + _ => fail!("expected impl") } } }; @@ -280,7 +280,7 @@ fn fold_type( sig: { let doc = copy doc; do astsrv::exec(srv) |ctxt| { - match *ctxt.ast_map.get(&doc.id()) { + match ctxt.ast_map.get_copy(&doc.id()) { ast_map::node_item(@ast::item { ident: ident, node: ast::item_ty(ty, ref params), _ @@ -294,7 +294,7 @@ fn fold_type( extract::interner()) )) } - _ => fail!(~"expected type") + _ => fail!("expected type") } } }, @@ -312,13 +312,13 @@ fn fold_struct( sig: { let doc = copy doc; do astsrv::exec(srv) |ctxt| { - match *ctxt.ast_map.get(&doc.id()) { + match ctxt.ast_map.get_copy(&doc.id()) { ast_map::node_item(item, _) => { let item = strip_struct_extra_stuff(item); Some(pprust::item_to_str(item, extract::interner())) } - _ => fail!(~"not an item") + _ => fail!("not an item") } } }, @@ -333,7 +333,7 @@ fn fold_struct( fn strip_struct_extra_stuff(item: @ast::item) -> @ast::item { let node = match copy item.node { ast::item_struct(def, tys) => ast::item_struct(def, tys), - _ => fail!(~"not a struct") + _ => fail!("not a struct") }; @ast::item { @@ -365,7 +365,7 @@ mod test { #[test] fn should_add_foreign_fn_sig() { - let doc = mk_doc(~"extern mod a { fn a<T>() -> int; }"); + let doc = mk_doc(~"extern { fn a<T>() -> int; }"); assert!(doc.cratemod().nmods()[0].fns[0].sig == Some(~"fn a<T>() -> int")); } @@ -405,7 +405,7 @@ mod test { #[test] fn should_not_add_impl_trait_types_if_none() { let doc = mk_doc(~"impl int { fn a() { } }"); - assert!(vec::len(doc.cratemod().impls()[0].trait_types) == 0); + assert!(doc.cratemod().impls()[0].trait_types.len() == 0); } #[test] |
