LCOV - code coverage report
Current view: top level - gcc/rust/hir/tree - rust-hir.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 39.8 % 2422 964
Test Date: 2026-09-19 16:22:48 Functions: 63.3 % 409 259
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // Copyright (C) 2020-2026 Free Software Foundation, Inc.
       2              : 
       3              : // This file is part of GCC.
       4              : 
       5              : // GCC is free software; you can redistribute it and/or modify it under
       6              : // the terms of the GNU General Public License as published by the Free
       7              : // Software Foundation; either version 3, or (at your option) any later
       8              : // version.
       9              : 
      10              : // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      11              : // WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12              : // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      13              : // for more details.
      14              : 
      15              : // You should have received a copy of the GNU General Public License
      16              : // along with GCC; see the file COPYING3.  If not see
      17              : // <http://www.gnu.org/licenses/>.
      18              : 
      19              : #include "rust-ast-full.h"
      20              : #include "rust-hir-expr.h"
      21              : #include "rust-hir-full.h"
      22              : #include "rust-hir-path.h"
      23              : #include "rust-hir-visitor.h"
      24              : #include "rust-diagnostics.h"
      25              : 
      26              : /* Compilation unit used for various HIR-related functions that would make
      27              :  * the headers too long if they were defined inline and don't receive any
      28              :  * benefits from being defined inline because they are virtual. Also used
      29              :  * for various other stuff. */
      30              : 
      31              : namespace Rust {
      32              : namespace HIR {
      33              : 
      34              : enum indent_mode
      35              : {
      36              :   enter,
      37              :   out,
      38              :   stay
      39              : };
      40              : 
      41              : std::string
      42           36 : indent_spaces (enum indent_mode mode)
      43              : {
      44           36 :   static int indent = 0;
      45           36 :   std::string str = "";
      46           36 :   if (out == mode)
      47           18 :     indent--;
      48           36 :   for (int i = 0; i < indent; i++)
      49            0 :     str += " ";
      50           36 :   if (enter == mode)
      51           18 :     indent++;
      52              : 
      53           36 :   return str;
      54              : }
      55              : 
      56              : // Gets a string in a certain delim type.
      57              : std::string
      58            0 : get_string_in_delims (std::string str_input, AST::DelimType delim_type)
      59              : {
      60            0 :   switch (delim_type)
      61              :     {
      62            0 :     case AST::DelimType::PARENS:
      63            0 :       return "(" + str_input + ")";
      64            0 :     case AST::DelimType::SQUARE:
      65            0 :       return "[" + str_input + "]";
      66            0 :     case AST::DelimType::CURLY:
      67            0 :       return "{" + str_input + "}";
      68            0 :     default:
      69            0 :       return "ERROR-MARK-STRING (delims)";
      70              :     }
      71              :   rust_unreachable ();
      72              : }
      73              : 
      74         4765 : Crate::Crate (std::vector<std::unique_ptr<Item>> items,
      75              :               AST::AttrVec inner_attrs, Analysis::NodeMapping mappings)
      76         4765 :   : WithInnerAttrs (std::move (inner_attrs)), items (std::move (items)),
      77         4765 :     mappings (mappings)
      78         4765 : {}
      79              : 
      80            0 : Crate::Crate (Crate const &other)
      81            0 :   : WithInnerAttrs (other.inner_attrs), mappings (other.mappings)
      82              : {
      83            0 :   items.reserve (other.items.size ());
      84            0 :   for (const auto &e : other.items)
      85            0 :     items.push_back (e->clone_item ());
      86            0 : }
      87              : 
      88              : Crate &
      89            0 : Crate::operator= (Crate const &other)
      90              : {
      91            0 :   inner_attrs = other.inner_attrs;
      92            0 :   mappings = other.mappings;
      93              : 
      94            0 :   items.reserve (other.items.size ());
      95            0 :   for (const auto &e : other.items)
      96            0 :     items.push_back (e->clone_item ());
      97              : 
      98            0 :   return *this;
      99              : }
     100              : 
     101              : std::string
     102            0 : Crate::to_debug_string () const
     103              : {
     104            0 :   std::string str ("HIR::Crate: ");
     105              : 
     106              :   // inner attributes
     107            0 :   str += "\n inner attributes: ";
     108            0 :   if (inner_attrs.empty ())
     109              :     {
     110            0 :       str += "none";
     111              :     }
     112              :   else
     113              :     {
     114              :       /* note that this does not print them with "inner attribute" syntax -
     115              :        * just the body */
     116            0 :       for (const auto &attr : inner_attrs)
     117              :         {
     118            0 :           str += "\n  " + attr.as_string ();
     119              :         }
     120              :     }
     121              : 
     122              :   // items
     123            0 :   str += "\n items: ";
     124            0 :   if (items.empty ())
     125              :     {
     126            0 :       str += "none";
     127              :     }
     128              :   else
     129              :     {
     130            0 :       for (const auto &item : items)
     131              :         {
     132              :           // DEBUG: null pointer check
     133            0 :           if (item == nullptr)
     134              :             {
     135            0 :               rust_debug ("something really terrible has gone wrong - "
     136              :                           "null pointer item in crate.");
     137            0 :               return "nullptr_POINTER_MARK";
     138              :             }
     139              : 
     140            0 :           str += "\n  " + item->to_string ();
     141              :         }
     142              :     }
     143              : 
     144            0 :   return str;
     145            0 : }
     146              : 
     147              : std::string
     148            0 : Crate::to_string () const
     149              : {
     150            0 :   std::string str;
     151            0 :   if (!inner_attrs.empty ())
     152            0 :     for (const auto &attr : inner_attrs)
     153            0 :       str += attr.as_string () + "\n";
     154              : 
     155            0 :   if (!items.empty ())
     156            0 :     for (const auto &item : items)
     157            0 :       str += item->to_string () + "\n";
     158              : 
     159            0 :   return str;
     160              : }
     161              : 
     162              : std::string
     163            0 : Visibility::to_string () const
     164              : {
     165            0 :   switch (vis_type)
     166              :     {
     167            0 :     case VisType::Private:
     168            0 :       return std::string ("private");
     169            0 :     case VisType::Public:
     170            0 :       return std::string ("pub");
     171            0 :     case VisType::Restricted:
     172            0 :       return std::string ("pub(in ") + path.get_mappings ().as_string ()
     173            0 :              + std::string (")");
     174            0 :     default:
     175            0 :       rust_unreachable ();
     176              :     }
     177              : }
     178              : 
     179              : // Creates a string that reflects the visibility stored.
     180              : std::string
     181            0 : VisItem::to_string () const
     182              : {
     183              :   // FIXME: can't do formatting on string to make identation occur.
     184            0 :   std::string str = Item::to_string ();
     185              : 
     186            0 :   if (has_visibility ())
     187              :     {
     188            0 :       str = visibility.to_string () + " ";
     189              :     }
     190              : 
     191            0 :   return str;
     192              : }
     193              : 
     194              : // Creates a string that reflects the outer attributes stored.
     195              : std::string
     196            0 : Item::to_string () const
     197              : {
     198            0 :   std::string str;
     199              : 
     200            0 :   if (!outer_attrs.empty ())
     201              :     {
     202            0 :       for (const auto &attr : outer_attrs)
     203              :         {
     204            0 :           str += attr.as_string () + "\n";
     205              :         }
     206              :     }
     207              : 
     208            0 :   return str;
     209              : }
     210              : 
     211              : std::string
     212            0 : Module::to_string () const
     213              : {
     214              :   // get module string for "[vis] mod [name]"
     215            0 :   std::string str = VisItem::to_string () + "mod " + module_name.as_string ();
     216              : 
     217              :   // inner attributes
     218            0 :   str += "\n inner attributes: ";
     219            0 :   if (inner_attrs.empty ())
     220              :     {
     221            0 :       str += "none";
     222              :     }
     223              :   else
     224              :     {
     225              :       /* note that this does not print them with "inner attribute" syntax -
     226              :        * just the body */
     227            0 :       for (const auto &attr : inner_attrs)
     228              :         {
     229            0 :           str += "\n  " + attr.as_string ();
     230              :         }
     231              :     }
     232              : 
     233              :   // items
     234            0 :   str += "\n items: ";
     235            0 :   if (items.empty ())
     236              :     {
     237            0 :       str += "none";
     238              :     }
     239              :   else
     240              :     {
     241            0 :       for (const auto &item : items)
     242              :         {
     243              :           // DEBUG: null pointer check
     244            0 :           if (item == nullptr)
     245              :             {
     246            0 :               rust_debug ("something really terrible has gone wrong - "
     247              :                           "null pointer item in crate.");
     248            0 :               return "nullptr_POINTER_MARK";
     249              :             }
     250              : 
     251            0 :           str += "\n  " + item->to_string ();
     252              :         }
     253              :     }
     254              : 
     255            0 :   return str + "\n";
     256            0 : }
     257              : 
     258              : std::string
     259            4 : Item::item_kind_string (Item::ItemKind kind)
     260              : {
     261            4 :   switch (kind)
     262              :     {
     263            1 :     case Item::ItemKind::Static:
     264            1 :       return "static";
     265            0 :     case Item::ItemKind::Constant:
     266            0 :       return "constant";
     267            1 :     case Item::ItemKind::TypeAlias:
     268            1 :       return "type alias";
     269            1 :     case Item::ItemKind::Function:
     270            1 :       return "function";
     271            0 :     case Item::ItemKind::UseDeclaration:
     272            0 :       return "use declaration";
     273            0 :     case Item::ItemKind::ExternBlock:
     274            0 :       return "extern block";
     275            0 :     case Item::ItemKind::ExternCrate:
     276            0 :       return "extern crate";
     277            0 :     case Item::ItemKind::Struct:
     278            0 :       return "struct";
     279            0 :     case Item::ItemKind::Union:
     280            0 :       return "union";
     281            1 :     case Item::ItemKind::Enum:
     282            1 :       return "enum";
     283            0 :     case Item::ItemKind::EnumItem:
     284            0 :       return "enum item";
     285            0 :     case Item::ItemKind::Trait:
     286            0 :       return "trait";
     287            0 :     case Item::ItemKind::Impl:
     288            0 :       return "impl";
     289            0 :     case Item::ItemKind::Module:
     290            0 :       return "module";
     291            0 :     default:
     292            0 :       rust_unreachable ();
     293              :     }
     294              : }
     295              : 
     296              : std::string
     297            0 : StaticItem::to_string () const
     298              : {
     299            0 :   std::string str = VisItem::to_string ();
     300              : 
     301            0 :   str += indent_spaces (stay) + "static";
     302              : 
     303            0 :   if (is_mut ())
     304              :     {
     305            0 :       str += " mut";
     306              :     }
     307              : 
     308            0 :   str += name.as_string ();
     309              : 
     310              :   // DEBUG: null pointer check
     311            0 :   if (type == nullptr)
     312              :     {
     313            0 :       rust_debug ("something really terrible has gone wrong - null "
     314              :                   "pointer type in static item.");
     315            0 :       return "nullptr_POINTER_MARK";
     316              :     }
     317            0 :   str += "\n" + indent_spaces (stay) + "Type: " + type->to_string ();
     318              : 
     319              :   // DEBUG: null pointer check
     320            0 :   if (expr == nullptr)
     321              :     {
     322            0 :       rust_debug ("something really terrible has gone wrong - null "
     323              :                   "pointer expr in static item.");
     324            0 :       return "nullptr_POINTER_MARK";
     325              :     }
     326            0 :   str += "\n" + indent_spaces (stay) + "Expression: " + expr->to_string ();
     327              : 
     328            0 :   return str + "\n";
     329            0 : }
     330              : 
     331              : std::string
     332            0 : ExternCrate::to_string () const
     333              : {
     334            0 :   std::string str = VisItem::to_string ();
     335              : 
     336            0 :   str += "extern crate " + referenced_crate;
     337              : 
     338            0 :   if (has_as_clause ())
     339              :     {
     340            0 :       str += " as " + as_clause_name;
     341              :     }
     342              : 
     343            0 :   return str;
     344              : }
     345              : 
     346              : std::string
     347            0 : TupleStruct::to_string () const
     348              : {
     349            0 :   std::string str = VisItem::to_string ();
     350              : 
     351            0 :   str += "struct " + struct_name.as_string ();
     352              : 
     353              :   // generic params
     354            0 :   str += "\n Generic params: ";
     355            0 :   if (generic_params.empty ())
     356              :     {
     357            0 :       str += "none";
     358              :     }
     359              :   else
     360              :     {
     361            0 :       for (const auto &param : generic_params)
     362              :         {
     363              :           // DEBUG: null pointer check
     364            0 :           if (param == nullptr)
     365              :             {
     366            0 :               rust_debug (
     367              :                 "something really terrible has gone wrong - null pointer "
     368              :                 "generic param in enum.");
     369            0 :               return "nullptr_POINTER_MARK";
     370              :             }
     371              : 
     372            0 :           str += "\n  " + param->to_string ();
     373              :         }
     374              :     }
     375              : 
     376              :   // tuple fields
     377            0 :   str += "\n Tuple fields: ";
     378            0 :   if (fields.empty ())
     379              :     {
     380            0 :       str += "none";
     381              :     }
     382              :   else
     383              :     {
     384            0 :       for (const auto &field : fields)
     385              :         {
     386            0 :           str += "\n  " + field.to_string ();
     387              :         }
     388              :     }
     389              : 
     390            0 :   str += "\n Where clause: ";
     391            0 :   if (has_where_clause ())
     392              :     {
     393            0 :       str += where_clause.to_string ();
     394              :     }
     395              :   else
     396              :     {
     397            0 :       str += "none";
     398              :     }
     399              : 
     400            0 :   return str;
     401            0 : }
     402              : 
     403              : std::string
     404            0 : ConstantItem::to_string () const
     405              : {
     406            0 :   std::string str = VisItem::to_string ();
     407              : 
     408            0 :   str += "const " + identifier.as_string ();
     409              : 
     410              :   // DEBUG: null pointer check
     411            0 :   if (type == nullptr)
     412              :     {
     413            0 :       rust_debug ("something really terrible has gone wrong - null "
     414              :                   "pointer type in const item.");
     415            0 :       return "nullptr_POINTER_MARK";
     416              :     }
     417            0 :   str += "\n  Type: " + type->to_string ();
     418              : 
     419              :   // DEBUG: null pointer check
     420            0 :   if (const_expr == nullptr)
     421              :     {
     422            0 :       rust_debug ("something really terrible has gone wrong - null "
     423              :                   "pointer expr in const item.");
     424            0 :       return "nullptr_POINTER_MARK";
     425              :     }
     426            0 :   str += "\n  Expression: " + const_expr->to_string ();
     427              : 
     428            0 :   return str + "\n";
     429            0 : }
     430              : 
     431              : std::string
     432            0 : ImplBlock::to_string () const
     433              : {
     434            0 :   std::string str = VisItem::to_string ();
     435              : 
     436            0 :   str += "impl ";
     437              : 
     438              :   // generic params
     439            0 :   str += "\n Generic params: ";
     440            0 :   if (generic_params.empty ())
     441              :     {
     442            0 :       str += "none";
     443              :     }
     444              :   else
     445              :     {
     446            0 :       for (const auto &param : generic_params)
     447              :         {
     448              :           // DEBUG: null pointer check
     449            0 :           if (param == nullptr)
     450              :             {
     451            0 :               rust_debug (
     452              :                 "something really terrible has gone wrong - null pointer "
     453              :                 "generic param in impl.");
     454            0 :               return "nullptr_POINTER_MARK";
     455              :             }
     456              : 
     457            0 :           str += "\n  " + param->to_string ();
     458              :         }
     459              :     }
     460              : 
     461            0 :   str += "\n Type: " + impl_type->to_string ();
     462              : 
     463            0 :   str += "\n Where clause: ";
     464            0 :   if (has_where_clause ())
     465              :     {
     466            0 :       str += where_clause.to_string ();
     467              :     }
     468              :   else
     469              :     {
     470            0 :       str += "none";
     471              :     }
     472              : 
     473              :   // inner attributes
     474            0 :   str += "\n inner attributes: ";
     475            0 :   if (inner_attrs.empty ())
     476              :     {
     477            0 :       str += "none";
     478              :     }
     479              :   else
     480              :     {
     481              :       /* note that this does not print them with "inner attribute" syntax -
     482              :        * just the body */
     483            0 :       for (const auto &attr : inner_attrs)
     484              :         {
     485            0 :           str += "\n  " + attr.as_string ();
     486              :         }
     487              :     }
     488              : 
     489            0 :   str += "\n impl items: ";
     490            0 :   if (!has_impl_items ())
     491              :     {
     492            0 :       str += "none";
     493              :     }
     494              :   else
     495              :     {
     496            0 :       for (const auto &item : impl_items)
     497              :         {
     498            0 :           str += "\n  " + item->to_string ();
     499              :         }
     500              :     }
     501              : 
     502            0 :   return str;
     503            0 : }
     504              : 
     505              : std::string
     506            0 : StructStruct::to_string () const
     507              : {
     508            0 :   std::string str = VisItem::to_string ();
     509              : 
     510            0 :   str += "struct " + struct_name.as_string ();
     511              : 
     512              :   // generic params
     513            0 :   str += "\n Generic params: ";
     514            0 :   if (generic_params.empty ())
     515              :     {
     516            0 :       str += "none";
     517              :     }
     518              :   else
     519              :     {
     520            0 :       for (const auto &param : generic_params)
     521              :         {
     522              :           // DEBUG: null pointer check
     523            0 :           if (param == nullptr)
     524              :             {
     525            0 :               rust_debug (
     526              :                 "something really terrible has gone wrong - null pointer "
     527              :                 "generic param in enum.");
     528            0 :               return "nullptr_POINTER_MARK";
     529              :             }
     530              : 
     531            0 :           str += "\n  " + param->to_string ();
     532              :         }
     533              :     }
     534              : 
     535            0 :   str += "\n Where clause: ";
     536            0 :   if (has_where_clause ())
     537              :     {
     538            0 :       str += where_clause.to_string ();
     539              :     }
     540              :   else
     541              :     {
     542            0 :       str += "none";
     543              :     }
     544              : 
     545              :   // struct fields
     546            0 :   str += "\n Struct fields: ";
     547            0 :   if (is_unit)
     548              :     {
     549            0 :       str += "none (unit)";
     550              :     }
     551            0 :   else if (fields.empty ())
     552              :     {
     553            0 :       str += "none (non-unit)";
     554              :     }
     555              :   else
     556              :     {
     557            0 :       for (const auto &field : fields)
     558              :         {
     559            0 :           str += "\n  - " + field.to_string ();
     560              :         }
     561            0 :       str += "\n";
     562              :     }
     563              : 
     564            0 :   return str;
     565            0 : }
     566              : 
     567              : std::string
     568            0 : UseDeclaration::to_string () const
     569              : {
     570            0 :   std::string str = VisItem::to_string ();
     571              : 
     572              :   // DEBUG: null pointer check
     573            0 :   if (use_tree == nullptr)
     574              :     {
     575            0 :       rust_debug (
     576              :         "something really terrible has gone wrong - null pointer use tree in "
     577              :         "use declaration.");
     578            0 :       return "nullptr_POINTER_MARK";
     579              :     }
     580              : 
     581            0 :   str += "use " + use_tree->to_string ();
     582              : 
     583            0 :   return str;
     584            0 : }
     585              : 
     586              : std::string
     587            0 : UseTreeGlob::to_string () const
     588              : {
     589            0 :   switch (glob_type)
     590              :     {
     591            0 :     case NO_PATH:
     592            0 :       return "*";
     593            0 :     case GLOBAL:
     594            0 :       return "::*";
     595            0 :     case PATH_PREFIXED:
     596            0 :       {
     597            0 :         std::string path_str = path.as_string ();
     598            0 :         return path_str + "::*";
     599            0 :       }
     600            0 :     default:
     601              :       // some kind of error
     602            0 :       return "ERROR-PATH";
     603              :     }
     604              :   rust_unreachable ();
     605              : }
     606              : 
     607              : std::string
     608            0 : UseTreeList::to_string () const
     609              : {
     610            0 :   std::string path_str;
     611            0 :   switch (path_type)
     612              :     {
     613            0 :     case NO_PATH:
     614            0 :       path_str = "{";
     615            0 :       break;
     616            0 :     case GLOBAL:
     617            0 :       path_str = "::{";
     618            0 :       break;
     619            0 :     case PATH_PREFIXED:
     620            0 :       {
     621            0 :         path_str = path.as_string () + "::{";
     622            0 :         break;
     623              :       }
     624            0 :     default:
     625              :       // some kind of error
     626            0 :       return "ERROR-PATH-LIST";
     627              :     }
     628              : 
     629            0 :   if (has_trees ())
     630              :     {
     631            0 :       auto i = trees.begin ();
     632            0 :       auto e = trees.end ();
     633              : 
     634              :       // DEBUG: null pointer check
     635            0 :       if (*i == nullptr)
     636              :         {
     637            0 :           rust_debug ("something really terrible has gone wrong - null pointer "
     638              :                       "tree in use tree list.");
     639            0 :           return "nullptr_POINTER_MARK";
     640              :         }
     641              : 
     642            0 :       for (; i != e; i++)
     643              :         {
     644            0 :           path_str += (*i)->to_string ();
     645            0 :           if (e != i + 1)
     646            0 :             path_str += ", ";
     647              :         }
     648              :     }
     649              :   else
     650              :     {
     651            0 :       path_str += "none";
     652              :     }
     653              : 
     654            0 :   return path_str + "}";
     655            0 : }
     656              : 
     657              : std::string
     658            0 : UseTreeRebind::to_string () const
     659              : {
     660            0 :   std::string path_str = path.as_string ();
     661              : 
     662            0 :   switch (bind_type)
     663              :     {
     664              :     case NONE:
     665              :       // nothing to add, just path
     666              :       break;
     667            0 :     case IDENTIFIER:
     668            0 :       path_str += " as " + identifier.as_string ();
     669            0 :       break;
     670            0 :     case WILDCARD:
     671            0 :       path_str += " as _";
     672            0 :       break;
     673            0 :     default:
     674              :       // error
     675            0 :       return "ERROR-PATH-REBIND";
     676              :     }
     677              : 
     678            0 :   return path_str;
     679            0 : }
     680              : 
     681              : std::string
     682            0 : Enum::to_string () const
     683              : {
     684            0 :   std::string str = VisItem::to_string ();
     685            0 :   str += enum_name.as_string ();
     686              : 
     687              :   // generic params
     688            0 :   str += "\n Generic params: ";
     689            0 :   if (generic_params.empty ())
     690              :     {
     691            0 :       str += "none";
     692              :     }
     693              :   else
     694              :     {
     695            0 :       for (const auto &param : generic_params)
     696              :         {
     697              :           // DEBUG: null pointer check
     698            0 :           if (param == nullptr)
     699              :             {
     700            0 :               rust_debug (
     701              :                 "something really terrible has gone wrong - null pointer "
     702              :                 "generic param in enum.");
     703            0 :               return "nullptr_POINTER_MARK";
     704              :             }
     705              : 
     706            0 :           str += "\n  " + param->to_string ();
     707              :         }
     708              :     }
     709              : 
     710            0 :   str += "\n Where clause: ";
     711            0 :   if (has_where_clause ())
     712              :     {
     713            0 :       str += where_clause.to_string ();
     714              :     }
     715              :   else
     716              :     {
     717            0 :       str += "none";
     718              :     }
     719              : 
     720              :   // items
     721            0 :   str += "\n Items: ";
     722            0 :   if (items.empty ())
     723              :     {
     724            0 :       str += "none";
     725              :     }
     726              :   else
     727              :     {
     728            0 :       for (const auto &item : items)
     729              :         {
     730              :           // DEBUG: null pointer check
     731            0 :           if (item == nullptr)
     732              :             {
     733            0 :               rust_debug (
     734              :                 "something really terrible has gone wrong - null pointer "
     735              :                 "enum item in enum.");
     736            0 :               return "nullptr_POINTER_MARK";
     737              :             }
     738              : 
     739            0 :           str += "\n  " + item->to_string ();
     740              :         }
     741              :     }
     742              : 
     743            0 :   return str;
     744            0 : }
     745              : 
     746              : std::string
     747            0 : Trait::to_string () const
     748              : {
     749            0 :   std::string str = VisItem::to_string ();
     750              : 
     751            0 :   if (unsafety == Unsafety::Unsafe)
     752              :     {
     753            0 :       str += "unsafe ";
     754              :     }
     755              : 
     756            0 :   str += "trait " + name.as_string ();
     757              : 
     758              :   // generic params
     759            0 :   str += "\n Generic params: ";
     760            0 :   if (generic_params.empty ())
     761              :     {
     762            0 :       str += "none";
     763              :     }
     764              :   else
     765              :     {
     766            0 :       for (const auto &param : generic_params)
     767              :         {
     768              :           // DEBUG: null pointer check
     769            0 :           if (param == nullptr)
     770              :             {
     771            0 :               rust_debug (
     772              :                 "something really terrible has gone wrong - null pointer "
     773              :                 "generic param in trait.");
     774            0 :               return "nullptr_POINTER_MARK";
     775              :             }
     776              : 
     777            0 :           str += "\n  " + param->to_string ();
     778              :         }
     779              :     }
     780              : 
     781            0 :   str += "\n Type param bounds: ";
     782            0 :   if (!has_type_param_bounds ())
     783              :     {
     784            0 :       str += "none";
     785              :     }
     786              :   else
     787              :     {
     788            0 :       for (const auto &bound : type_param_bounds)
     789              :         {
     790              :           // DEBUG: null pointer check
     791            0 :           if (bound == nullptr)
     792              :             {
     793            0 :               rust_debug (
     794              :                 "something really terrible has gone wrong - null pointer "
     795              :                 "type param bound in trait.");
     796            0 :               return "nullptr_POINTER_MARK";
     797              :             }
     798              : 
     799            0 :           str += "\n  " + bound->to_string ();
     800              :         }
     801              :     }
     802              : 
     803            0 :   str += "\n Where clause: ";
     804            0 :   if (!has_where_clause ())
     805              :     {
     806            0 :       str += "none";
     807              :     }
     808              :   else
     809              :     {
     810            0 :       str += where_clause.to_string ();
     811              :     }
     812              : 
     813            0 :   str += "\n Trait items: ";
     814            0 :   if (!has_trait_items ())
     815              :     {
     816            0 :       str += "none";
     817              :     }
     818              :   else
     819              :     {
     820            0 :       for (const auto &item : trait_items)
     821              :         {
     822              :           // DEBUG: null pointer check
     823            0 :           if (item == nullptr)
     824              :             {
     825            0 :               rust_debug (
     826              :                 "something really terrible has gone wrong - null pointer "
     827              :                 "trait item in trait.");
     828            0 :               return "nullptr_POINTER_MARK";
     829              :             }
     830              : 
     831            0 :           str += "\n  " + item->to_string ();
     832              :         }
     833              :     }
     834              : 
     835            0 :   return str;
     836            0 : }
     837              : 
     838              : std::string
     839            0 : Union::to_string () const
     840              : {
     841            0 :   std::string str = VisItem::to_string ();
     842              : 
     843            0 :   str += "union " + union_name.as_string ();
     844              : 
     845              :   // generic params
     846            0 :   str += "\n Generic params: ";
     847            0 :   if (generic_params.empty ())
     848              :     {
     849            0 :       str += "none";
     850              :     }
     851              :   else
     852              :     {
     853            0 :       for (const auto &param : generic_params)
     854              :         {
     855              :           // DEBUG: null pointer check
     856            0 :           if (param == nullptr)
     857              :             {
     858            0 :               rust_debug (
     859              :                 "something really terrible has gone wrong - null pointer "
     860              :                 "generic param in union.");
     861            0 :               return "nullptr_POINTER_MARK";
     862              :             }
     863              : 
     864            0 :           str += "\n  " + param->to_string ();
     865              :         }
     866              :     }
     867              : 
     868            0 :   str += "\n Where clause: ";
     869            0 :   if (has_where_clause ())
     870              :     {
     871            0 :       str += where_clause.to_string ();
     872              :     }
     873              :   else
     874              :     {
     875            0 :       str += "none";
     876              :     }
     877              : 
     878              :   // struct fields
     879            0 :   str += "\n Struct fields (variants): ";
     880            0 :   if (variants.empty ())
     881              :     {
     882            0 :       str += "none";
     883              :     }
     884              :   else
     885              :     {
     886            0 :       for (const auto &field : variants)
     887              :         {
     888            0 :           str += "\n  " + field.to_string ();
     889              :         }
     890              :     }
     891              : 
     892            0 :   return str;
     893            0 : }
     894              : 
     895              : std::string
     896            0 : Function::to_string () const
     897              : {
     898            0 :   std::string str = VisItem::to_string () + "\n";
     899            0 :   std::string qstr = qualifiers.to_string ();
     900            0 :   if ("" != qstr)
     901            0 :     str += qstr + " ";
     902              : 
     903            0 :   if (has_function_return_type ())
     904              :     {
     905              :       // DEBUG: null pointer check
     906            0 :       if (return_type == nullptr)
     907              :         {
     908              :           rust_debug (
     909              :             "something really terrible has gone wrong - null pointer return "
     910              :             "type in function.");
     911              :           return "nullptr_POINTER_MARK";
     912              :         }
     913              : 
     914            0 :       str += return_type->to_string () + " ";
     915              :     }
     916              :   else
     917              :     {
     918            0 :       str += "void ";
     919              :     }
     920              : 
     921            0 :   str += function_name.as_string ();
     922              : 
     923            0 :   if (has_generics ())
     924              :     {
     925            0 :       str += "<";
     926              : 
     927            0 :       auto i = generic_params.begin ();
     928            0 :       auto e = generic_params.end ();
     929              : 
     930              :       // DEBUG: null pointer check
     931            0 :       if (i == e)
     932              :         {
     933            0 :           rust_debug ("something really terrible has gone wrong - null pointer "
     934              :                       "generic param in function item.");
     935            0 :           return "nullptr_POINTER_MARK";
     936              :         }
     937              : 
     938            0 :       for (; i != e; i++)
     939              :         {
     940            0 :           str += (*i)->to_string ();
     941            0 :           if (e != i + 1)
     942            0 :             str += ", ";
     943              :         }
     944            0 :       str += ">";
     945              :     }
     946              : 
     947            0 :   if (has_function_params ())
     948              :     {
     949            0 :       auto i = function_params.begin ();
     950            0 :       auto e = function_params.end ();
     951            0 :       str += "(";
     952            0 :       for (; i != e; i++)
     953              :         {
     954            0 :           str += (*i).to_string ();
     955            0 :           if (e != i + 1)
     956            0 :             str += ", ";
     957              :         }
     958            0 :       str += ")";
     959              :     }
     960              :   else
     961              :     {
     962            0 :       str += "()";
     963              :     }
     964              : 
     965            0 :   if (has_where_clause ())
     966              :     {
     967            0 :       str += " where " + where_clause.to_string ();
     968              :     }
     969              : 
     970            0 :   str += "\n";
     971              : 
     972              :   // DEBUG: null pointer check
     973            0 :   if (function_body == nullptr)
     974              :     {
     975            0 :       rust_debug (
     976              :         "something really terrible has gone wrong - null pointer function "
     977              :         "body in function.");
     978            0 :       return "nullptr_POINTER_MARK";
     979              :     }
     980            0 :   return str + function_body->to_string ();
     981            0 : }
     982              : 
     983              : std::string
     984            0 : WhereClause::to_string () const
     985              : {
     986              :   // just print where clause items, don't mention "where" or "where clause"
     987            0 :   std::string str;
     988              : 
     989            0 :   if (where_clause_items.empty ())
     990              :     {
     991            0 :       str = "none";
     992              :     }
     993              :   else
     994              :     {
     995            0 :       for (const auto &item : where_clause_items)
     996              :         {
     997            0 :           str += "\n  " + item->to_string ();
     998              :         }
     999              :     }
    1000              : 
    1001            0 :   return str;
    1002              : }
    1003              : 
    1004              : std::string
    1005            0 : BlockExpr::to_string () const
    1006              : {
    1007            0 :   std::string istr = indent_spaces (enter);
    1008            0 :   std::string str = istr + "BlockExpr:\n" + istr;
    1009              :   // get outer attributes
    1010            0 :   str += "{\n" + indent_spaces (stay) + Expr::to_string ();
    1011              : 
    1012              :   // inner attributes
    1013            0 :   str += "\n" + indent_spaces (stay) + "inner attributes: ";
    1014            0 :   if (inner_attrs.empty ())
    1015              :     {
    1016            0 :       str += "none";
    1017              :     }
    1018              :   else
    1019              :     {
    1020              :       /* note that this does not print them with "inner attribute" syntax -
    1021              :        * just the body */
    1022            0 :       for (const auto &attr : inner_attrs)
    1023              :         {
    1024            0 :           str += "\n" + indent_spaces (stay) + attr.as_string ();
    1025              :         }
    1026              :     }
    1027              : 
    1028              :   // statements
    1029            0 :   str += "\n" + indent_spaces (stay) + "statements: ";
    1030            0 :   if (statements.empty ())
    1031              :     {
    1032            0 :       str += "none";
    1033              :     }
    1034              :   else
    1035              :     {
    1036            0 :       for (const auto &stmt : statements)
    1037              :         {
    1038              :           // DEBUG: null pointer check
    1039            0 :           if (stmt == nullptr)
    1040              :             {
    1041            0 :               rust_debug (
    1042              :                 "something really terrible has gone wrong - null pointer "
    1043              :                 "stmt in block expr.");
    1044            0 :               return "nullptr_POINTER_MARK";
    1045              :             }
    1046              : 
    1047            0 :           str += "\n" + indent_spaces (stay) + stmt->to_string ();
    1048              :         }
    1049              :     }
    1050              : 
    1051              :   // final expression
    1052            0 :   str += "\n" + indent_spaces (stay) + "final expression: ";
    1053            0 :   if (expr == nullptr)
    1054              :     {
    1055            0 :       str += "none";
    1056              :     }
    1057              :   else
    1058              :     {
    1059            0 :       str += "\n" + expr->to_string ();
    1060              :     }
    1061              : 
    1062            0 :   str += "\n" + indent_spaces (out) + "}";
    1063            0 :   return str;
    1064            0 : }
    1065              : 
    1066              : std::string
    1067           18 : AnonConst::to_string () const
    1068              : {
    1069           18 :   std::string istr = indent_spaces (enter);
    1070           18 :   std::string str = istr + "AnonConst:\n" + istr;
    1071              : 
    1072           18 :   if (expr.has_value ())
    1073           36 :     str += get_inner_expr ().to_string ();
    1074              :   else
    1075            0 :     str += "_";
    1076              : 
    1077           36 :   str += "\n" + indent_spaces (out);
    1078              : 
    1079           18 :   return str;
    1080           18 : }
    1081              : 
    1082              : std::string
    1083            0 : ConstBlock::to_string () const
    1084              : {
    1085            0 :   std::string istr = indent_spaces (enter);
    1086              : 
    1087            0 :   std::string str = istr + "ConstBlock:\n" + istr;
    1088              : 
    1089            0 :   str += get_const_expr ().to_string ();
    1090              : 
    1091            0 :   str += "\n" + indent_spaces (out);
    1092              : 
    1093            0 :   return str;
    1094            0 : }
    1095              : 
    1096              : std::string
    1097            0 : TypeAlias::to_string () const
    1098              : {
    1099            0 :   std::string str = VisItem::to_string ();
    1100              : 
    1101            0 :   str += " " + new_type_name.as_string ();
    1102              : 
    1103              :   // generic params
    1104            0 :   str += "\n Generic params: ";
    1105            0 :   if (!has_generics ())
    1106              :     {
    1107            0 :       str += "none";
    1108              :     }
    1109              :   else
    1110              :     {
    1111            0 :       auto i = generic_params.begin ();
    1112            0 :       auto e = generic_params.end ();
    1113              : 
    1114            0 :       for (; i != e; i++)
    1115              :         {
    1116            0 :           str += (*i)->to_string ();
    1117            0 :           if (e != i + 1)
    1118            0 :             str += ", ";
    1119              :         }
    1120              :     }
    1121              : 
    1122            0 :   str += "\n Where clause: ";
    1123            0 :   if (!has_where_clause ())
    1124              :     {
    1125            0 :       str += "none";
    1126              :     }
    1127              :   else
    1128              :     {
    1129            0 :       str += where_clause.to_string ();
    1130              :     }
    1131              : 
    1132            0 :   str += "\n Type: " + existing_type->to_string ();
    1133              : 
    1134            0 :   return str;
    1135              : }
    1136              : 
    1137              : std::string
    1138            0 : ExternBlock::to_string () const
    1139              : {
    1140            0 :   std::string str = VisItem::to_string ();
    1141              : 
    1142            0 :   str += "extern ";
    1143            0 :   str += "\"" + get_string_from_abi (abi) + "\" ";
    1144              : 
    1145              :   // inner attributes
    1146            0 :   str += "\n inner attributes: ";
    1147            0 :   if (inner_attrs.empty ())
    1148              :     {
    1149            0 :       str += "none";
    1150              :     }
    1151              :   else
    1152              :     {
    1153              :       /* note that this does not print them with "inner attribute" syntax -
    1154              :        * just the body */
    1155            0 :       for (const auto &attr : inner_attrs)
    1156              :         {
    1157            0 :           str += "\n  " + attr.as_string ();
    1158              :         }
    1159              :     }
    1160              : 
    1161            0 :   str += "\n external items: ";
    1162            0 :   if (!has_extern_items ())
    1163              :     {
    1164            0 :       str += "none";
    1165              :     }
    1166              :   else
    1167              :     {
    1168            0 :       for (const auto &item : extern_items)
    1169              :         {
    1170            0 :           str += "\n  " + item->to_string ();
    1171              :         }
    1172              :     }
    1173              : 
    1174            0 :   return str;
    1175              : }
    1176              : 
    1177              : std::string
    1178           57 : PathInExpression::to_string () const
    1179              : {
    1180           57 :   std::string str;
    1181              : 
    1182           57 :   if (has_opening_scope_resolution)
    1183              :     {
    1184            0 :       str = "::";
    1185              :     }
    1186              : 
    1187           57 :   return str + PathPattern::to_string ();
    1188           57 : }
    1189              : 
    1190              : std::string
    1191            0 : ExprStmt::to_string () const
    1192              : {
    1193            0 :   std::string str = indent_spaces (enter) + "ExprStmt:\n";
    1194              : 
    1195            0 :   if (expr == nullptr)
    1196              :     {
    1197            0 :       str += "none (this should not happen and is an error)";
    1198              :     }
    1199              :   else
    1200              :     {
    1201            0 :       indent_spaces (enter);
    1202            0 :       str += expr->to_string ();
    1203            0 :       indent_spaces (out);
    1204              :     }
    1205              : 
    1206            0 :   indent_spaces (out);
    1207            0 :   return str;
    1208              : }
    1209              : 
    1210              : std::string
    1211            0 : ClosureParam::to_string () const
    1212              : {
    1213            0 :   std::string str (pattern->to_string ());
    1214              : 
    1215            0 :   if (has_type_given ())
    1216              :     {
    1217            0 :       str += " : " + type->to_string ();
    1218              :     }
    1219              : 
    1220            0 :   return str;
    1221              : }
    1222              : 
    1223              : std::string
    1224            0 : ClosureExpr::to_string () const
    1225              : {
    1226            0 :   std::string str ("ClosureExpr:\n Has move: ");
    1227            0 :   if (has_move)
    1228              :     {
    1229            0 :       str += "true";
    1230              :     }
    1231              :   else
    1232              :     {
    1233            0 :       str += "false";
    1234              :     }
    1235              : 
    1236            0 :   str += "\n Params: ";
    1237            0 :   if (params.empty ())
    1238              :     {
    1239            0 :       str += "none";
    1240              :     }
    1241              :   else
    1242              :     {
    1243            0 :       for (const auto &param : params)
    1244              :         {
    1245            0 :           str += "\n  " + param.to_string ();
    1246              :         }
    1247              :     }
    1248              : 
    1249            0 :   str += "\n Return type: "
    1250            0 :          + (has_return_type () ? return_type->to_string () : "none");
    1251              : 
    1252            0 :   str += "\n Body: " + expr->to_string ();
    1253              : 
    1254            0 :   return str;
    1255              : }
    1256              : 
    1257              : std::string
    1258           57 : PathPattern::to_string () const
    1259              : {
    1260           57 :   if (is_lang_item ())
    1261            0 :     return LangItem::PrettyString (*lang_item);
    1262              : 
    1263           57 :   std::string str;
    1264              : 
    1265          120 :   for (const auto &segment : segments)
    1266              :     {
    1267          189 :       str += segment.to_string () + "::";
    1268              :     }
    1269              : 
    1270              :   // basically a hack - remove last two characters of string (remove final ::)
    1271           57 :   str.erase (str.length () - 2);
    1272              : 
    1273           57 :   return str;
    1274           57 : }
    1275              : 
    1276              : std::string
    1277            8 : QualifiedPathType::to_string () const
    1278              : {
    1279            8 :   std::string str ("<");
    1280           16 :   str += type->to_string ();
    1281              : 
    1282            8 :   if (has_as_clause ())
    1283              :     {
    1284           16 :       str += " as " + trait->to_string ();
    1285              :     }
    1286              : 
    1287            8 :   return str + ">";
    1288            8 : }
    1289              : 
    1290              : std::string
    1291            0 : QualifiedPathInExpression::to_string () const
    1292              : {
    1293            0 :   return path_type.to_string () + "::" + PathPattern::to_string ();
    1294              : }
    1295              : 
    1296              : std::string
    1297            0 : BorrowExpr::to_string () const
    1298              : {
    1299            0 :   std::string str ("&");
    1300              : 
    1301            0 :   if (is_mut ())
    1302              :     {
    1303            0 :       str += "mut ";
    1304              :     }
    1305              : 
    1306            0 :   str += main_or_left_expr->to_string ();
    1307              : 
    1308            0 :   return str;
    1309              : }
    1310              : 
    1311              : std::string
    1312            0 : BoxExpr::to_string () const
    1313              : {
    1314            0 :   std::string str = "box ";
    1315            0 :   rust_assert (expr != nullptr);
    1316            0 :   str += expr->to_string ();
    1317            0 :   return str;
    1318              : }
    1319              : 
    1320              : std::string
    1321            0 : ReturnExpr::to_string () const
    1322              : {
    1323            0 :   std::string str ("return ");
    1324              : 
    1325            0 :   if (has_return_expr ())
    1326              :     {
    1327            0 :       str += return_expr->to_string ();
    1328              :     }
    1329              : 
    1330            0 :   return str;
    1331              : }
    1332              : 
    1333              : std::string
    1334            0 : GroupedExpr::to_string () const
    1335              : {
    1336            0 :   std::string str ("Grouped expr:");
    1337              : 
    1338              :   // inner attributes
    1339            0 :   str += "\n inner attributes: ";
    1340            0 :   if (inner_attrs.empty ())
    1341              :     {
    1342            0 :       str += "none";
    1343              :     }
    1344              :   else
    1345              :     {
    1346              :       /* note that this does not print them with "inner attribute" syntax -
    1347              :        * just the body */
    1348            0 :       for (const auto &attr : inner_attrs)
    1349              :         {
    1350            0 :           str += "\n  " + attr.as_string ();
    1351              :         }
    1352              :     }
    1353              : 
    1354            0 :   str += "\n Expr in parens: " + expr_in_parens->to_string ();
    1355              : 
    1356            0 :   return str;
    1357              : }
    1358              : 
    1359              : std::string
    1360            0 : RangeToExpr::to_string () const
    1361              : {
    1362            0 :   return ".." + to->to_string ();
    1363              : }
    1364              : 
    1365              : std::string
    1366            0 : ContinueExpr::to_string () const
    1367              : {
    1368            0 :   std::string str ("continue ");
    1369              : 
    1370            0 :   if (has_label ())
    1371              :     {
    1372            0 :       str += get_label ().to_string ();
    1373              :     }
    1374              : 
    1375            0 :   return str;
    1376              : }
    1377              : 
    1378              : std::string
    1379          389 : NegationExpr::to_string () const
    1380              : {
    1381          389 :   std::string str;
    1382              : 
    1383          389 :   switch (expr_type)
    1384              :     {
    1385          389 :     case NegationOperator::NEGATE:
    1386          389 :       str = "-";
    1387          389 :       break;
    1388            0 :     case NegationOperator::NOT:
    1389            0 :       str = "!";
    1390            0 :       break;
    1391            0 :     default:
    1392            0 :       return "ERROR_MARK_STRING - negation expr";
    1393              :     }
    1394              : 
    1395          778 :   str += main_or_left_expr->to_string ();
    1396              : 
    1397          389 :   return str;
    1398          389 : }
    1399              : 
    1400              : std::string
    1401            0 : RangeFromExpr::to_string () const
    1402              : {
    1403            0 :   return from->to_string () + "..";
    1404              : }
    1405              : 
    1406              : std::string
    1407            0 : RangeFullExpr::to_string () const
    1408              : {
    1409            0 :   return "..";
    1410              : }
    1411              : 
    1412              : std::string
    1413            0 : ArrayIndexExpr::to_string () const
    1414              : {
    1415            0 :   return array_expr->to_string () + "[" + index_expr->to_string () + "]";
    1416              : }
    1417              : 
    1418              : std::string
    1419            0 : AssignmentExpr::to_string () const
    1420              : {
    1421            0 :   return main_or_left_expr->to_string () + " = " + right_expr->to_string ();
    1422              : }
    1423              : 
    1424              : std::string
    1425            0 : CompoundAssignmentExpr::get_operator_str () const
    1426              : {
    1427            0 :   std::string operator_str;
    1428            0 :   operator_str.reserve (1);
    1429              : 
    1430              :   // get operator string
    1431            0 :   switch (expr_type)
    1432              :     {
    1433            0 :     case ArithmeticOrLogicalOperator::ADD:
    1434            0 :       operator_str = "+";
    1435            0 :       break;
    1436            0 :     case ArithmeticOrLogicalOperator::SUBTRACT:
    1437            0 :       operator_str = "-";
    1438            0 :       break;
    1439            0 :     case ArithmeticOrLogicalOperator::MULTIPLY:
    1440            0 :       operator_str = "*";
    1441            0 :       break;
    1442            0 :     case ArithmeticOrLogicalOperator::DIVIDE:
    1443            0 :       operator_str = "/";
    1444            0 :       break;
    1445            0 :     case ArithmeticOrLogicalOperator::MODULUS:
    1446            0 :       operator_str = "%";
    1447            0 :       break;
    1448            0 :     case ArithmeticOrLogicalOperator::BITWISE_AND:
    1449            0 :       operator_str = "&";
    1450            0 :       break;
    1451            0 :     case ArithmeticOrLogicalOperator::BITWISE_OR:
    1452            0 :       operator_str = "|";
    1453            0 :       break;
    1454            0 :     case ArithmeticOrLogicalOperator::BITWISE_XOR:
    1455            0 :       operator_str = "^";
    1456            0 :       break;
    1457            0 :     case ArithmeticOrLogicalOperator::LEFT_SHIFT:
    1458            0 :       operator_str = "<<";
    1459            0 :       break;
    1460            0 :     case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
    1461            0 :       operator_str = ">>";
    1462            0 :       break;
    1463            0 :     default:
    1464            0 :       rust_unreachable ();
    1465            0 :       break;
    1466              :     }
    1467              : 
    1468            0 :   operator_str += "=";
    1469              : 
    1470            0 :   return operator_str;
    1471              : }
    1472              : 
    1473              : std::string
    1474            0 : CompoundAssignmentExpr::to_string () const
    1475              : {
    1476            0 :   std::string str ("CompoundAssignmentExpr: ");
    1477            0 :   std::string operator_str = get_operator_str ();
    1478            0 :   if (main_or_left_expr == nullptr || right_expr == nullptr)
    1479              :     {
    1480            0 :       str += "error. this is probably a parsing failure.";
    1481              :     }
    1482              :   else
    1483              :     {
    1484            0 :       str += "\n left: " + main_or_left_expr->to_string ();
    1485            0 :       str += "\n right: " + right_expr->to_string ();
    1486            0 :       str += "\n operator: " + operator_str;
    1487              :     }
    1488              : 
    1489            0 :   return str;
    1490            0 : }
    1491              : 
    1492              : std::string
    1493            0 : AsyncBlockExpr::to_string () const
    1494              : {
    1495            0 :   std::string str = "AsyncBlockExpr: ";
    1496              : 
    1497              :   // get outer attributes
    1498            0 :   str += "\n " + Expr::to_string ();
    1499              : 
    1500            0 :   str += "\n Has move: ";
    1501            0 :   str += has_move ? "true" : "false";
    1502              : 
    1503            0 :   return str + "\n" + block_expr->to_string ();
    1504            0 : }
    1505              : 
    1506              : std::string
    1507            0 : ComparisonExpr::to_string () const
    1508              : {
    1509            0 :   std::string str (main_or_left_expr->to_string ());
    1510              : 
    1511            0 :   switch (expr_type)
    1512              :     {
    1513            0 :     case ComparisonOperator::EQUAL:
    1514            0 :       str += " == ";
    1515            0 :       break;
    1516            0 :     case ComparisonOperator::NOT_EQUAL:
    1517            0 :       str += " != ";
    1518            0 :       break;
    1519            0 :     case ComparisonOperator::GREATER_THAN:
    1520            0 :       str += " > ";
    1521            0 :       break;
    1522            0 :     case ComparisonOperator::LESS_THAN:
    1523            0 :       str += " < ";
    1524            0 :       break;
    1525            0 :     case ComparisonOperator::GREATER_OR_EQUAL:
    1526            0 :       str += " >= ";
    1527            0 :       break;
    1528            0 :     case ComparisonOperator::LESS_OR_EQUAL:
    1529            0 :       str += " <= ";
    1530            0 :       break;
    1531            0 :     default:
    1532            0 :       return "ERROR_MARK_STRING - comparison expr";
    1533              :     }
    1534              : 
    1535            0 :   str += right_expr->to_string ();
    1536              : 
    1537            0 :   return str;
    1538            0 : }
    1539              : 
    1540              : std::string
    1541            0 : MethodCallExpr::to_string () const
    1542              : {
    1543            0 :   std::string str ("MethodCallExpr: \n Object (receiver) expr: ");
    1544              : 
    1545            0 :   str += receiver->to_string ();
    1546              : 
    1547            0 :   str += "\n Method path segment: \n";
    1548              : 
    1549            0 :   str += method_name.to_string ();
    1550              : 
    1551            0 :   str += "\n Call params:";
    1552            0 :   if (params.empty ())
    1553              :     {
    1554            0 :       str += "none";
    1555              :     }
    1556              :   else
    1557              :     {
    1558            0 :       for (const auto &param : params)
    1559              :         {
    1560            0 :           if (param == nullptr)
    1561              :             {
    1562            0 :               return "ERROR_MARK_STRING - method call expr param is null";
    1563              :             }
    1564              : 
    1565            0 :           str += "\n  " + param->to_string ();
    1566              :         }
    1567              :     }
    1568              : 
    1569            0 :   return str;
    1570            0 : }
    1571              : 
    1572              : std::string
    1573            0 : TupleIndexExpr::to_string () const
    1574              : {
    1575            0 :   return tuple_expr->to_string () + "." + std::to_string (tuple_index);
    1576              : }
    1577              : 
    1578              : std::string
    1579            0 : DereferenceExpr::to_string () const
    1580              : {
    1581            0 :   return "*" + main_or_left_expr->to_string ();
    1582              : }
    1583              : 
    1584              : std::string
    1585            0 : FieldAccessExpr::to_string () const
    1586              : {
    1587            0 :   return receiver->to_string () + "." + field.as_string ();
    1588              : }
    1589              : 
    1590              : std::string
    1591            0 : LazyBooleanExpr::to_string () const
    1592              : {
    1593            0 :   std::string str (main_or_left_expr->to_string ());
    1594              : 
    1595            0 :   switch (expr_type)
    1596              :     {
    1597            0 :     case LazyBooleanOperator::LOGICAL_OR:
    1598            0 :       str += " || ";
    1599            0 :       break;
    1600            0 :     case LazyBooleanOperator::LOGICAL_AND:
    1601            0 :       str += " && ";
    1602            0 :       break;
    1603            0 :     default:
    1604            0 :       return "ERROR_MARK_STRING - lazy boolean expr out of bounds";
    1605              :     }
    1606              : 
    1607            0 :   str += right_expr->to_string ();
    1608              : 
    1609            0 :   return str;
    1610            0 : }
    1611              : 
    1612              : std::string
    1613            0 : RangeFromToExpr::to_string () const
    1614              : {
    1615            0 :   return from->to_string () + ".." + to->to_string ();
    1616              : }
    1617              : 
    1618              : std::string
    1619            0 : RangeToInclExpr::to_string () const
    1620              : {
    1621            0 :   return "..=" + to->to_string ();
    1622              : }
    1623              : 
    1624              : std::string
    1625            0 : UnsafeBlockExpr::to_string () const
    1626              : {
    1627            0 :   std::string istr = indent_spaces (enter);
    1628            0 :   std::string str = istr + "UnsafeBlockExpr:";
    1629            0 :   str += istr + "{";
    1630              : 
    1631              :   // get outer attributes
    1632            0 :   str += "\n" + indent_spaces (stay) + Expr::to_string ();
    1633              : 
    1634            0 :   return str + "\n" + indent_spaces (out) + "}\n" + expr->to_string ();
    1635            0 : }
    1636              : 
    1637              : std::string
    1638            0 : IfExpr::to_string () const
    1639              : {
    1640            0 :   std::string str ("IfExpr: ");
    1641              : 
    1642            0 :   str += "\n Condition expr: " + condition->to_string ();
    1643              : 
    1644            0 :   str += "\n If block expr: " + if_block->to_string ();
    1645              : 
    1646            0 :   return str;
    1647              : }
    1648              : 
    1649              : std::string
    1650            0 : IfExprConseqElse::to_string () const
    1651              : {
    1652            0 :   std::string str = IfExpr::to_string ();
    1653              : 
    1654            0 :   str += "\n Else expr: " + else_block->to_string ();
    1655              : 
    1656            0 :   return str;
    1657              : }
    1658              : 
    1659              : std::string
    1660            0 : ErrorPropagationExpr::to_string () const
    1661              : {
    1662            0 :   return main_or_left_expr->to_string () + "?";
    1663              : }
    1664              : 
    1665              : std::string
    1666            5 : ArithmeticOrLogicalExpr::get_operator_str () const
    1667              : {
    1668            5 :   std::string operator_str;
    1669            5 :   operator_str.reserve (1);
    1670              : 
    1671              :   // get operator string
    1672            5 :   switch (expr_type)
    1673              :     {
    1674            5 :     case ArithmeticOrLogicalOperator::ADD:
    1675            5 :       operator_str = "+";
    1676            5 :       break;
    1677            0 :     case ArithmeticOrLogicalOperator::SUBTRACT:
    1678            0 :       operator_str = "-";
    1679            0 :       break;
    1680            0 :     case ArithmeticOrLogicalOperator::MULTIPLY:
    1681            0 :       operator_str = "*";
    1682            0 :       break;
    1683            0 :     case ArithmeticOrLogicalOperator::DIVIDE:
    1684            0 :       operator_str = "/";
    1685            0 :       break;
    1686            0 :     case ArithmeticOrLogicalOperator::MODULUS:
    1687            0 :       operator_str = "%";
    1688            0 :       break;
    1689            0 :     case ArithmeticOrLogicalOperator::BITWISE_AND:
    1690            0 :       operator_str = "&";
    1691            0 :       break;
    1692            0 :     case ArithmeticOrLogicalOperator::BITWISE_OR:
    1693            0 :       operator_str = "|";
    1694            0 :       break;
    1695            0 :     case ArithmeticOrLogicalOperator::BITWISE_XOR:
    1696            0 :       operator_str = "^";
    1697            0 :       break;
    1698            0 :     case ArithmeticOrLogicalOperator::LEFT_SHIFT:
    1699            0 :       operator_str = "<<";
    1700            0 :       break;
    1701            0 :     case ArithmeticOrLogicalOperator::RIGHT_SHIFT:
    1702            0 :       operator_str = ">>";
    1703            0 :       break;
    1704            0 :     default:
    1705            0 :       rust_unreachable ();
    1706            5 :       break;
    1707              :     }
    1708              : 
    1709            5 :   return operator_str;
    1710              : }
    1711              : 
    1712              : std::string
    1713            2 : ArithmeticOrLogicalExpr::to_string () const
    1714              : {
    1715            4 :   std::string str = main_or_left_expr->to_string () + " ";
    1716            6 :   str += get_operator_str () + " ";
    1717            4 :   str += right_expr->to_string ();
    1718              : 
    1719            4 :   return "( " + str + " )";
    1720            2 : }
    1721              : 
    1722              : std::string
    1723            0 : CallExpr::to_string () const
    1724              : {
    1725            0 :   std::string str = function->to_string () + "(";
    1726            0 :   if (!has_params ())
    1727            0 :     str += "none";
    1728              :   else
    1729              :     {
    1730            0 :       for (const auto &param : params)
    1731              :         {
    1732            0 :           if (param == nullptr)
    1733              :             {
    1734            0 :               return "ERROR_MARK_STRING - call expr param is null";
    1735              :             }
    1736              : 
    1737            0 :           str += param->to_string () + ",";
    1738              :         }
    1739              :     }
    1740            0 :   return str + ")";
    1741            0 : }
    1742              : 
    1743              : std::string
    1744            0 : WhileLoopExpr::to_string () const
    1745              : {
    1746            0 :   std::string str ("WhileLoopExpr: ");
    1747              : 
    1748            0 :   str += "\n Label: ";
    1749            0 :   if (!has_loop_label ())
    1750              :     {
    1751            0 :       str += "none";
    1752              :     }
    1753              :   else
    1754              :     {
    1755            0 :       str += get_loop_label ().to_string ();
    1756              :     }
    1757              : 
    1758            0 :   str += "\n Conditional expr: " + condition->to_string ();
    1759              : 
    1760            0 :   str += "\n Loop block: " + loop_block->to_string ();
    1761              : 
    1762            0 :   return str;
    1763              : }
    1764              : 
    1765              : std::string
    1766            0 : WhileLetLoopExpr::to_string () const
    1767              : {
    1768            0 :   std::string str ("WhileLetLoopExpr: ");
    1769              : 
    1770            0 :   str += "\n Label: ";
    1771            0 :   if (!has_loop_label ())
    1772              :     {
    1773            0 :       str += "none";
    1774              :     }
    1775              :   else
    1776              :     {
    1777            0 :       str += get_loop_label ().to_string ();
    1778              :     }
    1779              : 
    1780            0 :   str += "\n Match arm patterns: ";
    1781            0 :   if (match_arm_pattern == nullptr)
    1782              :     {
    1783            0 :       str += "none";
    1784              :     }
    1785              :   else
    1786              :     {
    1787            0 :       str += "\n  " + match_arm_pattern->to_string ();
    1788              :     }
    1789              : 
    1790            0 :   str += "\n Scrutinee expr: " + condition->to_string ();
    1791              : 
    1792            0 :   str += "\n Loop block: " + loop_block->to_string ();
    1793              : 
    1794            0 :   return str;
    1795              : }
    1796              : 
    1797              : std::string
    1798            0 : LoopExpr::to_string () const
    1799              : {
    1800            0 :   std::string str ("LoopExpr: (infinite loop)");
    1801              : 
    1802            0 :   str += "\n Label: ";
    1803            0 :   if (!has_loop_label ())
    1804              :     {
    1805            0 :       str += "none";
    1806              :     }
    1807              :   else
    1808              :     {
    1809            0 :       str += get_loop_label ().to_string ();
    1810              :     }
    1811              : 
    1812            0 :   str += "\n Loop block: " + loop_block->to_string ();
    1813              : 
    1814            0 :   return str;
    1815              : }
    1816              : 
    1817              : std::string
    1818            0 : ArrayExpr::to_string () const
    1819              : {
    1820            0 :   std::string str ("ArrayExpr:");
    1821              : 
    1822              :   // inner attributes
    1823            0 :   str += "\n inner attributes: ";
    1824            0 :   if (inner_attrs.empty ())
    1825              :     {
    1826            0 :       str += "none";
    1827              :     }
    1828              :   else
    1829              :     {
    1830              :       /* note that this does not print them with "inner attribute" syntax -
    1831              :        * just the body */
    1832            0 :       for (const auto &attr : inner_attrs)
    1833              :         {
    1834            0 :           str += "\n  " + attr.as_string ();
    1835              :         }
    1836              :     }
    1837              : 
    1838            0 :   str += "\n Array elems: ";
    1839            0 :   if (!has_array_elems ())
    1840              :     {
    1841            0 :       str += "none";
    1842              :     }
    1843              :   else
    1844              :     {
    1845            0 :       str += internal_elements->to_string ();
    1846              :     }
    1847              : 
    1848            0 :   return str;
    1849              : }
    1850              : 
    1851              : std::string
    1852            0 : AwaitExpr::to_string () const
    1853              : {
    1854            0 :   return awaited_expr->to_string () + ".await";
    1855              : }
    1856              : 
    1857              : std::string
    1858            0 : BreakExpr::to_string () const
    1859              : {
    1860            0 :   std::string str ("break ");
    1861              : 
    1862            0 :   if (has_label ())
    1863              :     {
    1864            0 :       str += get_label ().to_string () + " ";
    1865              :     }
    1866              : 
    1867            0 :   if (has_break_expr ())
    1868              :     {
    1869            0 :       str += break_expr->to_string ();
    1870              :     }
    1871              : 
    1872            0 :   return str;
    1873              : }
    1874              : 
    1875              : std::string
    1876            0 : LoopLabel::to_string () const
    1877              : {
    1878            0 :   return label.to_string () + ": (label) ";
    1879              : }
    1880              : 
    1881              : std::string
    1882            0 : MatchArm::to_string () const
    1883              : {
    1884              :   // outer attributes
    1885            0 :   std::string str = "Outer attributes: ";
    1886            0 :   if (outer_attrs.empty ())
    1887              :     {
    1888            0 :       str += "none";
    1889              :     }
    1890              :   else
    1891              :     {
    1892              :       /* note that this does not print them with "outer attribute" syntax -
    1893              :        * just the body */
    1894            0 :       for (const auto &attr : outer_attrs)
    1895              :         {
    1896            0 :           str += "\n " + attr.as_string ();
    1897              :         }
    1898              :     }
    1899              : 
    1900            0 :   str += "\nPatterns: ";
    1901            0 :   if (match_arm_pattern == nullptr)
    1902            0 :     str += "none";
    1903              :   else
    1904            0 :     str += "\n " + match_arm_pattern->to_string ();
    1905              : 
    1906            0 :   str += "\nGuard expr: ";
    1907            0 :   if (!has_match_arm_guard ())
    1908              :     {
    1909            0 :       str += "none";
    1910              :     }
    1911              :   else
    1912              :     {
    1913            0 :       str += guard_expr->to_string ();
    1914              :     }
    1915              : 
    1916            0 :   return str;
    1917              : }
    1918              : 
    1919              : std::string
    1920            0 : MatchCase::to_debug_string () const
    1921              : {
    1922            0 :   std::string str ("MatchCase: (match arm) ");
    1923              : 
    1924            0 :   str += "\n Match arm matcher: \n" + arm.to_string ();
    1925            0 :   str += "\n Expr: " + expr->to_string ();
    1926              : 
    1927            0 :   return str;
    1928              : }
    1929              : 
    1930              : std::string
    1931            0 : MatchCase::to_string () const
    1932              : {
    1933            0 :   std::string str = arm.to_string ();
    1934            0 :   str += " => ";
    1935            0 :   str += expr ? expr->to_string () : "null";
    1936            0 :   return str;
    1937              : }
    1938              : 
    1939              : /*std::string
    1940              : MatchCaseBlockExpr::to_string () const
    1941              : {
    1942              :   std::string str = MatchCase::to_string ();
    1943              : 
    1944              :   str += "\n Block expr: " + block_expr->to_string ();
    1945              : 
    1946              :   return str;
    1947              : }
    1948              : 
    1949              : std::string
    1950              : MatchCaseExpr::to_string () const
    1951              : {
    1952              :   std::string str = MatchCase::to_string ();
    1953              : 
    1954              :   str += "\n Expr: " + expr->to_string ();
    1955              : 
    1956              :   return str;
    1957              : }*/
    1958              : 
    1959              : std::string
    1960            0 : MatchExpr::to_string () const
    1961              : {
    1962            0 :   std::string str ("MatchExpr:");
    1963              : 
    1964            0 :   str += "\n Scrutinee expr: " + branch_value->to_string ();
    1965              : 
    1966              :   // inner attributes
    1967            0 :   str += "\n inner attributes: ";
    1968            0 :   if (inner_attrs.empty ())
    1969              :     {
    1970            0 :       str += "none";
    1971              :     }
    1972              :   else
    1973              :     {
    1974              :       /* note that this does not print them with "inner attribute" syntax -
    1975              :        * just the body */
    1976            0 :       for (const auto &attr : inner_attrs)
    1977              :         {
    1978            0 :           str += "\n  " + attr.as_string ();
    1979              :         }
    1980              :     }
    1981              : 
    1982              :   // match arms
    1983            0 :   str += "\n Match arms: ";
    1984            0 :   if (match_arms.empty ())
    1985              :     {
    1986            0 :       str += "none";
    1987              :     }
    1988              :   else
    1989              :     {
    1990            0 :       for (const auto &arm : match_arms)
    1991            0 :         str += "\n  " + arm.to_string ();
    1992              :     }
    1993              : 
    1994            0 :   return str;
    1995              : }
    1996              : 
    1997              : std::string
    1998            0 : TupleExpr::to_string () const
    1999              : {
    2000            0 :   std::string str ("TupleExpr:");
    2001              : 
    2002              :   // inner attributes
    2003            0 :   str += "\n inner attributes: ";
    2004            0 :   if (inner_attrs.empty ())
    2005              :     {
    2006            0 :       str += "none";
    2007              :     }
    2008              :   else
    2009              :     {
    2010              :       /* note that this does not print them with "inner attribute" syntax -
    2011              :        * just the body */
    2012            0 :       for (const auto &attr : inner_attrs)
    2013              :         {
    2014            0 :           str += "\n  " + attr.as_string ();
    2015              :         }
    2016              :     }
    2017              : 
    2018            0 :   str += "\n Tuple elements: ";
    2019            0 :   if (tuple_elems.empty ())
    2020              :     {
    2021            0 :       str += "none";
    2022              :     }
    2023              :   else
    2024              :     {
    2025            0 :       for (const auto &elem : tuple_elems)
    2026              :         {
    2027            0 :           str += "\n  " + elem->to_string ();
    2028              :         }
    2029              :     }
    2030              : 
    2031            0 :   return str;
    2032              : }
    2033              : 
    2034              : std::string
    2035            0 : FunctionParam::to_string () const
    2036              : {
    2037            0 :   return param_name->to_string () + " : " + type->to_string ();
    2038              : }
    2039              : 
    2040              : std::string
    2041            2 : FunctionQualifiers::to_string () const
    2042              : {
    2043            2 :   std::string str;
    2044              : 
    2045            2 :   if (is_const ())
    2046            0 :     str += "const ";
    2047            2 :   if (is_async ())
    2048            0 :     str += "async ";
    2049            2 :   if (is_unsafe ())
    2050            0 :     str += "unsafe ";
    2051              : 
    2052            2 :   if (has_extern)
    2053              :     {
    2054            0 :       str += "extern";
    2055            0 :       str += " \"" + get_string_from_abi (abi) + "\"";
    2056              :     }
    2057              : 
    2058            2 :   return str;
    2059              : }
    2060              : 
    2061              : std::string
    2062            0 : TraitBound::to_debug_string () const
    2063              : {
    2064            0 :   std::string str ("TraitBound:");
    2065              : 
    2066            0 :   switch (polarity)
    2067              :     {
    2068              :     case RegularBound:
    2069              :       break;
    2070            0 :     case NegativeBound:
    2071            0 :       str += "!";
    2072            0 :       break;
    2073            0 :     case AntiBound:
    2074            0 :       str += "?";
    2075            0 :       break;
    2076              :     }
    2077              : 
    2078            0 :   str += "\n For lifetimes: ";
    2079            0 :   if (!has_for_lifetimes ())
    2080              :     {
    2081            0 :       str += "none";
    2082              :     }
    2083              :   else
    2084              :     {
    2085            0 :       for (const auto &lifetime : for_lifetimes)
    2086              :         {
    2087            0 :           str += "\n  " + lifetime.to_string ();
    2088              :         }
    2089              :     }
    2090              : 
    2091            0 :   str += "\n Type path: " + type_path.to_string ();
    2092              : 
    2093            0 :   return str;
    2094              : }
    2095              : 
    2096              : std::string
    2097            7 : TraitBound::to_string () const
    2098              : {
    2099            7 :   std::string str;
    2100            7 :   switch (polarity)
    2101              :     {
    2102              :     case RegularBound:
    2103              :       break;
    2104            0 :     case NegativeBound:
    2105            0 :       str += "!";
    2106            0 :       break;
    2107            0 :     case AntiBound:
    2108            0 :       str += "?";
    2109            0 :       break;
    2110              :     }
    2111              : 
    2112            7 :   if (has_for_lifetimes ())
    2113            0 :     for (const auto &lifetime : for_lifetimes)
    2114            0 :       str += "\n  " + lifetime.to_string ();
    2115              : 
    2116           14 :   str += "\n" + type_path.to_string ();
    2117              : 
    2118            7 :   return str;
    2119              : }
    2120              : 
    2121              : std::string
    2122            8 : QualifiedPathInType::to_string () const
    2123              : {
    2124            8 :   std::string str = path_type.to_string ();
    2125              : 
    2126           16 :   str += "::" + associated_segment->to_string ();
    2127            8 :   for (const auto &segment : segments)
    2128              :     {
    2129            0 :       str += "::" + segment->to_string ();
    2130              :     }
    2131              : 
    2132            8 :   return str;
    2133              : }
    2134              : 
    2135              : std::string
    2136          151 : Lifetime::to_string () const
    2137              : {
    2138          151 :   switch (lifetime_type)
    2139              :     {
    2140           40 :     case AST::Lifetime::LifetimeType::NAMED:
    2141           40 :       return "'" + lifetime_name;
    2142           14 :     case AST::Lifetime::LifetimeType::STATIC:
    2143           14 :       return "'static";
    2144           97 :     case AST::Lifetime::LifetimeType::WILDCARD:
    2145           97 :       return "'_";
    2146            0 :     default:
    2147            0 :       return "ERROR-MARK-STRING: lifetime type failure";
    2148              :     }
    2149              : }
    2150              : 
    2151              : std::string
    2152         2211 : TypePath::to_string () const
    2153              : {
    2154         2211 :   std::string str;
    2155              : 
    2156         2211 :   if (has_opening_scope_resolution)
    2157              :     {
    2158           60 :       str = "::";
    2159              :     }
    2160              : 
    2161         4702 :   for (const auto &segment : segments)
    2162              :     {
    2163         7473 :       str += segment->to_string () + "::";
    2164              :     }
    2165              : 
    2166              :   // kinda hack - remove last 2 '::' characters
    2167         2211 :   str.erase (str.length () - 2);
    2168              : 
    2169         2211 :   return str;
    2170              : }
    2171              : 
    2172              : std::string
    2173            0 : TypeParam::to_debug_string () const
    2174              : {
    2175            0 :   std::string str ("TypeParam: ");
    2176              : 
    2177            0 :   str += "\n Outer attributes: ";
    2178            0 :   if (outer_attrs.empty ())
    2179              :     {
    2180            0 :       str += "\nnone";
    2181              :     }
    2182              :   else
    2183              :     {
    2184              :       /* note that this does not print them with "outer attribute" syntax -
    2185              :        * just the body */
    2186            0 :       for (const auto &attr : outer_attrs)
    2187              :         {
    2188            0 :           str += "\n " + attr.as_string ();
    2189              :         }
    2190              :     }
    2191              : 
    2192            0 :   str += "\n Identifier: " + type_representation.as_string ();
    2193              : 
    2194            0 :   str += "\n Type param bounds: ";
    2195            0 :   if (!has_type_param_bounds ())
    2196              :     {
    2197            0 :       str += "none";
    2198              :     }
    2199              :   else
    2200              :     {
    2201            0 :       for (const auto &bound : type_param_bounds)
    2202              :         {
    2203            0 :           str += "\n  " + bound->to_string ();
    2204              :         }
    2205              :     }
    2206              : 
    2207            0 :   str += "\n Type: ";
    2208            0 :   if (!has_type ())
    2209              :     {
    2210            0 :       str += "none";
    2211              :     }
    2212              :   else
    2213              :     {
    2214            0 :       str += type.value ()->to_string ();
    2215              :     }
    2216              : 
    2217            0 :   return str;
    2218              : }
    2219              : 
    2220              : std::string
    2221            0 : TypeParam::to_string () const
    2222              : {
    2223            0 :   std::string str;
    2224            0 :   if (!outer_attrs.empty ())
    2225              :     {
    2226            0 :       for (const auto &attr : outer_attrs)
    2227              :         {
    2228            0 :           str += attr.as_string () + "\n";
    2229              :         }
    2230              :     }
    2231              : 
    2232            0 :   str += type_representation.as_string ();
    2233              : 
    2234            0 :   if (!has_type_param_bounds ())
    2235              :     {
    2236            0 :       str += ": ";
    2237            0 :       for (size_t i = 0; i < type_param_bounds.size (); ++i)
    2238              :         {
    2239            0 :           if (i > 0)
    2240            0 :             str += " + ";
    2241            0 :           str += type_param_bounds[i]->to_string ();
    2242              :         }
    2243              :     }
    2244              : 
    2245            0 :   if (has_type ())
    2246            0 :     str += ": " + type.value ()->to_string ();
    2247              : 
    2248            0 :   return str;
    2249              : }
    2250              : 
    2251              : AST::SimplePath
    2252            5 : PathPattern::convert_to_simple_path (bool with_opening_scope_resolution) const
    2253              : {
    2254            5 :   rust_assert (kind == Kind::Segmented);
    2255              : 
    2256            5 :   if (!has_segments ())
    2257              :     {
    2258            0 :       return AST::SimplePath::create_empty ();
    2259              :     }
    2260              : 
    2261              :   // create vector of reserved size (to minimise reallocations)
    2262            5 :   std::vector<AST::SimplePathSegment> simple_segments;
    2263            5 :   simple_segments.reserve (segments.size ());
    2264              : 
    2265           10 :   for (const auto &segment : segments)
    2266              :     {
    2267              :       // return empty path if doesn't meet simple path segment requirements
    2268            5 :       if (segment.has_generic_args () || segment.to_string () == "Self")
    2269              :         {
    2270            0 :           return AST::SimplePath::create_empty ();
    2271              :         }
    2272              : 
    2273              :       // create segment and add to vector
    2274            5 :       std::string segment_str = segment.to_string ();
    2275            5 :       simple_segments.emplace_back (std::move (segment_str),
    2276            5 :                                     segment.get_locus ());
    2277            5 :     }
    2278              : 
    2279              :   // kind of a HACK to get locus depending on opening scope resolution
    2280            5 :   location_t locus = UNKNOWN_LOCATION;
    2281            5 :   if (with_opening_scope_resolution)
    2282              :     {
    2283            0 :       locus = simple_segments[0].get_locus () - 2; // minus 2 chars for ::
    2284              :     }
    2285              :   else
    2286              :     {
    2287            5 :       locus = simple_segments[0].get_locus ();
    2288              :     }
    2289              : 
    2290            5 :   return AST::SimplePath (std::move (simple_segments),
    2291            5 :                           with_opening_scope_resolution, locus);
    2292            5 : }
    2293              : 
    2294              : AST::SimplePath
    2295            3 : TypePath::as_simple_path () const
    2296              : {
    2297            3 :   if (segments.empty ())
    2298              :     {
    2299            0 :       return AST::SimplePath::create_empty ();
    2300              :     }
    2301              : 
    2302              :   // create vector of reserved size (to minimise reallocations)
    2303            3 :   std::vector<AST::SimplePathSegment> simple_segments;
    2304            3 :   simple_segments.reserve (segments.size ());
    2305              : 
    2306            6 :   for (const auto &segment : segments)
    2307              :     {
    2308              :       // return empty path if doesn't meet simple path segment requirements
    2309            3 :       if (segment == nullptr || segment->is_error ()
    2310            6 :           || !segment->is_ident_only () || segment->to_string () == "Self")
    2311              :         {
    2312            0 :           return AST::SimplePath::create_empty ();
    2313              :         }
    2314              : 
    2315              :       // create segment and add to vector
    2316            3 :       std::string segment_str = segment->to_string ();
    2317            3 :       simple_segments.emplace_back (std::move (segment_str),
    2318            3 :                                     segment->get_locus ());
    2319            3 :     }
    2320              : 
    2321            3 :   return AST::SimplePath (std::move (simple_segments),
    2322            3 :                           has_opening_scope_resolution, locus);
    2323            3 : }
    2324              : 
    2325              : std::string
    2326           81 : PathExprSegment::to_string () const
    2327              : {
    2328           81 :   std::string ident_str = segment_name.to_string ();
    2329           81 :   if (has_generic_args ())
    2330              :     {
    2331            0 :       ident_str += "::<" + generic_args.to_string () + ">";
    2332              :     }
    2333              : 
    2334           81 :   return ident_str;
    2335              : }
    2336              : 
    2337              : std::string
    2338         2096 : GenericArgs::to_string () const
    2339              : {
    2340         2096 :   std::string args;
    2341              : 
    2342              :   // lifetime args
    2343         2096 :   if (!lifetime_args.empty ())
    2344              :     {
    2345           59 :       auto i = lifetime_args.begin ();
    2346           59 :       auto e = lifetime_args.end ();
    2347              : 
    2348           59 :       for (; i != e; i++)
    2349              :         {
    2350           60 :           args += (*i).to_string ();
    2351           30 :           if (e != i + 1)
    2352            1 :             args += ", ";
    2353              :         }
    2354              :     }
    2355              : 
    2356              :   // type args
    2357         2096 :   if (!type_args.empty ())
    2358              :     {
    2359         4233 :       auto i = type_args.begin ();
    2360         4233 :       auto e = type_args.end ();
    2361              : 
    2362         4233 :       for (; i != e; i++)
    2363              :         {
    2364         4420 :           args += (*i)->to_string ();
    2365         2210 :           if (e != i + 1)
    2366          187 :             args += ", ";
    2367              :         }
    2368              :     }
    2369              : 
    2370              :   // binding args
    2371         2096 :   if (!binding_args.empty ())
    2372              :     {
    2373            0 :       auto i = binding_args.begin ();
    2374            0 :       auto e = binding_args.end ();
    2375              : 
    2376            0 :       for (; i != e; i++)
    2377              :         {
    2378            0 :           args += (*i).to_string ();
    2379            0 :           if (e != i + 1)
    2380            0 :             args += ", ";
    2381              :         }
    2382              :     }
    2383              : 
    2384         2096 :   return args;
    2385              : }
    2386              : 
    2387              : std::string
    2388            0 : GenericArgsBinding::to_string () const
    2389              : {
    2390            0 :   auto type_string = type->to_string ();
    2391            0 :   auto separator = kind == Kind::Constraint ? " : " : " = ";
    2392            0 :   return identifier.as_string () + separator + type_string;
    2393            0 : }
    2394              : 
    2395              : std::string
    2396            0 : RangePattern::to_string () const
    2397              : {
    2398            0 :   if (has_ellipsis_syntax)
    2399              :     {
    2400            0 :       return lower->to_string () + "..." + upper->to_string ();
    2401              :     }
    2402              :   else
    2403              :     {
    2404            0 :       return lower->to_string () + "..=" + upper->to_string ();
    2405              :     }
    2406              : }
    2407              : 
    2408              : std::string
    2409            0 : RangePatternBoundLiteral::to_string () const
    2410              : {
    2411            0 :   std::string str;
    2412              : 
    2413            0 :   if (has_minus)
    2414              :     {
    2415            0 :       str += "-";
    2416              :     }
    2417              : 
    2418            0 :   str += literal.as_string ();
    2419              : 
    2420            0 :   return str;
    2421              : }
    2422              : 
    2423              : std::string
    2424            3 : SlicePatternItemsNoRest::to_string () const
    2425              : {
    2426            3 :   std::string str;
    2427              : 
    2428           12 :   for (const auto &pattern : patterns)
    2429              :     {
    2430           18 :       str += "\n " + pattern->to_string ();
    2431              :     }
    2432              : 
    2433            3 :   return str;
    2434              : }
    2435              : 
    2436              : std::string
    2437            0 : SlicePatternItemsHasRest::to_string () const
    2438              : {
    2439            0 :   std::string str;
    2440              : 
    2441            0 :   str += "\n Lower patterns: ";
    2442            0 :   if (lower_patterns.empty ())
    2443              :     {
    2444            0 :       str += "none";
    2445              :     }
    2446              :   else
    2447              :     {
    2448            0 :       for (const auto &lower : lower_patterns)
    2449              :         {
    2450            0 :           str += "\n  " + lower->to_string ();
    2451              :         }
    2452              :     }
    2453              : 
    2454            0 :   str += "\n Rest binding pattern: ";
    2455            0 :   if (rest_bind)
    2456            0 :     str += rest_bind->to_string ();
    2457              :   else
    2458            0 :     str += "none";
    2459              : 
    2460            0 :   str += "\n Upper patterns: ";
    2461            0 :   if (upper_patterns.empty ())
    2462              :     {
    2463            0 :       str += "none";
    2464              :     }
    2465              :   else
    2466              :     {
    2467            0 :       for (const auto &upper : upper_patterns)
    2468              :         {
    2469            0 :           str += "\n  " + upper->to_string ();
    2470              :         }
    2471              :     }
    2472              : 
    2473            0 :   return str;
    2474              : }
    2475              : 
    2476              : std::string
    2477            3 : SlicePattern::to_string () const
    2478              : {
    2479            3 :   return "SlicePattern: " + items->to_string ();
    2480              : }
    2481              : 
    2482              : std::string
    2483            0 : AltPattern::to_string () const
    2484              : {
    2485            0 :   std::string str ("AltPattern: ");
    2486              : 
    2487            0 :   for (const auto &pattern : alts)
    2488              :     {
    2489            0 :       str += "\n " + pattern->to_string ();
    2490              :     }
    2491              : 
    2492            0 :   return str;
    2493              : }
    2494              : 
    2495              : std::string
    2496           27 : TuplePatternItemsNoRest::to_string () const
    2497              : {
    2498           27 :   std::string str;
    2499              : 
    2500           81 :   for (const auto &pattern : patterns)
    2501              :     {
    2502          108 :       str += "\n " + pattern->to_string ();
    2503              :     }
    2504              : 
    2505           27 :   return str;
    2506              : }
    2507              : 
    2508              : std::string
    2509            9 : TuplePatternItemsHasRest::to_string () const
    2510              : {
    2511            9 :   std::string str;
    2512              : 
    2513            9 :   str += "\n Lower patterns: ";
    2514            9 :   if (lower_patterns.empty ())
    2515              :     {
    2516            6 :       str += "none";
    2517              :     }
    2518              :   else
    2519              :     {
    2520            6 :       for (const auto &lower : lower_patterns)
    2521              :         {
    2522            6 :           str += "\n  " + lower->to_string ();
    2523              :         }
    2524              :     }
    2525              : 
    2526            9 :   str += "\n Upper patterns: ";
    2527            9 :   if (upper_patterns.empty ())
    2528              :     {
    2529            6 :       str += "none";
    2530              :     }
    2531              :   else
    2532              :     {
    2533            6 :       for (const auto &upper : upper_patterns)
    2534              :         {
    2535            6 :           str += "\n  " + upper->to_string ();
    2536              :         }
    2537              :     }
    2538              : 
    2539            9 :   return str;
    2540              : }
    2541              : 
    2542              : std::string
    2543           36 : TuplePattern::to_string () const
    2544              : {
    2545           36 :   return items->to_string ();
    2546              : }
    2547              : 
    2548              : std::string
    2549           18 : StructPatternField::to_string () const
    2550              : {
    2551              :   // outer attributes
    2552           18 :   std::string str ("Outer attributes: ");
    2553           18 :   if (outer_attrs.empty ())
    2554              :     {
    2555           18 :       str += "none";
    2556              :     }
    2557              :   else
    2558              :     {
    2559              :       /* note that this does not print them with "outer attribute" syntax -
    2560              :        * just the body */
    2561            0 :       for (const auto &attr : outer_attrs)
    2562              :         {
    2563            0 :           str += "\n    " + attr.as_string ();
    2564              :         }
    2565              :     }
    2566              : 
    2567           18 :   str += "\n   item type: ";
    2568           18 :   switch (get_item_type ())
    2569              :     {
    2570            0 :     case ItemType::TUPLE_PAT:
    2571            0 :       str += "TUPLE_PAT";
    2572            0 :       break;
    2573           12 :     case ItemType::IDENT_PAT:
    2574           12 :       str += "IDENT_PAT";
    2575           12 :       break;
    2576            6 :     case ItemType::IDENT:
    2577            6 :       str += "IDENT";
    2578            6 :       break;
    2579            0 :     default:
    2580            0 :       str += "UNKNOWN";
    2581            0 :       break;
    2582              :     }
    2583              : 
    2584           18 :   return str;
    2585              : }
    2586              : 
    2587              : std::string
    2588            6 : StructPatternFieldIdent::to_string () const
    2589              : {
    2590            6 :   std::string str = StructPatternField::to_string ();
    2591              : 
    2592            6 :   str += "\n";
    2593              : 
    2594            6 :   if (has_ref)
    2595              :     {
    2596            0 :       str += "ref ";
    2597              :     }
    2598              : 
    2599            6 :   if (is_mut ())
    2600              :     {
    2601            0 :       str += "mut ";
    2602              :     }
    2603              : 
    2604            6 :   str += ident.as_string ();
    2605              : 
    2606            6 :   return str;
    2607              : }
    2608              : 
    2609              : std::string
    2610            0 : StructPatternFieldTuplePat::to_string () const
    2611              : {
    2612            0 :   std::string str = StructPatternField::to_string ();
    2613              : 
    2614            0 :   str += "\n";
    2615              : 
    2616            0 :   str += std::to_string (index) + " : " + tuple_pattern->to_string ();
    2617              : 
    2618            0 :   return str;
    2619              : }
    2620              : 
    2621              : std::string
    2622           12 : StructPatternFieldIdentPat::to_string () const
    2623              : {
    2624           12 :   std::string str = StructPatternField::to_string ();
    2625              : 
    2626           12 :   str += "\n";
    2627              : 
    2628           24 :   str += ident.as_string () + " : " + ident_pattern->to_string ();
    2629              : 
    2630           12 :   return str;
    2631              : }
    2632              : 
    2633              : std::string
    2634            9 : StructPatternElements::to_string () const
    2635              : {
    2636            9 :   std::string str ("\n  Fields: ");
    2637              : 
    2638            9 :   if (!has_struct_pattern_fields ())
    2639              :     {
    2640            0 :       str += "none";
    2641              :     }
    2642              :   else
    2643              :     {
    2644           27 :       for (const auto &field : fields)
    2645              :         {
    2646           36 :           str += "\n   " + field->to_string ();
    2647              :         }
    2648              :     }
    2649              : 
    2650            9 :   return str;
    2651              : }
    2652              : 
    2653              : std::string
    2654            9 : StructPattern::to_string () const
    2655              : {
    2656            9 :   std::string str ("StructPattern: \n Path: ");
    2657              : 
    2658           18 :   str += path.to_string ();
    2659              : 
    2660            9 :   str += "\n Struct pattern elems: ";
    2661            9 :   if (!has_struct_pattern_elems ())
    2662              :     {
    2663            0 :       str += "none";
    2664              :     }
    2665              :   else
    2666              :     {
    2667           18 :       str += elems.to_string ();
    2668              :     }
    2669              : 
    2670            9 :   return str;
    2671              : }
    2672              : 
    2673              : std::string
    2674            0 : LiteralPattern::to_string () const
    2675              : {
    2676            0 :   return (has_minus ? "-" : "") + lit.as_string ();
    2677              : }
    2678              : 
    2679              : std::string
    2680           33 : ReferencePattern::to_string () const
    2681              : {
    2682           33 :   std::string str ("&");
    2683              : 
    2684           33 :   if (is_mut ())
    2685              :     {
    2686            0 :       str += "mut ";
    2687              :     }
    2688              : 
    2689           66 :   str += pattern->to_string ();
    2690              : 
    2691           33 :   return str;
    2692              : }
    2693              : 
    2694              : std::string
    2695        61491 : IdentifierPattern::to_string () const
    2696              : {
    2697        61491 :   std::string str;
    2698              : 
    2699        61491 :   if (is_ref)
    2700              :     {
    2701        12653 :       str += "ref ";
    2702              :     }
    2703              : 
    2704        61491 :   if (is_mut ())
    2705              :     {
    2706          917 :       str += "mut ";
    2707              :     }
    2708              : 
    2709        61491 :   str += variable_ident.as_string ();
    2710              : 
    2711        61491 :   if (has_subpattern ())
    2712              :     {
    2713           12 :       str += " @ " + subpattern->to_string ();
    2714              :     }
    2715              : 
    2716        61491 :   return str;
    2717              : }
    2718              : 
    2719              : std::string
    2720           27 : TupleStructItemsNoRest::to_string () const
    2721              : {
    2722           27 :   std::string str;
    2723              : 
    2724           57 :   for (const auto &pattern : patterns)
    2725              :     {
    2726           60 :       str += "\n  " + pattern->to_string ();
    2727              :     }
    2728              : 
    2729           27 :   return str;
    2730              : }
    2731              : 
    2732              : std::string
    2733            6 : TupleStructItemsHasRest::to_string () const
    2734              : {
    2735            6 :   std::string str ("\n  Lower patterns: ");
    2736              : 
    2737            6 :   if (lower_patterns.empty ())
    2738              :     {
    2739            0 :       str += "none";
    2740              :     }
    2741              :   else
    2742              :     {
    2743           12 :       for (const auto &lower : lower_patterns)
    2744              :         {
    2745           12 :           str += "\n   " + lower->to_string ();
    2746              :         }
    2747              :     }
    2748              : 
    2749            6 :   str += "\n  Upper patterns: ";
    2750            6 :   if (upper_patterns.empty ())
    2751              :     {
    2752            0 :       str += "none";
    2753              :     }
    2754              :   else
    2755              :     {
    2756           12 :       for (const auto &upper : upper_patterns)
    2757              :         {
    2758           12 :           str += "\n   " + upper->to_string ();
    2759              :         }
    2760              :     }
    2761              : 
    2762            6 :   return str;
    2763              : }
    2764              : 
    2765              : std::string
    2766           33 : TupleStructPattern::to_string () const
    2767              : {
    2768           33 :   std::string str ("TupleStructPattern: \n Path: ");
    2769              : 
    2770           66 :   str += path.to_string ();
    2771              : 
    2772           66 :   str += "\n Tuple struct items: " + items->to_string ();
    2773              : 
    2774           33 :   return str;
    2775              : }
    2776              : 
    2777              : std::string
    2778            0 : LetStmt::to_string () const
    2779              : {
    2780              :   // outer attributes
    2781            0 :   std::string str = "Outer attributes: ";
    2782            0 :   if (outer_attrs.empty ())
    2783              :     {
    2784            0 :       str += "none";
    2785              :     }
    2786              :   else
    2787              :     {
    2788              :       /* note that this does not print them with "outer attribute" syntax -
    2789              :        * just the body */
    2790            0 :       indent_spaces (enter);
    2791            0 :       for (const auto &attr : outer_attrs)
    2792              :         {
    2793            0 :           str += "\n" + indent_spaces (stay) + attr.as_string ();
    2794              :         }
    2795            0 :       indent_spaces (out);
    2796              :     }
    2797              : 
    2798            0 :   str += "\n" + indent_spaces (stay) + "let " + variables_pattern->to_string ();
    2799              : 
    2800            0 :   if (has_type ())
    2801              :     {
    2802            0 :       str += " : " + get_type ().to_string ();
    2803              :     }
    2804              : 
    2805            0 :   if (has_init_expr ())
    2806              :     {
    2807            0 :       str += " = " + get_init_expr ().to_string ();
    2808              :     }
    2809              : 
    2810            0 :   return str;
    2811              : }
    2812              : 
    2813              : // Used to get outer attributes for expressions.
    2814              : std::string
    2815            0 : Expr::to_string () const
    2816              : {
    2817              :   // outer attributes
    2818            0 :   std::string str = "outer attributes: ";
    2819            0 :   if (outer_attrs.empty ())
    2820              :     {
    2821            0 :       str += "none";
    2822              :     }
    2823              :   else
    2824              :     {
    2825              :       /* note that this does not print them with "outer attribute" syntax -
    2826              :        * just the body */
    2827            0 :       for (const auto &attr : outer_attrs)
    2828              :         {
    2829            0 :           str += "\n  " + attr.as_string ();
    2830              :         }
    2831              :     }
    2832              : 
    2833            0 :   return str;
    2834              : }
    2835              : 
    2836              : // hopefully definition here will prevent circular dependency issue
    2837              : std::unique_ptr<TraitBound>
    2838            0 : TypePath::to_trait_bound (bool in_parens) const
    2839              : {
    2840              :   // If already in parentheses, don't convert to trait bound
    2841              :   // This ensures (TypePath) stays as ParenthesisedType in the parser
    2842            0 :   if (in_parens)
    2843            0 :     return nullptr;
    2844              : 
    2845              :   // create clone FIXME is this required? or is copy constructor automatically
    2846              :   // called?
    2847            0 :   TypePath copy (*this);
    2848            0 :   return std::make_unique<TraitBound> (mappings, std::move (copy),
    2849            0 :                                        copy.get_locus (), in_parens);
    2850            0 : }
    2851              : 
    2852              : std::string
    2853            3 : InferredType::to_string () const
    2854              : {
    2855            3 :   return "_ (inferred)";
    2856              : }
    2857              : 
    2858              : std::string
    2859            0 : TypeCastExpr::to_string () const
    2860              : {
    2861            0 :   return main_or_left_expr->to_string () + " as "
    2862            0 :          + type_to_convert_to->to_string ();
    2863              : }
    2864              : 
    2865              : std::string
    2866            0 : ImplTraitType::to_string () const
    2867              : {
    2868            0 :   std::string str ("ImplTraitType: \n TypeParamBounds: ");
    2869              : 
    2870            0 :   if (type_param_bounds.empty ())
    2871              :     {
    2872            0 :       str += "none";
    2873              :     }
    2874              :   else
    2875              :     {
    2876            0 :       for (const auto &bound : type_param_bounds)
    2877              :         {
    2878            0 :           str += "\n  " + bound->to_string ();
    2879              :         }
    2880              :     }
    2881              : 
    2882            0 :   return str;
    2883              : }
    2884              : 
    2885              : std::string
    2886          114 : ReferenceType::to_string () const
    2887              : {
    2888          114 :   std::string str ("&");
    2889              : 
    2890          114 :   if (has_lifetime ())
    2891              :     {
    2892          342 :       str += get_lifetime ().to_string () + " ";
    2893              :     }
    2894              : 
    2895          114 :   if (is_mut ())
    2896              :     {
    2897            8 :       str += "mut ";
    2898              :     }
    2899              : 
    2900          228 :   str += type->to_string ();
    2901              : 
    2902          114 :   return str;
    2903              : }
    2904              : 
    2905              : std::string
    2906            0 : RawPointerType::to_string () const
    2907              : {
    2908            0 :   return std::string ("*") + (is_mut () ? "mut " : "const ")
    2909            0 :          + type->to_string ();
    2910              : }
    2911              : 
    2912              : std::string
    2913            7 : TraitObjectType::to_string () const
    2914              : {
    2915            7 :   std::string str ("TraitObjectType: \n Has dyn dispatch: ");
    2916              : 
    2917            7 :   if (has_dyn)
    2918              :     {
    2919            7 :       str += "true";
    2920              :     }
    2921              :   else
    2922              :     {
    2923            0 :       str += "false";
    2924              :     }
    2925              : 
    2926            7 :   str += "\n TypeParamBounds: ";
    2927            7 :   if (type_param_bounds.empty ())
    2928              :     {
    2929            0 :       str += "none";
    2930              :     }
    2931              :   else
    2932              :     {
    2933           14 :       for (const auto &bound : type_param_bounds)
    2934              :         {
    2935           14 :           str += "\n  " + bound->to_string ();
    2936              :         }
    2937              :     }
    2938              : 
    2939            7 :   return str;
    2940              : }
    2941              : 
    2942              : std::string
    2943            2 : BareFunctionType::to_string () const
    2944              : {
    2945            2 :   std::string str ("BareFunctionType: \n For lifetimes: ");
    2946              : 
    2947            2 :   if (!has_for_lifetimes ())
    2948              :     {
    2949            2 :       str += "none";
    2950              :     }
    2951              :   else
    2952              :     {
    2953            0 :       for (const auto &for_lifetime : for_lifetimes)
    2954              :         {
    2955            0 :           str += "\n  " + for_lifetime.to_string ();
    2956              :         }
    2957              :     }
    2958              : 
    2959            4 :   str += "\n Qualifiers: " + function_qualifiers.to_string ();
    2960              : 
    2961            2 :   str += "\n Params: ";
    2962            2 :   if (params.empty ())
    2963              :     {
    2964            2 :       str += "none";
    2965              :     }
    2966              :   else
    2967              :     {
    2968            0 :       for (const auto &param : params)
    2969              :         {
    2970            0 :           str += "\n  " + param.to_string ();
    2971              :         }
    2972              :     }
    2973              : 
    2974            2 :   str += "\n Is variadic: ";
    2975            2 :   if (is_variadic)
    2976              :     {
    2977            0 :       str += "true";
    2978              :     }
    2979              :   else
    2980              :     {
    2981            2 :       str += "false";
    2982              :     }
    2983              : 
    2984            2 :   str += "\n Return type: ";
    2985            2 :   if (!has_return_type ())
    2986              :     {
    2987            2 :       str += "none (void)";
    2988              :     }
    2989              :   else
    2990              :     {
    2991            0 :       str += return_type->to_string ();
    2992              :     }
    2993              : 
    2994            2 :   return str;
    2995              : }
    2996              : 
    2997              : std::string
    2998         2096 : TypePathSegmentGeneric::to_string () const
    2999              : {
    3000         6288 :   return TypePathSegment::to_string () + "<" + generic_args.to_string () + ">";
    3001              : }
    3002              : 
    3003              : std::string
    3004            0 : TypePathFunction::to_string () const
    3005              : {
    3006            0 :   std::string str ("(");
    3007              : 
    3008            0 :   if (has_inputs ())
    3009              :     {
    3010            0 :       auto i = inputs.begin ();
    3011            0 :       auto e = inputs.end ();
    3012              : 
    3013            0 :       for (; i != e; i++)
    3014              :         {
    3015            0 :           str += (*i)->to_string ();
    3016            0 :           if (e != i + 1)
    3017            0 :             str += ", ";
    3018              :         }
    3019              :     }
    3020              : 
    3021            0 :   str += ")";
    3022              : 
    3023            0 :   if (has_return_type ())
    3024              :     {
    3025            0 :       str += " -> " + return_type->to_string ();
    3026              :     }
    3027              : 
    3028            0 :   return str;
    3029              : }
    3030              : 
    3031              : std::string
    3032            0 : TypePathSegmentFunction::to_string () const
    3033              : {
    3034            0 :   return TypePathSegment::to_string () + function_path.to_string ();
    3035              : }
    3036              : 
    3037              : std::string
    3038           18 : ArrayType::to_string () const
    3039              : {
    3040           54 :   return "[" + elem_type->to_string () + "; " + size->to_string () + "]";
    3041              : }
    3042              : 
    3043              : std::string
    3044           45 : SliceType::to_string () const
    3045              : {
    3046           90 :   return "[" + elem_type->to_string () + "]";
    3047              : }
    3048              : 
    3049              : std::string
    3050            9 : TupleType::to_string () const
    3051              : {
    3052            9 :   std::string str ("(");
    3053              : 
    3054            9 :   if (!is_unit_type ())
    3055              :     {
    3056            8 :       auto i = elems.begin ();
    3057            8 :       auto e = elems.end ();
    3058              : 
    3059            8 :       for (; i != e; i++)
    3060              :         {
    3061           10 :           str += (*i)->to_string ();
    3062            5 :           if (e != i + 1)
    3063            2 :             str += ", ";
    3064              :         }
    3065              :     }
    3066              : 
    3067            9 :   str += ")";
    3068              : 
    3069            9 :   return str;
    3070              : }
    3071              : 
    3072              : std::string
    3073            0 : StructExpr::to_string () const
    3074              : {
    3075            0 :   std::string str = ExprWithoutBlock::to_string ();
    3076            0 :   indent_spaces (enter);
    3077            0 :   str += "\n" + indent_spaces (stay) + "StructExpr:";
    3078            0 :   indent_spaces (enter);
    3079            0 :   str += "\n" + indent_spaces (stay) + "PathInExpr:\n";
    3080            0 :   str += indent_spaces (stay) + struct_name.to_string ();
    3081            0 :   indent_spaces (out);
    3082            0 :   indent_spaces (out);
    3083            0 :   return str;
    3084              : }
    3085              : 
    3086              : std::string
    3087            0 : StructExprStruct::to_string () const
    3088              : {
    3089            0 :   std::string str ("StructExprStruct (or subclass): ");
    3090              : 
    3091            0 :   str += "\n Path: " + struct_name.to_string ();
    3092              : 
    3093              :   // inner attributes
    3094            0 :   str += "\n inner attributes: ";
    3095            0 :   if (inner_attrs.empty ())
    3096              :     {
    3097            0 :       str += "none";
    3098              :     }
    3099              :   else
    3100              :     {
    3101              :       /* note that this does not print them with "inner attribute" syntax -
    3102              :        * just the body */
    3103            0 :       for (const auto &attr : inner_attrs)
    3104              :         {
    3105            0 :           str += "\n  " + attr.as_string ();
    3106              :         }
    3107              :     }
    3108              : 
    3109            0 :   return str;
    3110              : }
    3111              : 
    3112              : std::string
    3113            0 : StructBase::to_string () const
    3114              : {
    3115            0 :   if (base_struct != nullptr)
    3116              :     {
    3117            0 :       return base_struct->to_string ();
    3118              :     }
    3119              :   else
    3120              :     {
    3121            0 :       return "ERROR_MARK_STRING - invalid struct base had as string applied";
    3122              :     }
    3123              : }
    3124              : 
    3125              : std::string
    3126            0 : StructExprFieldWithVal::to_string () const
    3127              : {
    3128              :   // used to get value string
    3129            0 :   return value->to_string ();
    3130              : }
    3131              : 
    3132              : std::string
    3133            0 : StructExprFieldIdentifierValue::to_string () const
    3134              : {
    3135            0 :   return field_name.as_string () + " : " + StructExprFieldWithVal::to_string ();
    3136              : }
    3137              : 
    3138              : std::string
    3139            0 : StructExprFieldIndexValue::to_string () const
    3140              : {
    3141            0 :   return std::to_string (index) + " : " + StructExprFieldWithVal::to_string ();
    3142              : }
    3143              : 
    3144              : std::string
    3145            0 : StructExprStructFields::to_string () const
    3146              : {
    3147            0 :   std::string str = StructExprStruct::to_string ();
    3148              : 
    3149            0 :   str += "\n Fields: ";
    3150            0 :   if (fields.empty ())
    3151              :     {
    3152            0 :       str += "none";
    3153              :     }
    3154              :   else
    3155              :     {
    3156            0 :       for (const auto &field : fields)
    3157              :         {
    3158            0 :           str += "\n  " + field->to_string ();
    3159              :         }
    3160              :     }
    3161              : 
    3162            0 :   str += "\n Struct base: ";
    3163            0 :   if (!has_struct_base ())
    3164              :     {
    3165            0 :       str += "none";
    3166              :     }
    3167              :   else
    3168              :     {
    3169            0 :       str += (*struct_base)->to_string ();
    3170              :     }
    3171              : 
    3172            0 :   return str;
    3173              : }
    3174              : 
    3175              : std::string
    3176            0 : EnumItem::to_string () const
    3177              : {
    3178            0 :   std::string str = Item::to_string ();
    3179            0 :   str += variant_name.as_string ();
    3180            0 :   str += " ";
    3181            0 :   switch (get_enum_item_kind ())
    3182              :     {
    3183            0 :     case Named:
    3184            0 :       str += "[Named variant]";
    3185            0 :       break;
    3186            0 :     case Tuple:
    3187            0 :       str += "[Tuple variant]";
    3188            0 :       break;
    3189            0 :     case Struct:
    3190            0 :       str += "[Struct variant]";
    3191            0 :       break;
    3192            0 :     case Discriminant:
    3193            0 :       str += "[Discriminant variant]";
    3194            0 :       break;
    3195              :     }
    3196              : 
    3197            0 :   return str;
    3198              : }
    3199              : 
    3200              : std::string
    3201            0 : EnumItemTuple::to_string () const
    3202              : {
    3203            0 :   std::string str = EnumItem::to_string ();
    3204              : 
    3205              :   // add tuple opening parens
    3206            0 :   str += "(";
    3207              : 
    3208              :   // tuple fields
    3209            0 :   if (has_tuple_fields ())
    3210              :     {
    3211            0 :       auto i = tuple_fields.begin ();
    3212            0 :       auto e = tuple_fields.end ();
    3213              : 
    3214            0 :       for (; i != e; i++)
    3215              :         {
    3216            0 :           str += (*i).to_string ();
    3217            0 :           if (e != i + 1)
    3218            0 :             str += ", ";
    3219              :         }
    3220              :     }
    3221              : 
    3222              :   // add tuple closing parens
    3223            0 :   str += ")";
    3224              : 
    3225            0 :   return str;
    3226              : }
    3227              : 
    3228              : std::string
    3229            0 : TupleField::to_string () const
    3230              : {
    3231              :   // outer attributes
    3232            0 :   std::string str = "outer attributes: ";
    3233            0 :   if (outer_attrs.empty ())
    3234              :     {
    3235            0 :       str += "none";
    3236              :     }
    3237              :   else
    3238              :     {
    3239              :       /* note that this does not print them with "outer attribute" syntax -
    3240              :        * just the body */
    3241            0 :       for (const auto &attr : outer_attrs)
    3242              :         {
    3243            0 :           str += "\n  " + attr.as_string ();
    3244              :         }
    3245              :     }
    3246              : 
    3247            0 :   if (has_visibility ())
    3248              :     {
    3249            0 :       str += "\n" + visibility.to_string ();
    3250              :     }
    3251              : 
    3252            0 :   str += " " + field_type->to_string ();
    3253              : 
    3254            0 :   return str;
    3255              : }
    3256              : 
    3257              : std::string
    3258            0 : EnumItemStruct::to_string () const
    3259              : {
    3260            0 :   std::string str = EnumItem::to_string ();
    3261              : 
    3262              :   // add struct opening parens
    3263            0 :   str += "{";
    3264              : 
    3265              :   // tuple fields
    3266            0 :   if (has_struct_fields ())
    3267              :     {
    3268            0 :       auto i = struct_fields.begin ();
    3269            0 :       auto e = struct_fields.end ();
    3270              : 
    3271            0 :       for (; i != e; i++)
    3272              :         {
    3273            0 :           str += (*i).to_string ();
    3274            0 :           if (e != i + 1)
    3275            0 :             str += ", ";
    3276              :         }
    3277              :     }
    3278              : 
    3279              :   // add struct closing parens
    3280            0 :   str += "}";
    3281              : 
    3282            0 :   return str;
    3283              : }
    3284              : 
    3285              : std::string
    3286            0 : StructField::to_string () const
    3287              : {
    3288              :   // outer attributes
    3289            0 :   std::string str = "outer attributes: ";
    3290            0 :   if (outer_attrs.empty ())
    3291              :     {
    3292            0 :       str += "none";
    3293              :     }
    3294              :   else
    3295              :     {
    3296              :       /* note that this does not print them with "outer attribute" syntax -
    3297              :        * just the body */
    3298            0 :       for (const auto &attr : outer_attrs)
    3299              :         {
    3300            0 :           str += "\n  " + attr.as_string ();
    3301              :         }
    3302              :     }
    3303              : 
    3304            0 :   if (has_visibility ())
    3305              :     {
    3306            0 :       str += "\n" + visibility.to_string ();
    3307              :     }
    3308              : 
    3309            0 :   str += " " + field_name.as_string () + " : " + field_type->to_string ();
    3310              : 
    3311            0 :   return str;
    3312              : }
    3313              : 
    3314              : std::string
    3315            0 : EnumItemDiscriminant::to_string () const
    3316              : {
    3317            0 :   std::string str = EnumItem::to_string ();
    3318              : 
    3319              :   // add equal and expression
    3320            0 :   str += " = " + expression->to_string ();
    3321              : 
    3322            0 :   return str;
    3323              : }
    3324              : 
    3325              : std::string
    3326            0 : ExternalItem::to_string () const
    3327              : {
    3328              :   // outer attributes
    3329            0 :   std::string str = "outer attributes: ";
    3330            0 :   if (outer_attrs.empty ())
    3331              :     {
    3332            0 :       str += "none";
    3333              :     }
    3334              :   else
    3335              :     {
    3336              :       /* note that this does not print them with "outer attribute" syntax -
    3337              :        * just the body */
    3338            0 :       for (const auto &attr : outer_attrs)
    3339              :         {
    3340            0 :           str += "\n  " + attr.as_string ();
    3341              :         }
    3342              :     }
    3343              : 
    3344              :   // start visibility on new line and with a space
    3345            0 :   str += "\n" + visibility.to_string () + " ";
    3346              : 
    3347            0 :   return str;
    3348              : }
    3349              : 
    3350              : std::string
    3351            0 : ExternalStaticItem::to_string () const
    3352              : {
    3353            0 :   std::string str = ExternalItem::to_string ();
    3354              : 
    3355            0 :   str += "static ";
    3356              : 
    3357            0 :   if (is_mut ())
    3358              :     {
    3359            0 :       str += "mut ";
    3360              :     }
    3361              : 
    3362              :   // add name
    3363            0 :   str += get_item_name ().as_string ();
    3364              : 
    3365              :   // add type on new line
    3366            0 :   str += "\n Type: " + item_type->to_string ();
    3367              : 
    3368            0 :   return str;
    3369              : }
    3370              : 
    3371              : std::string
    3372            0 : ExternalFunctionItem::to_string () const
    3373              : {
    3374            0 :   std::string str = ExternalItem::to_string ();
    3375              : 
    3376            0 :   str += "fn ";
    3377              : 
    3378              :   // add name
    3379            0 :   str += get_item_name ().as_string ();
    3380              : 
    3381              :   // generic params
    3382            0 :   str += "\n Generic params: ";
    3383            0 :   if (generic_params.empty ())
    3384              :     {
    3385            0 :       str += "none";
    3386              :     }
    3387              :   else
    3388              :     {
    3389            0 :       for (const auto &param : generic_params)
    3390              :         {
    3391              :           // DEBUG: null pointer check
    3392            0 :           if (param == nullptr)
    3393              :             {
    3394            0 :               rust_debug (
    3395              :                 "something really terrible has gone wrong - null pointer "
    3396              :                 "generic param in external function item.");
    3397            0 :               return "nullptr_POINTER_MARK";
    3398              :             }
    3399              : 
    3400            0 :           str += "\n  " + param->to_string ();
    3401              :         }
    3402              :     }
    3403              : 
    3404              :   // function params
    3405            0 :   str += "\n Function params: ";
    3406            0 :   if (function_params.empty ())
    3407              :     {
    3408            0 :       str += "none";
    3409              :     }
    3410              :   else
    3411              :     {
    3412            0 :       for (const auto &param : function_params)
    3413              :         {
    3414            0 :           str += "\n  " + param.to_string ();
    3415              :         }
    3416            0 :       if (has_variadics)
    3417              :         {
    3418            0 :           str += "\n  .. (variadic)";
    3419              :         }
    3420              :     }
    3421              : 
    3422              :   // add type on new line)
    3423            0 :   str += "\n (return) Type: "
    3424            0 :          + (has_return_type () ? return_type->to_string () : "()");
    3425              : 
    3426              :   // where clause
    3427            0 :   str += "\n Where clause: ";
    3428            0 :   if (has_where_clause ())
    3429              :     {
    3430            0 :       str += where_clause.to_string ();
    3431              :     }
    3432              :   else
    3433              :     {
    3434            0 :       str += "none";
    3435              :     }
    3436              : 
    3437            0 :   return str;
    3438            0 : }
    3439              : 
    3440              : std::string
    3441            0 : ExternalTypeItem::to_string () const
    3442              : {
    3443            0 :   std::string str = ExternalItem::to_string ();
    3444              : 
    3445            0 :   str += "type ";
    3446              : 
    3447              :   // add name
    3448            0 :   str += get_item_name ().as_string ();
    3449              : 
    3450            0 :   return str;
    3451              : }
    3452              : 
    3453              : std::string
    3454            0 : NamedFunctionParam::to_string () const
    3455              : {
    3456            0 :   std::string str = name.as_string ();
    3457              : 
    3458            0 :   str += "\n Type: " + param_type->to_string ();
    3459              : 
    3460            0 :   return str;
    3461              : }
    3462              : 
    3463              : /*std::string TraitItem::to_string() const {
    3464              :     // outer attributes
    3465              :     std::string str = "outer attributes: ";
    3466              :     if (outer_attrs.empty()) {
    3467              :         str += "none";
    3468              :     } else {
    3469              :         // note that this does not print them with "outer attribute" syntax -
    3470              : just the body for (const auto& attr : outer_attrs) { str += "\n  " +
    3471              : attr.to_string();
    3472              :         }
    3473              :     }
    3474              : 
    3475              :     return str;
    3476              : }*/
    3477              : 
    3478              : std::string
    3479            0 : TraitItemFunc::to_string () const
    3480              : {
    3481            0 :   std::string str = "outer attributes: ";
    3482            0 :   if (outer_attrs.empty ())
    3483              :     {
    3484            0 :       str += "none";
    3485              :     }
    3486              :   else
    3487              :     {
    3488              :       /* note that this does not print them with "outer attribute" syntax -
    3489              :        * just the body */
    3490            0 :       for (const auto &attr : outer_attrs)
    3491              :         {
    3492            0 :           str += "\n  " + attr.as_string ();
    3493              :         }
    3494              :     }
    3495              : 
    3496            0 :   str += "\n" + decl.to_string ();
    3497              : 
    3498            0 :   str += "\n Definition (block expr): ";
    3499            0 :   if (has_definition ())
    3500              :     {
    3501            0 :       str += block_expr->to_string ();
    3502              :     }
    3503              :   else
    3504              :     {
    3505            0 :       str += "none";
    3506              :     }
    3507              : 
    3508            0 :   return str;
    3509              : }
    3510              : 
    3511              : std::string
    3512            0 : TraitFunctionDecl::to_string () const
    3513              : {
    3514            0 :   std::string str
    3515            0 :     = qualifiers.to_string () + "fn " + function_name.as_string ();
    3516              : 
    3517              :   // generic params
    3518            0 :   str += "\n Generic params: ";
    3519            0 :   if (generic_params.empty ())
    3520              :     {
    3521            0 :       str += "none";
    3522              :     }
    3523              :   else
    3524              :     {
    3525            0 :       for (const auto &param : generic_params)
    3526              :         {
    3527              :           // DEBUG: null pointer check
    3528            0 :           if (param == nullptr)
    3529              :             {
    3530            0 :               rust_debug (
    3531              :                 "something really terrible has gone wrong - null pointer "
    3532              :                 "generic param in trait function decl.");
    3533            0 :               return "nullptr_POINTER_MARK";
    3534              :             }
    3535              : 
    3536            0 :           str += "\n  " + param->to_string ();
    3537              :         }
    3538              :     }
    3539              : 
    3540            0 :   str += "\n Function params: ";
    3541            0 :   if (is_method ())
    3542              :     {
    3543            0 :       str += get_self_unchecked ().to_string () + (has_params () ? ", " : "");
    3544              :     }
    3545              : 
    3546            0 :   if (has_params ())
    3547              :     {
    3548            0 :       for (const auto &param : function_params)
    3549              :         {
    3550            0 :           str += "\n  " + param.to_string ();
    3551              :         }
    3552              :     }
    3553            0 :   else if (!is_method ())
    3554              :     {
    3555            0 :       str += "none";
    3556              :     }
    3557              : 
    3558            0 :   str += "\n Return type: ";
    3559            0 :   if (has_return_type ())
    3560              :     {
    3561            0 :       str += return_type->to_string ();
    3562              :     }
    3563              :   else
    3564              :     {
    3565            0 :       str += "none (void)";
    3566              :     }
    3567              : 
    3568            0 :   str += "\n Where clause: ";
    3569            0 :   if (has_where_clause ())
    3570              :     {
    3571            0 :       str += where_clause.to_string ();
    3572              :     }
    3573              :   else
    3574              :     {
    3575            0 :       str += "none";
    3576              :     }
    3577              : 
    3578            0 :   return str;
    3579            0 : }
    3580              : 
    3581              : std::string
    3582            0 : TraitItemConst::to_string () const
    3583              : {
    3584            0 :   std::string str = "outer attributes: ";
    3585            0 :   if (outer_attrs.empty ())
    3586              :     {
    3587            0 :       str += "none";
    3588              :     }
    3589              :   else
    3590              :     {
    3591              :       /* note that this does not print them with "outer attribute" syntax -
    3592              :        * just the body */
    3593            0 :       for (const auto &attr : outer_attrs)
    3594              :         {
    3595            0 :           str += "\n  " + attr.as_string ();
    3596              :         }
    3597              :     }
    3598              : 
    3599            0 :   str += "\nconst " + name.as_string () + " : " + type->to_string ();
    3600              : 
    3601            0 :   if (has_expression ())
    3602              :     {
    3603            0 :       str += " = " + expr->to_string ();
    3604              :     }
    3605              : 
    3606            0 :   return str;
    3607              : }
    3608              : 
    3609              : std::string
    3610            0 : TraitItemType::to_string () const
    3611              : {
    3612            0 :   std::string str = "outer attributes: ";
    3613            0 :   if (outer_attrs.empty ())
    3614              :     {
    3615            0 :       str += "none";
    3616              :     }
    3617              :   else
    3618              :     {
    3619              :       /* note that this does not print them with "outer attribute" syntax -
    3620              :        * just the body */
    3621            0 :       for (const auto &attr : outer_attrs)
    3622              :         {
    3623            0 :           str += "\n  " + attr.as_string ();
    3624              :         }
    3625              :     }
    3626              : 
    3627            0 :   str += "\ntype " + name.as_string ();
    3628              : 
    3629            0 :   if (has_generics ())
    3630              :     {
    3631            0 :       str += "<";
    3632            0 :       for (size_t i = 0; i < generic_params.size (); i++)
    3633              :         {
    3634            0 :           if (i > 0)
    3635            0 :             str += ", ";
    3636            0 :           str += generic_params[i]->to_string ();
    3637              :         }
    3638            0 :       str += ">";
    3639              :     }
    3640              : 
    3641            0 :   str += "\n Type param bounds: ";
    3642            0 :   if (!has_type_param_bounds ())
    3643              :     {
    3644            0 :       str += "none";
    3645              :     }
    3646              :   else
    3647              :     {
    3648            0 :       for (const auto &bound : type_param_bounds)
    3649              :         {
    3650              :           // DEBUG: null pointer check
    3651            0 :           if (bound == nullptr)
    3652              :             {
    3653            0 :               rust_debug (
    3654              :                 "something really terrible has gone wrong - null pointer "
    3655              :                 "type param bound in trait item type.");
    3656            0 :               return "nullptr_POINTER_MARK";
    3657              :             }
    3658              : 
    3659            0 :           str += "\n  " + bound->to_string ();
    3660              :         }
    3661              :     }
    3662              : 
    3663            0 :   return str;
    3664            0 : }
    3665              : 
    3666              : std::string
    3667            0 : SelfParam::to_string () const
    3668              : {
    3669            0 :   if (has_type ())
    3670              :     {
    3671              :       // type (i.e. not ref, no lifetime)
    3672            0 :       std::string str;
    3673              : 
    3674            0 :       if (is_mut ())
    3675              :         {
    3676            0 :           str += "mut ";
    3677              :         }
    3678              : 
    3679            0 :       str += "self : ";
    3680              : 
    3681            0 :       str += type->to_string ();
    3682              : 
    3683            0 :       return str;
    3684              :     }
    3685            0 :   else if (has_lifetime ())
    3686              :     {
    3687              :       // ref and lifetime
    3688            0 :       std::string str = "&" + get_lifetime ().to_string () + " ";
    3689              : 
    3690            0 :       if (is_mut ())
    3691              :         {
    3692            0 :           str += "mut ";
    3693              :         }
    3694              : 
    3695            0 :       str += "self";
    3696              : 
    3697            0 :       return str;
    3698            0 :     }
    3699            0 :   else if (is_ref ())
    3700              :     {
    3701              :       // ref with no lifetime
    3702            0 :       std::string str = "&";
    3703              : 
    3704            0 :       if (is_mut ())
    3705              :         {
    3706            0 :           str += " mut ";
    3707              :         }
    3708              : 
    3709            0 :       str += "self";
    3710              : 
    3711            0 :       return str;
    3712            0 :     }
    3713              :   else
    3714              :     {
    3715              :       // no ref, no type
    3716            0 :       std::string str;
    3717              : 
    3718            0 :       if (is_mut ())
    3719              :         {
    3720            0 :           str += "mut ";
    3721              :         }
    3722              : 
    3723            0 :       str += "self";
    3724              : 
    3725            0 :       return str;
    3726            0 :     }
    3727              : }
    3728              : 
    3729              : std::string
    3730            0 : ArrayElemsCopied::to_string () const
    3731              : {
    3732            0 :   return elem_to_copy->to_string () + "; " + num_copies->to_string ();
    3733              : }
    3734              : 
    3735              : std::string
    3736            0 : LifetimeWhereClauseItem::to_string () const
    3737              : {
    3738            0 :   std::string str ("Lifetime: ");
    3739              : 
    3740            0 :   str += lifetime.to_string ();
    3741              : 
    3742            0 :   str += "\nLifetime bounds: ";
    3743              : 
    3744            0 :   for (const auto &bound : lifetime_bounds)
    3745              :     {
    3746            0 :       str += "\n " + bound.to_string ();
    3747              :     }
    3748              : 
    3749            0 :   return str;
    3750              : }
    3751              : 
    3752              : std::string
    3753            0 : TypeBoundWhereClauseItem::to_string () const
    3754              : {
    3755            0 :   std::string str ("For lifetimes: ");
    3756              : 
    3757            0 :   if (!has_for_lifetimes ())
    3758              :     {
    3759            0 :       str += "none";
    3760              :     }
    3761              :   else
    3762              :     {
    3763            0 :       for (const auto &for_lifetime : for_lifetimes)
    3764              :         {
    3765            0 :           str += "\n " + for_lifetime.to_string ();
    3766              :         }
    3767              :     }
    3768              : 
    3769            0 :   str += "\nType: " + bound_type->to_string ();
    3770              : 
    3771            0 :   str += "\nType param bounds bounds: ";
    3772              : 
    3773            0 :   for (const auto &bound : type_param_bounds)
    3774              :     {
    3775              :       // debug null pointer check
    3776            0 :       if (bound == nullptr)
    3777              :         {
    3778            0 :           return "nullptr_POINTER_MARK - type param bounds";
    3779              :         }
    3780              : 
    3781            0 :       str += "\n " + bound->to_string ();
    3782              :     }
    3783              : 
    3784            0 :   return str;
    3785            0 : }
    3786              : 
    3787              : std::string
    3788            0 : ArrayElemsValues::to_string () const
    3789              : {
    3790            0 :   std::string str;
    3791              : 
    3792            0 :   for (const auto &expr : values)
    3793              :     {
    3794              :       // DEBUG: null pointer check
    3795            0 :       if (expr == nullptr)
    3796              :         {
    3797            0 :           rust_debug ("something really terrible has gone wrong - null pointer "
    3798              :                       "expr in array elems values.");
    3799            0 :           return "nullptr_POINTER_MARK";
    3800              :         }
    3801              : 
    3802            0 :       str += "\n  " + expr->to_string ();
    3803              :     }
    3804              : 
    3805            0 :   return str;
    3806            0 : }
    3807              : 
    3808              : std::string
    3809            0 : MaybeNamedParam::to_string () const
    3810              : {
    3811            0 :   std::string str;
    3812              : 
    3813            0 :   switch (param_kind)
    3814              :     {
    3815              :     case UNNAMED:
    3816              :       break;
    3817            0 :     case IDENTIFIER:
    3818            0 :       str = name.as_string () + " : ";
    3819            0 :       break;
    3820            0 :     case WILDCARD:
    3821            0 :       str = "_ : ";
    3822            0 :       break;
    3823            0 :     default:
    3824            0 :       return "ERROR_MARK_STRING - maybe named param unrecognised param kind";
    3825              :     }
    3826              : 
    3827            0 :   str += param_type->to_string ();
    3828              : 
    3829            0 :   return str;
    3830            0 : }
    3831              : 
    3832              : std::string
    3833            0 : enum_to_str (MaybeNamedParam::ParamKind pk)
    3834              : {
    3835            0 :   switch (pk)
    3836              :     {
    3837            0 :     case MaybeNamedParam::ParamKind::UNNAMED:
    3838            0 :       return "UNNAMED";
    3839            0 :     case MaybeNamedParam::ParamKind::IDENTIFIER:
    3840            0 :       return "IDENTIFIER";
    3841            0 :     case MaybeNamedParam::ParamKind::WILDCARD:
    3842            0 :       return "WILDCARD";
    3843              :     }
    3844            0 :   gcc_unreachable ();
    3845              : }
    3846              : 
    3847              : std::string
    3848            0 : enum_to_str (UseTreeRebind::NewBindType nbt)
    3849              : {
    3850            0 :   switch (nbt)
    3851              :     {
    3852            0 :     case UseTreeRebind::NewBindType::NONE:
    3853            0 :       return "NONE";
    3854            0 :     case UseTreeRebind::NewBindType::IDENTIFIER:
    3855            0 :       return "IDENTIFIER";
    3856            0 :     case UseTreeRebind::NewBindType::WILDCARD:
    3857            0 :       return "WILDCARD";
    3858              :     }
    3859            0 :   gcc_unreachable ();
    3860              : }
    3861              : 
    3862              : /* Override that calls the function recursively on all items contained within
    3863              :  * the module. */
    3864              : void
    3865            0 : Module::add_crate_name (std::vector<std::string> &names) const
    3866              : {
    3867              :   /* TODO: test whether module has been 'cfg'-ed out to determine whether to
    3868              :    * exclude it from search */
    3869              : 
    3870            0 :   for (const auto &item : items)
    3871            0 :     item->add_crate_name (names);
    3872            0 : }
    3873              : 
    3874              : /* All accept_vis method below */
    3875              : 
    3876              : void
    3877         6243 : Lifetime::accept_vis (HIRFullVisitor &vis)
    3878              : {
    3879         6243 :   vis.visit (*this);
    3880         6243 : }
    3881              : 
    3882              : void
    3883          166 : LifetimeParam::accept_vis (HIRFullVisitor &vis)
    3884              : {
    3885          166 :   vis.visit (*this);
    3886          166 : }
    3887              : 
    3888              : void
    3889       185174 : PathInExpression::accept_vis (HIRFullVisitor &vis)
    3890              : {
    3891       185174 :   vis.visit (*this);
    3892       185174 : }
    3893              : void
    3894       146579 : PathInExpression::accept_vis (HIRExpressionVisitor &vis)
    3895              : {
    3896       146579 :   vis.visit (*this);
    3897       146579 : }
    3898              : 
    3899              : void
    3900        50877 : TypePathSegment::accept_vis (HIRFullVisitor &vis)
    3901              : {
    3902        50877 :   vis.visit (*this);
    3903        50877 : }
    3904              : 
    3905              : void
    3906         2562 : TypePathSegmentGeneric::accept_vis (HIRFullVisitor &vis)
    3907              : {
    3908         2562 :   vis.visit (*this);
    3909         2562 : }
    3910              : 
    3911              : void
    3912           28 : TypePathSegmentFunction::accept_vis (HIRFullVisitor &vis)
    3913              : {
    3914           28 :   vis.visit (*this);
    3915           28 : }
    3916              : 
    3917              : void
    3918        55583 : TypePath::accept_vis (HIRFullVisitor &vis)
    3919              : {
    3920        55583 :   vis.visit (*this);
    3921        55583 : }
    3922              : 
    3923              : void
    3924          202 : QualifiedPathInExpression::accept_vis (HIRFullVisitor &vis)
    3925              : {
    3926          202 :   vis.visit (*this);
    3927          202 : }
    3928              : void
    3929          359 : QualifiedPathInExpression::accept_vis (HIRExpressionVisitor &vis)
    3930              : {
    3931          359 :   vis.visit (*this);
    3932          359 : }
    3933              : 
    3934              : void
    3935          201 : QualifiedPathInType::accept_vis (HIRFullVisitor &vis)
    3936              : {
    3937          201 :   vis.visit (*this);
    3938          201 : }
    3939              : 
    3940              : void
    3941        92491 : LiteralExpr::accept_vis (HIRFullVisitor &vis)
    3942              : {
    3943        92491 :   vis.visit (*this);
    3944        92491 : }
    3945              : 
    3946              : void
    3947        64677 : LiteralExpr::accept_vis (HIRExpressionVisitor &vis)
    3948              : {
    3949        64677 :   vis.visit (*this);
    3950        64677 : }
    3951              : 
    3952              : void
    3953         9452 : BorrowExpr::accept_vis (HIRFullVisitor &vis)
    3954              : {
    3955         9452 :   vis.visit (*this);
    3956         9452 : }
    3957              : 
    3958              : void
    3959           80 : InlineAsm::accept_vis (HIRExpressionVisitor &vis)
    3960              : {
    3961           80 :   vis.visit (*this);
    3962           80 : }
    3963              : 
    3964              : void
    3965          131 : InlineAsm::accept_vis (HIRFullVisitor &vis)
    3966              : {
    3967          131 :   vis.visit (*this);
    3968          131 : }
    3969              : 
    3970              : void
    3971           12 : LlvmInlineAsm::accept_vis (HIRFullVisitor &vis)
    3972              : {
    3973           12 :   vis.visit (*this);
    3974           12 : }
    3975              : void
    3976            6 : LlvmInlineAsm::accept_vis (HIRExpressionVisitor &vis)
    3977              : {
    3978            6 :   vis.visit (*this);
    3979            6 : }
    3980              : 
    3981              : void
    3982         5911 : BorrowExpr::accept_vis (HIRExpressionVisitor &vis)
    3983              : {
    3984         5911 :   vis.visit (*this);
    3985         5911 : }
    3986              : 
    3987              : void
    3988        17336 : DereferenceExpr::accept_vis (HIRFullVisitor &vis)
    3989              : {
    3990        17336 :   vis.visit (*this);
    3991        17336 : }
    3992              : 
    3993              : void
    3994        12491 : DereferenceExpr::accept_vis (HIRExpressionVisitor &vis)
    3995              : {
    3996        12491 :   vis.visit (*this);
    3997        12491 : }
    3998              : 
    3999              : void
    4000            0 : ErrorPropagationExpr::accept_vis (HIRFullVisitor &vis)
    4001              : {
    4002            0 :   vis.visit (*this);
    4003            0 : }
    4004              : 
    4005              : void
    4006            0 : ErrorPropagationExpr::accept_vis (HIRExpressionVisitor &vis)
    4007              : {
    4008            0 :   vis.visit (*this);
    4009            0 : }
    4010              : 
    4011              : void
    4012         2873 : NegationExpr::accept_vis (HIRFullVisitor &vis)
    4013              : {
    4014         2873 :   vis.visit (*this);
    4015         2873 : }
    4016              : 
    4017              : void
    4018         2038 : NegationExpr::accept_vis (HIRExpressionVisitor &vis)
    4019              : {
    4020         2038 :   vis.visit (*this);
    4021         2038 : }
    4022              : 
    4023              : void
    4024        16344 : ArithmeticOrLogicalExpr::accept_vis (HIRFullVisitor &vis)
    4025              : {
    4026        16344 :   vis.visit (*this);
    4027        16344 : }
    4028              : 
    4029              : void
    4030        10945 : ArithmeticOrLogicalExpr::accept_vis (HIRExpressionVisitor &vis)
    4031              : {
    4032        10945 :   vis.visit (*this);
    4033        10945 : }
    4034              : 
    4035              : void
    4036        18036 : ComparisonExpr::accept_vis (HIRFullVisitor &vis)
    4037              : {
    4038        18036 :   vis.visit (*this);
    4039        18036 : }
    4040              : 
    4041              : void
    4042        10827 : ComparisonExpr::accept_vis (HIRExpressionVisitor &vis)
    4043              : {
    4044        10827 :   vis.visit (*this);
    4045        10827 : }
    4046              : 
    4047              : void
    4048         2587 : LazyBooleanExpr::accept_vis (HIRFullVisitor &vis)
    4049              : {
    4050         2587 :   vis.visit (*this);
    4051         2587 : }
    4052              : 
    4053              : void
    4054         1221 : LazyBooleanExpr::accept_vis (HIRExpressionVisitor &vis)
    4055              : {
    4056         1221 :   vis.visit (*this);
    4057         1221 : }
    4058              : 
    4059              : void
    4060        29552 : TypeCastExpr::accept_vis (HIRFullVisitor &vis)
    4061              : {
    4062        29552 :   vis.visit (*this);
    4063        29552 : }
    4064              : 
    4065              : void
    4066        15812 : TypeCastExpr::accept_vis (HIRExpressionVisitor &vis)
    4067              : {
    4068        15812 :   vis.visit (*this);
    4069        15812 : }
    4070              : 
    4071              : void
    4072        12498 : AssignmentExpr::accept_vis (HIRFullVisitor &vis)
    4073              : {
    4074        12498 :   vis.visit (*this);
    4075        12498 : }
    4076              : 
    4077              : void
    4078         7408 : AssignmentExpr::accept_vis (HIRExpressionVisitor &vis)
    4079              : {
    4080         7408 :   vis.visit (*this);
    4081         7408 : }
    4082              : 
    4083              : void
    4084         3380 : CompoundAssignmentExpr::accept_vis (HIRFullVisitor &vis)
    4085              : {
    4086         3380 :   vis.visit (*this);
    4087         3380 : }
    4088              : 
    4089              : void
    4090         2104 : CompoundAssignmentExpr::accept_vis (HIRExpressionVisitor &vis)
    4091              : {
    4092         2104 :   vis.visit (*this);
    4093         2104 : }
    4094              : 
    4095              : void
    4096         1706 : GroupedExpr::accept_vis (HIRFullVisitor &vis)
    4097              : {
    4098         1706 :   vis.visit (*this);
    4099         1706 : }
    4100              : 
    4101              : void
    4102         1104 : GroupedExpr::accept_vis (HIRExpressionVisitor &vis)
    4103              : {
    4104         1104 :   vis.visit (*this);
    4105         1103 : }
    4106              : 
    4107              : void
    4108         1212 : ArrayElemsValues::accept_vis (HIRFullVisitor &vis)
    4109              : {
    4110         1212 :   vis.visit (*this);
    4111         1212 : }
    4112              : 
    4113              : void
    4114          473 : ArrayElemsCopied::accept_vis (HIRFullVisitor &vis)
    4115              : {
    4116          473 :   vis.visit (*this);
    4117          473 : }
    4118              : 
    4119              : void
    4120         1685 : ArrayExpr::accept_vis (HIRFullVisitor &vis)
    4121              : {
    4122         1685 :   vis.visit (*this);
    4123         1685 : }
    4124              : 
    4125              : void
    4126         1398 : ArrayIndexExpr::accept_vis (HIRFullVisitor &vis)
    4127              : {
    4128         1398 :   vis.visit (*this);
    4129         1398 : }
    4130              : 
    4131              : void
    4132         2678 : TupleExpr::accept_vis (HIRFullVisitor &vis)
    4133              : {
    4134         2678 :   vis.visit (*this);
    4135         2678 : }
    4136              : 
    4137              : void
    4138         3806 : TupleIndexExpr::accept_vis (HIRFullVisitor &vis)
    4139              : {
    4140         3806 :   vis.visit (*this);
    4141         3806 : }
    4142              : 
    4143              : void
    4144          327 : StructExprStruct::accept_vis (HIRFullVisitor &vis)
    4145              : {
    4146          327 :   vis.visit (*this);
    4147          327 : }
    4148              : 
    4149              : void
    4150          168 : StructExprFieldIndexValue::accept_vis (HIRFullVisitor &vis)
    4151              : {
    4152          168 :   vis.visit (*this);
    4153          168 : }
    4154              : 
    4155              : void
    4156         5785 : StructExprStructFields::accept_vis (HIRFullVisitor &vis)
    4157              : {
    4158         5785 :   vis.visit (*this);
    4159         5785 : }
    4160              : 
    4161              : void
    4162            0 : StructExprStructBase::accept_vis (HIRFullVisitor &vis)
    4163              : {
    4164            0 :   vis.visit (*this);
    4165            0 : }
    4166              : 
    4167              : void
    4168            0 : StructExprStructBase::accept_vis (HIRExpressionVisitor &vis)
    4169              : {
    4170            0 :   vis.visit (*this);
    4171            0 : }
    4172              : 
    4173              : void
    4174        63777 : CallExpr::accept_vis (HIRFullVisitor &vis)
    4175              : {
    4176        63777 :   vis.visit (*this);
    4177        63777 : }
    4178              : 
    4179              : void
    4180        12286 : MethodCallExpr::accept_vis (HIRFullVisitor &vis)
    4181              : {
    4182        12286 :   vis.visit (*this);
    4183        12286 : }
    4184              : 
    4185              : void
    4186        24092 : FieldAccessExpr::accept_vis (HIRFullVisitor &vis)
    4187              : {
    4188        24092 :   vis.visit (*this);
    4189        24092 : }
    4190              : 
    4191              : void
    4192          232 : ClosureExpr::accept_vis (HIRFullVisitor &vis)
    4193              : {
    4194          232 :   vis.visit (*this);
    4195          232 : }
    4196              : 
    4197              : void
    4198       120765 : BlockExpr::accept_vis (HIRFullVisitor &vis)
    4199              : {
    4200       120765 :   vis.visit (*this);
    4201       120765 : }
    4202              : 
    4203              : void
    4204         1049 : AnonConst::accept_vis (HIRFullVisitor &vis)
    4205              : {
    4206         1049 :   vis.visit (*this);
    4207         1049 : }
    4208              : 
    4209              : void
    4210           59 : ConstBlock::accept_vis (HIRFullVisitor &vis)
    4211              : {
    4212           59 :   vis.visit (*this);
    4213           59 : }
    4214              : 
    4215              : void
    4216          146 : ContinueExpr::accept_vis (HIRFullVisitor &vis)
    4217              : {
    4218          146 :   vis.visit (*this);
    4219          146 : }
    4220              : 
    4221              : void
    4222          562 : BreakExpr::accept_vis (HIRFullVisitor &vis)
    4223              : {
    4224          562 :   vis.visit (*this);
    4225          562 : }
    4226              : 
    4227              : void
    4228          288 : RangeFromToExpr::accept_vis (HIRFullVisitor &vis)
    4229              : {
    4230          288 :   vis.visit (*this);
    4231          288 : }
    4232              : 
    4233              : void
    4234           21 : RangeFromExpr::accept_vis (HIRFullVisitor &vis)
    4235              : {
    4236           21 :   vis.visit (*this);
    4237           21 : }
    4238              : 
    4239              : void
    4240           21 : RangeToExpr::accept_vis (HIRFullVisitor &vis)
    4241              : {
    4242           21 :   vis.visit (*this);
    4243           21 : }
    4244              : 
    4245              : void
    4246            0 : RangeFullExpr::accept_vis (HIRFullVisitor &vis)
    4247              : {
    4248            0 :   vis.visit (*this);
    4249            0 : }
    4250              : 
    4251              : void
    4252            0 : RangeToInclExpr::accept_vis (HIRFullVisitor &vis)
    4253              : {
    4254            0 :   vis.visit (*this);
    4255            0 : }
    4256              : 
    4257              : void
    4258           25 : BoxExpr::accept_vis (HIRFullVisitor &vis)
    4259              : {
    4260           25 :   vis.visit (*this);
    4261           25 : }
    4262              : 
    4263              : void
    4264         3306 : ReturnExpr::accept_vis (HIRFullVisitor &vis)
    4265              : {
    4266         3306 :   vis.visit (*this);
    4267         3306 : }
    4268              : 
    4269              : void
    4270        20689 : UnsafeBlockExpr::accept_vis (HIRFullVisitor &vis)
    4271              : {
    4272        20689 :   vis.visit (*this);
    4273        20689 : }
    4274              : 
    4275              : void
    4276          738 : LoopExpr::accept_vis (HIRFullVisitor &vis)
    4277              : {
    4278          738 :   vis.visit (*this);
    4279          738 : }
    4280              : 
    4281              : void
    4282          503 : WhileLoopExpr::accept_vis (HIRFullVisitor &vis)
    4283              : {
    4284          503 :   vis.visit (*this);
    4285          503 : }
    4286              : 
    4287              : void
    4288            0 : WhileLetLoopExpr::accept_vis (HIRFullVisitor &vis)
    4289              : {
    4290            0 :   vis.visit (*this);
    4291            0 : }
    4292              : 
    4293              : void
    4294         7837 : IfExpr::accept_vis (HIRFullVisitor &vis)
    4295              : {
    4296         7837 :   vis.visit (*this);
    4297         7837 : }
    4298              : 
    4299              : void
    4300         6147 : IfExprConseqElse::accept_vis (HIRFullVisitor &vis)
    4301              : {
    4302         6147 :   vis.visit (*this);
    4303         6147 : }
    4304              : 
    4305              : void
    4306         5677 : MatchExpr::accept_vis (HIRFullVisitor &vis)
    4307              : {
    4308         5677 :   vis.visit (*this);
    4309         5677 : }
    4310              : 
    4311              : void
    4312            0 : AwaitExpr::accept_vis (HIRFullVisitor &vis)
    4313              : {
    4314            0 :   vis.visit (*this);
    4315            0 : }
    4316              : 
    4317              : void
    4318            0 : AsyncBlockExpr::accept_vis (HIRFullVisitor &vis)
    4319              : {
    4320            0 :   vis.visit (*this);
    4321            0 : }
    4322              : 
    4323              : void
    4324         8781 : TypeParam::accept_vis (HIRFullVisitor &vis)
    4325              : {
    4326         8781 :   vis.visit (*this);
    4327         8781 : }
    4328              : 
    4329              : void
    4330            0 : LifetimeWhereClauseItem::accept_vis (HIRFullVisitor &vis)
    4331              : {
    4332            0 :   vis.visit (*this);
    4333            0 : }
    4334              : 
    4335              : void
    4336          343 : TypeBoundWhereClauseItem::accept_vis (HIRFullVisitor &vis)
    4337              : {
    4338          343 :   vis.visit (*this);
    4339          343 : }
    4340              : 
    4341              : void
    4342         7598 : Module::accept_vis (HIRFullVisitor &vis)
    4343              : {
    4344         7598 :   vis.visit (*this);
    4345         7598 : }
    4346              : 
    4347              : void
    4348         2467 : Module::accept_vis (HIRStmtVisitor &vis)
    4349              : {
    4350         2467 :   vis.visit (*this);
    4351         2467 : }
    4352              : 
    4353              : void
    4354         4992 : Module::accept_vis (HIRVisItemVisitor &vis)
    4355              : {
    4356         4992 :   vis.visit (*this);
    4357         4992 : }
    4358              : 
    4359              : void
    4360            0 : ExternCrate::accept_vis (HIRFullVisitor &vis)
    4361              : {
    4362            0 :   vis.visit (*this);
    4363            0 : }
    4364              : 
    4365              : void
    4366            0 : UseTreeGlob::accept_vis (HIRFullVisitor &vis)
    4367              : {
    4368            0 :   vis.visit (*this);
    4369            0 : }
    4370              : 
    4371              : void
    4372            0 : UseTreeList::accept_vis (HIRFullVisitor &vis)
    4373              : {
    4374            0 :   vis.visit (*this);
    4375            0 : }
    4376              : 
    4377              : void
    4378            0 : UseTreeRebind::accept_vis (HIRFullVisitor &vis)
    4379              : {
    4380            0 :   vis.visit (*this);
    4381            0 : }
    4382              : 
    4383              : void
    4384            0 : UseDeclaration::accept_vis (HIRFullVisitor &vis)
    4385              : {
    4386            0 :   vis.visit (*this);
    4387            0 : }
    4388              : 
    4389              : void
    4390        89831 : Function::accept_vis (HIRFullVisitor &vis)
    4391              : {
    4392        89831 :   vis.visit (*this);
    4393        89826 : }
    4394              : 
    4395              : void
    4396         7375 : TypeAlias::accept_vis (HIRFullVisitor &vis)
    4397              : {
    4398         7375 :   vis.visit (*this);
    4399         7375 : }
    4400              : 
    4401              : void
    4402        11999 : StructStruct::accept_vis (HIRFullVisitor &vis)
    4403              : {
    4404        11999 :   vis.visit (*this);
    4405        11999 : }
    4406              : 
    4407              : void
    4408         7608 : TupleStruct::accept_vis (HIRFullVisitor &vis)
    4409              : {
    4410         7608 :   vis.visit (*this);
    4411         7608 : }
    4412              : 
    4413              : void
    4414         1650 : EnumItem::accept_vis (HIRFullVisitor &vis)
    4415              : {
    4416         1650 :   vis.visit (*this);
    4417         1650 : }
    4418              : 
    4419              : void
    4420          831 : EnumItemTuple::accept_vis (HIRFullVisitor &vis)
    4421              : {
    4422          831 :   vis.visit (*this);
    4423          831 : }
    4424              : 
    4425              : void
    4426          158 : EnumItemStruct::accept_vis (HIRFullVisitor &vis)
    4427              : {
    4428          158 :   vis.visit (*this);
    4429          158 : }
    4430              : 
    4431              : void
    4432          565 : EnumItemDiscriminant::accept_vis (HIRFullVisitor &vis)
    4433              : {
    4434          565 :   vis.visit (*this);
    4435          565 : }
    4436              : 
    4437              : void
    4438         3497 : Enum::accept_vis (HIRFullVisitor &vis)
    4439              : {
    4440         3497 :   vis.visit (*this);
    4441         3497 : }
    4442              : 
    4443              : void
    4444          738 : Union::accept_vis (HIRFullVisitor &vis)
    4445              : {
    4446          738 :   vis.visit (*this);
    4447          738 : }
    4448              : 
    4449              : void
    4450         3821 : ConstantItem::accept_vis (HIRFullVisitor &vis)
    4451              : {
    4452         3821 :   vis.visit (*this);
    4453         3821 : }
    4454              : 
    4455              : void
    4456          376 : StaticItem::accept_vis (HIRFullVisitor &vis)
    4457              : {
    4458          376 :   vis.visit (*this);
    4459          376 : }
    4460              : 
    4461              : void
    4462        10705 : TraitItemFunc::accept_vis (HIRFullVisitor &vis)
    4463              : {
    4464        10705 :   vis.visit (*this);
    4465        10705 : }
    4466              : 
    4467              : void
    4468          127 : TraitItemConst::accept_vis (HIRFullVisitor &vis)
    4469              : {
    4470          127 :   vis.visit (*this);
    4471          127 : }
    4472              : 
    4473              : void
    4474         3139 : TraitItemType::accept_vis (HIRFullVisitor &vis)
    4475              : {
    4476         3139 :   vis.visit (*this);
    4477         3139 : }
    4478              : 
    4479              : void
    4480        23543 : Trait::accept_vis (HIRFullVisitor &vis)
    4481              : {
    4482        23543 :   vis.visit (*this);
    4483        23543 : }
    4484              : 
    4485              : void
    4486        35406 : ImplBlock::accept_vis (HIRFullVisitor &vis)
    4487              : {
    4488        35406 :   vis.visit (*this);
    4489        35406 : }
    4490              : 
    4491              : void
    4492            3 : ExternalStaticItem::accept_vis (HIRFullVisitor &vis)
    4493              : {
    4494            3 :   vis.visit (*this);
    4495            3 : }
    4496              : 
    4497              : void
    4498        10622 : ExternalFunctionItem::accept_vis (HIRFullVisitor &vis)
    4499              : {
    4500        10622 :   vis.visit (*this);
    4501        10622 : }
    4502              : 
    4503              : void
    4504            8 : ExternalTypeItem::accept_vis (HIRFullVisitor &vis)
    4505              : {
    4506            8 :   vis.visit (*this);
    4507            8 : }
    4508              : 
    4509              : void
    4510        10121 : ExternBlock::accept_vis (HIRFullVisitor &vis)
    4511              : {
    4512        10121 :   vis.visit (*this);
    4513        10121 : }
    4514              : 
    4515              : void
    4516          410 : LiteralPattern::accept_vis (HIRFullVisitor &vis)
    4517              : {
    4518          410 :   vis.visit (*this);
    4519          410 : }
    4520              : 
    4521              : void
    4522         9343 : IdentifierPattern::accept_vis (HIRFullVisitor &vis)
    4523              : {
    4524         9343 :   vis.visit (*this);
    4525         9343 : }
    4526              : 
    4527              : void
    4528          779 : WildcardPattern::accept_vis (HIRFullVisitor &vis)
    4529              : {
    4530          779 :   vis.visit (*this);
    4531          779 : }
    4532              : 
    4533              : void
    4534           77 : RangePatternBoundLiteral::accept_vis (HIRFullVisitor &vis)
    4535              : {
    4536           77 :   vis.visit (*this);
    4537           77 : }
    4538              : 
    4539              : void
    4540           21 : RangePatternBoundPath::accept_vis (HIRFullVisitor &vis)
    4541              : {
    4542           21 :   vis.visit (*this);
    4543           21 : }
    4544              : 
    4545              : void
    4546            0 : RangePatternBoundQualPath::accept_vis (HIRFullVisitor &vis)
    4547              : {
    4548            0 :   vis.visit (*this);
    4549            0 : }
    4550              : 
    4551              : void
    4552           49 : RangePattern::accept_vis (HIRFullVisitor &vis)
    4553              : {
    4554           49 :   vis.visit (*this);
    4555           49 : }
    4556              : 
    4557              : void
    4558          175 : ReferencePattern::accept_vis (HIRFullVisitor &vis)
    4559              : {
    4560          175 :   vis.visit (*this);
    4561          175 : }
    4562              : 
    4563              : void
    4564           18 : StructPatternFieldTuplePat::accept_vis (HIRFullVisitor &vis)
    4565              : {
    4566           18 :   vis.visit (*this);
    4567           18 : }
    4568              : 
    4569              : void
    4570          120 : StructPatternFieldIdentPat::accept_vis (HIRFullVisitor &vis)
    4571              : {
    4572          120 :   vis.visit (*this);
    4573          120 : }
    4574              : 
    4575              : void
    4576           95 : StructPatternFieldIdent::accept_vis (HIRFullVisitor &vis)
    4577              : {
    4578           95 :   vis.visit (*this);
    4579           95 : }
    4580              : 
    4581              : void
    4582          137 : StructPattern::accept_vis (HIRFullVisitor &vis)
    4583              : {
    4584          137 :   vis.visit (*this);
    4585          137 : }
    4586              : 
    4587              : void
    4588          902 : TupleStructItemsNoRest::accept_vis (HIRFullVisitor &vis)
    4589              : {
    4590          902 :   vis.visit (*this);
    4591          902 : }
    4592              : 
    4593              : void
    4594           36 : TupleStructItemsHasRest::accept_vis (HIRFullVisitor &vis)
    4595              : {
    4596           36 :   vis.visit (*this);
    4597           36 : }
    4598              : 
    4599              : void
    4600          938 : TupleStructPattern::accept_vis (HIRFullVisitor &vis)
    4601              : {
    4602          938 :   vis.visit (*this);
    4603          938 : }
    4604              : 
    4605              : void
    4606          113 : TuplePatternItemsNoRest::accept_vis (HIRFullVisitor &vis)
    4607              : {
    4608          113 :   vis.visit (*this);
    4609          113 : }
    4610              : 
    4611              : void
    4612           26 : TuplePatternItemsHasRest::accept_vis (HIRFullVisitor &vis)
    4613              : {
    4614           26 :   vis.visit (*this);
    4615           26 : }
    4616              : 
    4617              : void
    4618          139 : TuplePattern::accept_vis (HIRFullVisitor &vis)
    4619              : {
    4620          139 :   vis.visit (*this);
    4621          139 : }
    4622              : 
    4623              : void
    4624           31 : SlicePatternItemsNoRest::accept_vis (HIRFullVisitor &vis)
    4625              : {
    4626           31 :   vis.visit (*this);
    4627           31 : }
    4628              : 
    4629              : void
    4630           44 : SlicePatternItemsHasRest::accept_vis (HIRFullVisitor &vis)
    4631              : {
    4632           44 :   vis.visit (*this);
    4633           44 : }
    4634              : 
    4635              : void
    4636           75 : SlicePattern::accept_vis (HIRFullVisitor &vis)
    4637              : {
    4638           75 :   vis.visit (*this);
    4639           75 : }
    4640              : 
    4641              : void
    4642          145 : AltPattern::accept_vis (HIRFullVisitor &vis)
    4643              : {
    4644          145 :   vis.visit (*this);
    4645          145 : }
    4646              : 
    4647              : void
    4648          226 : EmptyStmt::accept_vis (HIRFullVisitor &vis)
    4649              : {
    4650          226 :   vis.visit (*this);
    4651          226 : }
    4652              : 
    4653              : void
    4654        69009 : LetStmt::accept_vis (HIRFullVisitor &vis)
    4655              : {
    4656        69009 :   vis.visit (*this);
    4657        69009 : }
    4658              : 
    4659              : void
    4660        59276 : ExprStmt::accept_vis (HIRFullVisitor &vis)
    4661              : {
    4662        59276 :   vis.visit (*this);
    4663        59276 : }
    4664              : 
    4665              : void
    4666         2054 : TraitBound::accept_vis (HIRFullVisitor &vis)
    4667              : {
    4668         2054 :   vis.visit (*this);
    4669         2054 : }
    4670              : 
    4671              : void
    4672           36 : ImplTraitType::accept_vis (HIRFullVisitor &vis)
    4673              : {
    4674           36 :   vis.visit (*this);
    4675           36 : }
    4676              : 
    4677              : void
    4678           98 : TraitObjectType::accept_vis (HIRFullVisitor &vis)
    4679              : {
    4680           98 :   vis.visit (*this);
    4681           98 : }
    4682              : 
    4683              : void
    4684            5 : ParenthesisedType::accept_vis (HIRFullVisitor &vis)
    4685              : {
    4686            5 :   vis.visit (*this);
    4687            5 : }
    4688              : 
    4689              : void
    4690          410 : TupleType::accept_vis (HIRFullVisitor &vis)
    4691              : {
    4692          410 :   vis.visit (*this);
    4693          410 : }
    4694              : 
    4695              : void
    4696          192 : NeverType::accept_vis (HIRFullVisitor &vis)
    4697              : {
    4698          192 :   vis.visit (*this);
    4699          192 : }
    4700              : 
    4701              : void
    4702         4664 : RawPointerType::accept_vis (HIRFullVisitor &vis)
    4703              : {
    4704         4664 :   vis.visit (*this);
    4705         4664 : }
    4706              : 
    4707              : void
    4708         6288 : ReferenceType::accept_vis (HIRFullVisitor &vis)
    4709              : {
    4710         6288 :   vis.visit (*this);
    4711         6288 : }
    4712              : 
    4713              : void
    4714          997 : ArrayType::accept_vis (HIRFullVisitor &vis)
    4715              : {
    4716          997 :   vis.visit (*this);
    4717          997 : }
    4718              : 
    4719              : void
    4720          863 : SliceType::accept_vis (HIRFullVisitor &vis)
    4721              : {
    4722          863 :   vis.visit (*this);
    4723          863 : }
    4724              : 
    4725              : void
    4726           14 : InferredType::accept_vis (HIRFullVisitor &vis)
    4727              : {
    4728           14 :   vis.visit (*this);
    4729           14 : }
    4730              : 
    4731              : void
    4732           44 : BareFunctionType::accept_vis (HIRFullVisitor &vis)
    4733              : {
    4734           44 :   vis.visit (*this);
    4735           44 : }
    4736              : 
    4737              : void
    4738          196 : NeverType::accept_vis (HIRTypeVisitor &vis)
    4739              : {
    4740          196 :   vis.visit (*this);
    4741          196 : }
    4742              : 
    4743              : void
    4744            5 : ParenthesisedType::accept_vis (HIRTypeVisitor &vis)
    4745              : {
    4746            5 :   vis.visit (*this);
    4747            5 : }
    4748              : 
    4749              : void
    4750          136 : EmptyStmt::accept_vis (HIRStmtVisitor &vis)
    4751              : {
    4752          136 :   vis.visit (*this);
    4753          136 : }
    4754              : 
    4755              : void
    4756         2723 : WildcardPattern::accept_vis (HIRPatternVisitor &vis)
    4757              : {
    4758         2723 :   vis.visit (*this);
    4759         2723 : }
    4760              : 
    4761              : void
    4762          814 : TraitItemType::accept_vis (HIRTraitItemVisitor &vis)
    4763              : {
    4764          814 :   vis.visit (*this);
    4765          814 : }
    4766              : 
    4767              : void
    4768           40 : TraitItemConst::accept_vis (HIRTraitItemVisitor &vis)
    4769              : {
    4770           40 :   vis.visit (*this);
    4771           40 : }
    4772              : 
    4773              : void
    4774         3007 : TraitItemFunc::accept_vis (HIRTraitItemVisitor &vis)
    4775              : {
    4776         3007 :   vis.visit (*this);
    4777         3007 : }
    4778              : 
    4779              : void
    4780         5349 : ExternalFunctionItem::accept_vis (HIRExternalItemVisitor &vis)
    4781              : {
    4782         5349 :   vis.visit (*this);
    4783         5349 : }
    4784              : 
    4785              : void
    4786            5 : ExternalTypeItem::accept_vis (HIRExternalItemVisitor &vis)
    4787              : {
    4788            5 :   vis.visit (*this);
    4789            5 : }
    4790              : 
    4791              : void
    4792            1 : ExternalStaticItem::accept_vis (HIRExternalItemVisitor &vis)
    4793              : {
    4794            1 :   vis.visit (*this);
    4795            1 : }
    4796              : 
    4797              : void
    4798            0 : EnumItemDiscriminant::accept_vis (HIRStmtVisitor &vis)
    4799              : {
    4800            0 :   vis.visit (*this);
    4801            0 : }
    4802              : 
    4803              : void
    4804            0 : EnumItemStruct::accept_vis (HIRStmtVisitor &vis)
    4805              : {
    4806            0 :   vis.visit (*this);
    4807            0 : }
    4808              : 
    4809              : void
    4810            0 : EnumItemTuple::accept_vis (HIRStmtVisitor &vis)
    4811              : {
    4812            0 :   vis.visit (*this);
    4813            0 : }
    4814              : 
    4815              : void
    4816            0 : EnumItem::accept_vis (HIRStmtVisitor &vis)
    4817              : {
    4818            0 :   vis.visit (*this);
    4819            0 : }
    4820              : 
    4821              : void
    4822         4204 : StructExprStructFields::accept_vis (HIRExpressionVisitor &vis)
    4823              : {
    4824         4204 :   vis.visit (*this);
    4825         4204 : }
    4826              : 
    4827              : void
    4828           42 : StructExprFieldIndexValue::accept_vis (HIRExpressionVisitor &vis)
    4829              : {
    4830           42 :   vis.visit (*this);
    4831           42 : }
    4832              : 
    4833              : void
    4834        11202 : StructExprFieldIdentifierValue::accept_vis (HIRFullVisitor &vis)
    4835              : {
    4836        11202 :   vis.visit (*this);
    4837        11202 : }
    4838              : 
    4839              : void
    4840         2716 : StructExprFieldIdentifierValue::accept_vis (HIRExpressionVisitor &vis)
    4841              : {
    4842         2716 :   vis.visit (*this);
    4843         2716 : }
    4844              : 
    4845              : void
    4846          929 : StructExprFieldIdentifier::accept_vis (HIRFullVisitor &vis)
    4847              : {
    4848          929 :   vis.visit (*this);
    4849          929 : }
    4850              : 
    4851              : void
    4852          235 : StructExprFieldIdentifier::accept_vis (HIRExpressionVisitor &vis)
    4853              : {
    4854          235 :   vis.visit (*this);
    4855          235 : }
    4856              : 
    4857              : void
    4858          239 : StructExprStruct::accept_vis (HIRExpressionVisitor &vis)
    4859              : {
    4860          239 :   vis.visit (*this);
    4861          239 : }
    4862              : 
    4863              : void
    4864          489 : TupleType::accept_vis (HIRTypeVisitor &vis)
    4865              : {
    4866          489 :   vis.visit (*this);
    4867          489 : }
    4868              : 
    4869              : void
    4870          907 : SliceType::accept_vis (HIRTypeVisitor &vis)
    4871              : {
    4872          907 :   vis.visit (*this);
    4873          907 : }
    4874              : 
    4875              : void
    4876          796 : ArrayType::accept_vis (HIRTypeVisitor &vis)
    4877              : {
    4878          796 :   vis.visit (*this);
    4879          795 : }
    4880              : 
    4881              : void
    4882           65 : BareFunctionType::accept_vis (HIRTypeVisitor &vis)
    4883              : {
    4884           65 :   vis.visit (*this);
    4885           65 : }
    4886              : 
    4887              : void
    4888          227 : TraitObjectType::accept_vis (HIRTypeVisitor &vis)
    4889              : {
    4890          227 :   vis.visit (*this);
    4891          227 : }
    4892              : 
    4893              : void
    4894         7098 : RawPointerType::accept_vis (HIRTypeVisitor &vis)
    4895              : {
    4896         7098 :   vis.visit (*this);
    4897         7098 : }
    4898              : 
    4899              : void
    4900         4671 : ReferenceType::accept_vis (HIRTypeVisitor &vis)
    4901              : {
    4902         4671 :   vis.visit (*this);
    4903         4671 : }
    4904              : 
    4905              : void
    4906           37 : ImplTraitType::accept_vis (HIRTypeVisitor &vis)
    4907              : {
    4908           37 :   vis.visit (*this);
    4909           37 : }
    4910              : 
    4911              : void
    4912          227 : InferredType::accept_vis (HIRTypeVisitor &vis)
    4913              : {
    4914          227 :   vis.visit (*this);
    4915          227 : }
    4916              : 
    4917              : void
    4918        38886 : LetStmt::accept_vis (HIRStmtVisitor &vis)
    4919              : {
    4920        38886 :   vis.visit (*this);
    4921        38886 : }
    4922              : 
    4923              : void
    4924         2599 : TupleStructPattern::accept_vis (HIRPatternVisitor &vis)
    4925              : {
    4926         2599 :   vis.visit (*this);
    4927         2597 : }
    4928              : 
    4929              : void
    4930        61428 : IdentifierPattern::accept_vis (HIRPatternVisitor &vis)
    4931              : {
    4932        61428 :   vis.visit (*this);
    4933        61428 : }
    4934              : 
    4935              : void
    4936          581 : ReferencePattern::accept_vis (HIRPatternVisitor &vis)
    4937              : {
    4938          581 :   vis.visit (*this);
    4939          581 : }
    4940              : 
    4941              : void
    4942         1268 : LiteralPattern::accept_vis (HIRPatternVisitor &vis)
    4943              : {
    4944         1268 :   vis.visit (*this);
    4945         1268 : }
    4946              : 
    4947              : void
    4948          555 : StructPattern::accept_vis (HIRPatternVisitor &vis)
    4949              : {
    4950          555 :   vis.visit (*this);
    4951          555 : }
    4952              : 
    4953              : void
    4954         1583 : TuplePattern::accept_vis (HIRPatternVisitor &vis)
    4955              : {
    4956         1583 :   vis.visit (*this);
    4957         1583 : }
    4958              : 
    4959              : void
    4960          234 : SlicePattern::accept_vis (HIRPatternVisitor &vis)
    4961              : {
    4962          234 :   vis.visit (*this);
    4963          234 : }
    4964              : 
    4965              : void
    4966          235 : AltPattern::accept_vis (HIRPatternVisitor &vis)
    4967              : {
    4968          235 :   vis.visit (*this);
    4969          235 : }
    4970              : 
    4971              : void
    4972          134 : RangePattern::accept_vis (HIRPatternVisitor &vis)
    4973              : {
    4974          134 :   vis.visit (*this);
    4975          134 : }
    4976              : 
    4977              : void
    4978        54443 : TypePath::accept_vis (HIRTypeVisitor &vis)
    4979              : {
    4980        54443 :   vis.visit (*this);
    4981        54443 : }
    4982              : 
    4983              : void
    4984          247 : QualifiedPathInType::accept_vis (HIRTypeVisitor &vis)
    4985              : {
    4986          247 :   vis.visit (*this);
    4987          247 : }
    4988              : 
    4989              : void
    4990        33088 : ExprStmt::accept_vis (HIRStmtVisitor &vis)
    4991              : {
    4992        33088 :   vis.visit (*this);
    4993        33088 : }
    4994              : 
    4995              : void
    4996         1784 : TupleExpr::accept_vis (HIRExpressionVisitor &vis)
    4997              : {
    4998         1784 :   vis.visit (*this);
    4999         1784 : }
    5000              : 
    5001              : void
    5002         2788 : MatchExpr::accept_vis (HIRExpressionVisitor &vis)
    5003              : {
    5004         2788 :   vis.visit (*this);
    5005         2788 : }
    5006              : 
    5007              : void
    5008          304 : BreakExpr::accept_vis (HIRExpressionVisitor &vis)
    5009              : {
    5010          304 :   vis.visit (*this);
    5011          304 : }
    5012              : 
    5013              : void
    5014            0 : AwaitExpr::accept_vis (HIRExpressionVisitor &vis)
    5015              : {
    5016            0 :   vis.visit (*this);
    5017            0 : }
    5018              : 
    5019              : void
    5020         1267 : ArrayExpr::accept_vis (HIRExpressionVisitor &vis)
    5021              : {
    5022         1267 :   vis.visit (*this);
    5023         1267 : }
    5024              : 
    5025              : void
    5026          429 : LoopExpr::accept_vis (HIRExpressionVisitor &vis)
    5027              : {
    5028          429 :   vis.visit (*this);
    5029          429 : }
    5030              : 
    5031              : void
    5032            0 : WhileLetLoopExpr::accept_vis (HIRExpressionVisitor &vis)
    5033              : {
    5034            0 :   vis.visit (*this);
    5035            0 : }
    5036              : 
    5037              : void
    5038          279 : WhileLoopExpr::accept_vis (HIRExpressionVisitor &vis)
    5039              : {
    5040          279 :   vis.visit (*this);
    5041          279 : }
    5042              : 
    5043              : void
    5044        38816 : CallExpr::accept_vis (HIRExpressionVisitor &vis)
    5045              : {
    5046        38816 :   vis.visit (*this);
    5047        38815 : }
    5048              : 
    5049              : void
    5050         4940 : IfExprConseqElse::accept_vis (HIRExpressionVisitor &vis)
    5051              : {
    5052         4940 :   vis.visit (*this);
    5053         4940 : }
    5054              : 
    5055              : void
    5056         5116 : IfExpr::accept_vis (HIRExpressionVisitor &vis)
    5057              : {
    5058         5116 :   vis.visit (*this);
    5059         5116 : }
    5060              : 
    5061              : void
    5062          187 : ClosureExpr::accept_vis (HIRExpressionVisitor &vis)
    5063              : {
    5064          187 :   vis.visit (*this);
    5065          186 : }
    5066              : 
    5067              : void
    5068        11226 : UnsafeBlockExpr::accept_vis (HIRExpressionVisitor &vis)
    5069              : {
    5070        11226 :   vis.visit (*this);
    5071        11226 : }
    5072              : 
    5073              : void
    5074            0 : RangeToInclExpr::accept_vis (HIRExpressionVisitor &vis)
    5075              : {
    5076            0 :   vis.visit (*this);
    5077            0 : }
    5078              : 
    5079              : void
    5080          221 : RangeFromToExpr::accept_vis (HIRExpressionVisitor &vis)
    5081              : {
    5082          221 :   vis.visit (*this);
    5083          221 : }
    5084              : 
    5085              : void
    5086        16339 : FieldAccessExpr::accept_vis (HIRExpressionVisitor &vis)
    5087              : {
    5088        16339 :   vis.visit (*this);
    5089        16339 : }
    5090              : 
    5091              : void
    5092         2711 : TupleIndexExpr::accept_vis (HIRExpressionVisitor &vis)
    5093              : {
    5094         2711 :   vis.visit (*this);
    5095         2711 : }
    5096              : 
    5097              : void
    5098         8400 : MethodCallExpr::accept_vis (HIRExpressionVisitor &vis)
    5099              : {
    5100         8400 :   vis.visit (*this);
    5101         8400 : }
    5102              : 
    5103              : void
    5104            0 : AsyncBlockExpr::accept_vis (HIRExpressionVisitor &vis)
    5105              : {
    5106            0 :   vis.visit (*this);
    5107            0 : }
    5108              : 
    5109              : void
    5110          883 : ArrayIndexExpr::accept_vis (HIRExpressionVisitor &vis)
    5111              : {
    5112          883 :   vis.visit (*this);
    5113          883 : }
    5114              : 
    5115              : void
    5116            0 : RangeFullExpr::accept_vis (HIRExpressionVisitor &vis)
    5117              : {
    5118            0 :   vis.visit (*this);
    5119            0 : }
    5120              : 
    5121              : void
    5122           21 : RangeFromExpr::accept_vis (HIRExpressionVisitor &vis)
    5123              : {
    5124           21 :   vis.visit (*this);
    5125           21 : }
    5126              : 
    5127              : void
    5128           78 : ContinueExpr::accept_vis (HIRExpressionVisitor &vis)
    5129              : {
    5130           78 :   vis.visit (*this);
    5131           78 : }
    5132              : 
    5133              : void
    5134           21 : RangeToExpr::accept_vis (HIRExpressionVisitor &vis)
    5135              : {
    5136           21 :   vis.visit (*this);
    5137           21 : }
    5138              : 
    5139              : void
    5140           16 : BoxExpr::accept_vis (HIRExpressionVisitor &vis)
    5141              : {
    5142           16 :   vis.visit (*this);
    5143           16 : }
    5144              : 
    5145              : void
    5146         1555 : ReturnExpr::accept_vis (HIRExpressionVisitor &vis)
    5147              : {
    5148         1555 :   vis.visit (*this);
    5149         1555 : }
    5150              : 
    5151              : void
    5152            0 : QualifiedPathInExpression::accept_vis (HIRPatternVisitor &vis)
    5153              : {
    5154            0 :   vis.visit (*this);
    5155            0 : }
    5156              : 
    5157              : void
    5158         2686 : PathInExpression::accept_vis (HIRPatternVisitor &vis)
    5159              : {
    5160         2686 :   vis.visit (*this);
    5161         2686 : }
    5162              : 
    5163              : void
    5164         3411 : ExternBlock::accept_vis (HIRStmtVisitor &vis)
    5165              : {
    5166         3411 :   vis.visit (*this);
    5167         3411 : }
    5168              : 
    5169              : void
    5170         6758 : ExternBlock::accept_vis (HIRVisItemVisitor &vis)
    5171              : {
    5172         6758 :   vis.visit (*this);
    5173         6758 : }
    5174              : 
    5175              : void
    5176         2918 : TypeAlias::accept_vis (HIRStmtVisitor &vis)
    5177              : {
    5178         2918 :   vis.visit (*this);
    5179         2918 : }
    5180              : 
    5181              : void
    5182         1660 : TypeAlias::accept_vis (HIRVisItemVisitor &vis)
    5183              : {
    5184         1660 :   vis.visit (*this);
    5185         1660 : }
    5186              : 
    5187              : void
    5188         3942 : TypeAlias::accept_vis (HIRImplVisitor &vis)
    5189              : {
    5190         3942 :   vis.visit (*this);
    5191         3942 : }
    5192              : 
    5193              : void
    5194        53964 : BlockExpr::accept_vis (HIRExpressionVisitor &vis)
    5195              : {
    5196        53964 :   vis.visit (*this);
    5197        53964 : }
    5198              : 
    5199              : void
    5200         1593 : AnonConst::accept_vis (HIRExpressionVisitor &vis)
    5201              : {
    5202         1593 :   vis.visit (*this);
    5203         1592 : }
    5204              : 
    5205              : void
    5206           45 : ConstBlock::accept_vis (HIRExpressionVisitor &vis)
    5207              : {
    5208           45 :   vis.visit (*this);
    5209           45 : }
    5210              : 
    5211              : void
    5212        34741 : Function::accept_vis (HIRStmtVisitor &vis)
    5213              : {
    5214        34741 :   vis.visit (*this);
    5215        34739 : }
    5216              : 
    5217              : void
    5218        34596 : Function::accept_vis (HIRVisItemVisitor &vis)
    5219              : {
    5220        34596 :   vis.visit (*this);
    5221        34596 : }
    5222              : 
    5223              : void
    5224        14612 : Function::accept_vis (HIRImplVisitor &vis)
    5225              : {
    5226        14612 :   vis.visit (*this);
    5227        14612 : }
    5228              : 
    5229              : void
    5230          203 : Union::accept_vis (HIRStmtVisitor &vis)
    5231              : {
    5232          203 :   vis.visit (*this);
    5233          203 : }
    5234              : 
    5235              : void
    5236          411 : Union::accept_vis (HIRVisItemVisitor &vis)
    5237              : {
    5238          411 :   vis.visit (*this);
    5239          411 : }
    5240              : 
    5241              : void
    5242         7987 : Trait::accept_vis (HIRStmtVisitor &vis)
    5243              : {
    5244         7987 :   vis.visit (*this);
    5245         7987 : }
    5246              : 
    5247              : void
    5248        16154 : Trait::accept_vis (HIRVisItemVisitor &vis)
    5249              : {
    5250        16154 :   vis.visit (*this);
    5251        16154 : }
    5252              : 
    5253              : void
    5254         1043 : Enum::accept_vis (HIRStmtVisitor &vis)
    5255              : {
    5256         1043 :   vis.visit (*this);
    5257         1043 : }
    5258              : 
    5259              : void
    5260         2102 : Enum::accept_vis (HIRVisItemVisitor &vis)
    5261              : {
    5262         2102 :   vis.visit (*this);
    5263         2102 : }
    5264              : 
    5265              : void
    5266            0 : UseDeclaration::accept_vis (HIRStmtVisitor &vis)
    5267              : {
    5268            0 :   vis.visit (*this);
    5269            0 : }
    5270              : 
    5271              : void
    5272            0 : UseDeclaration::accept_vis (HIRVisItemVisitor &vis)
    5273              : {
    5274            0 :   vis.visit (*this);
    5275            0 : }
    5276              : 
    5277              : void
    5278         3331 : StructStruct::accept_vis (HIRStmtVisitor &vis)
    5279              : {
    5280         3331 :   vis.visit (*this);
    5281         3331 : }
    5282              : 
    5283              : void
    5284         6139 : StructStruct::accept_vis (HIRVisItemVisitor &vis)
    5285              : {
    5286         6139 :   vis.visit (*this);
    5287         6139 : }
    5288              : 
    5289              : void
    5290        12582 : ImplBlock::accept_vis (HIRStmtVisitor &vis)
    5291              : {
    5292        12582 :   vis.visit (*this);
    5293        12582 : }
    5294              : 
    5295              : void
    5296        25340 : ImplBlock::accept_vis (HIRVisItemVisitor &vis)
    5297              : {
    5298        25340 :   vis.visit (*this);
    5299        25339 : }
    5300              : 
    5301              : void
    5302         1251 : ConstantItem::accept_vis (HIRStmtVisitor &vis)
    5303              : {
    5304         1251 :   vis.visit (*this);
    5305         1251 : }
    5306              : 
    5307              : void
    5308         1728 : ConstantItem::accept_vis (HIRVisItemVisitor &vis)
    5309              : {
    5310         1728 :   vis.visit (*this);
    5311         1728 : }
    5312              : 
    5313              : void
    5314          104 : ConstantItem::accept_vis (HIRImplVisitor &vis)
    5315              : {
    5316          104 :   vis.visit (*this);
    5317          104 : }
    5318              : 
    5319              : void
    5320         2094 : TupleStruct::accept_vis (HIRStmtVisitor &vis)
    5321              : {
    5322         2094 :   vis.visit (*this);
    5323         2094 : }
    5324              : 
    5325              : void
    5326         3469 : TupleStruct::accept_vis (HIRVisItemVisitor &vis)
    5327              : {
    5328         3469 :   vis.visit (*this);
    5329         3469 : }
    5330              : 
    5331              : void
    5332            0 : ExternCrate::accept_vis (HIRStmtVisitor &vis)
    5333              : {
    5334            0 :   vis.visit (*this);
    5335            0 : }
    5336              : 
    5337              : void
    5338            0 : ExternCrate::accept_vis (HIRVisItemVisitor &vis)
    5339              : {
    5340            0 :   vis.visit (*this);
    5341            0 : }
    5342              : 
    5343              : void
    5344          119 : StaticItem::accept_vis (HIRStmtVisitor &vis)
    5345              : {
    5346          119 :   vis.visit (*this);
    5347          119 : }
    5348              : 
    5349              : void
    5350          222 : StaticItem::accept_vis (HIRVisItemVisitor &vis)
    5351              : {
    5352          222 :   vis.visit (*this);
    5353          222 : }
    5354              : 
    5355              : } // namespace HIR
    5356              : } // namespace Rust
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.