@@ -453,7 +453,7 @@ impl<'hir> Map<'hir> {
453453 pub fn body_owned_by ( & self , id : HirId ) -> BodyId {
454454 self . maybe_body_owned_by ( id) . unwrap_or_else ( || {
455455 span_bug ! ( self . span( id) , "body_owned_by: {} has no associated body" ,
456- self . hir_to_string ( id) ) ;
456+ self . node_to_string ( id) ) ;
457457 } )
458458 }
459459
@@ -486,7 +486,7 @@ impl<'hir> Map<'hir> {
486486 Node :: Item ( & Item { node : ItemKind :: Trait ( ..) , .. } ) |
487487 Node :: Item ( & Item { node : ItemKind :: TraitAlias ( ..) , .. } ) => id,
488488 Node :: GenericParam ( _) => self . get_parent_node_by_hir_id ( id) ,
489- _ => bug ! ( "ty_param_owner: {} not a type parameter" , self . hir_to_string ( id) )
489+ _ => bug ! ( "ty_param_owner: {} not a type parameter" , self . node_to_string ( id) )
490490 }
491491 }
492492
@@ -495,7 +495,7 @@ impl<'hir> Map<'hir> {
495495 Node :: Item ( & Item { node : ItemKind :: Trait ( ..) , .. } ) |
496496 Node :: Item ( & Item { node : ItemKind :: TraitAlias ( ..) , .. } ) => kw:: SelfUpper ,
497497 Node :: GenericParam ( param) => param. name . ident ( ) . name ,
498- _ => bug ! ( "ty_param_name: {} not a type parameter" , self . hir_to_string ( id) ) ,
498+ _ => bug ! ( "ty_param_name: {} not a type parameter" , self . node_to_string ( id) ) ,
499499 }
500500 }
501501
@@ -874,27 +874,27 @@ impl<'hir> Map<'hir> {
874874 return nm. abi ;
875875 }
876876 }
877- bug ! ( "expected foreign mod or inlined parent, found {}" , self . hir_to_string ( parent) )
877+ bug ! ( "expected foreign mod or inlined parent, found {}" , self . node_to_string ( parent) )
878878 }
879879
880880 pub fn expect_item ( & self , id : HirId ) -> & ' hir Item {
881881 match self . find_by_hir_id ( id) { // read recorded by `find`
882882 Some ( Node :: Item ( item) ) => item,
883- _ => bug ! ( "expected item, found {}" , self . hir_to_string ( id) )
883+ _ => bug ! ( "expected item, found {}" , self . node_to_string ( id) )
884884 }
885885 }
886886
887887 pub fn expect_impl_item ( & self , id : HirId ) -> & ' hir ImplItem {
888888 match self . find_by_hir_id ( id) {
889889 Some ( Node :: ImplItem ( item) ) => item,
890- _ => bug ! ( "expected impl item, found {}" , self . hir_to_string ( id) )
890+ _ => bug ! ( "expected impl item, found {}" , self . node_to_string ( id) )
891891 }
892892 }
893893
894894 pub fn expect_trait_item ( & self , id : HirId ) -> & ' hir TraitItem {
895895 match self . find_by_hir_id ( id) {
896896 Some ( Node :: TraitItem ( item) ) => item,
897- _ => bug ! ( "expected trait item, found {}" , self . hir_to_string ( id) )
897+ _ => bug ! ( "expected trait item, found {}" , self . node_to_string ( id) )
898898 }
899899 }
900900
@@ -904,26 +904,26 @@ impl<'hir> Map<'hir> {
904904 match i. node {
905905 ItemKind :: Struct ( ref struct_def, _) |
906906 ItemKind :: Union ( ref struct_def, _) => struct_def,
907- _ => bug ! ( "struct ID bound to non-struct {}" , self . hir_to_string ( id) )
907+ _ => bug ! ( "struct ID bound to non-struct {}" , self . node_to_string ( id) )
908908 }
909909 }
910910 Some ( Node :: Variant ( variant) ) => & variant. node . data ,
911911 Some ( Node :: Ctor ( data) ) => data,
912- _ => bug ! ( "expected struct or variant, found {}" , self . hir_to_string ( id) )
912+ _ => bug ! ( "expected struct or variant, found {}" , self . node_to_string ( id) )
913913 }
914914 }
915915
916916 pub fn expect_variant ( & self , id : HirId ) -> & ' hir Variant {
917917 match self . find_by_hir_id ( id) {
918918 Some ( Node :: Variant ( variant) ) => variant,
919- _ => bug ! ( "expected variant, found {}" , self . hir_to_string ( id) ) ,
919+ _ => bug ! ( "expected variant, found {}" , self . node_to_string ( id) ) ,
920920 }
921921 }
922922
923923 pub fn expect_foreign_item ( & self , id : HirId ) -> & ' hir ForeignItem {
924924 match self . find_by_hir_id ( id) {
925925 Some ( Node :: ForeignItem ( item) ) => item,
926- _ => bug ! ( "expected foreign item, found {}" , self . hir_to_string ( id) )
926+ _ => bug ! ( "expected foreign item, found {}" , self . node_to_string ( id) )
927927 }
928928 }
929929
@@ -936,7 +936,7 @@ impl<'hir> Map<'hir> {
936936 pub fn expect_expr_by_hir_id ( & self , id : HirId ) -> & ' hir Expr {
937937 match self . find_by_hir_id ( id) { // read recorded by find
938938 Some ( Node :: Expr ( expr) ) => expr,
939- _ => bug ! ( "expected expr, found {}" , self . hir_to_string ( id) )
939+ _ => bug ! ( "expected expr, found {}" , self . node_to_string ( id) )
940940 }
941941 }
942942
@@ -959,7 +959,7 @@ impl<'hir> Map<'hir> {
959959 Node :: GenericParam ( param) => param. name . ident ( ) . name ,
960960 Node :: Binding ( & Pat { node : PatKind :: Binding ( _, _, l, _) , .. } ) => l. name ,
961961 Node :: Ctor ( ..) => self . name_by_hir_id ( self . get_parent_item ( id) ) ,
962- _ => bug ! ( "no name for {}" , self . hir_to_string ( id) )
962+ _ => bug ! ( "no name for {}" , self . node_to_string ( id) )
963963 }
964964 }
965965
@@ -1071,7 +1071,7 @@ impl<'hir> Map<'hir> {
10711071 self . as_local_hir_id ( id) . map ( |id| self . span ( id) )
10721072 }
10731073
1074- pub fn hir_to_string ( & self , id : HirId ) -> String {
1074+ pub fn node_to_string ( & self , id : HirId ) -> String {
10751075 hir_id_to_string ( self , id, true )
10761076 }
10771077
0 commit comments