LCOV - code coverage report
Current view: top level - gcc/rust/hir/tree - rust-hir.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 43.4 % 2415 1049
Test Date: 2026-08-22 16:33:35 Functions: 65.0 % 409 266
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           42 : indent_spaces (enum indent_mode mode)
      43              : {
      44           42 :   static int indent = 0;
      45           42 :   std::string str = "";
      46           42 :   if (out == mode)
      47            7 :     indent--;
      48          100 :   for (int i = 0; i < indent; i++)
      49           58 :     str += " ";
      50           42 :   if (enter == mode)
      51            7 :     indent++;
      52              : 
      53           42 :   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         4649 : Crate::Crate (std::vector<std::unique_ptr<Item>> items,
      75              :               AST::AttrVec inner_attrs, Analysis::NodeMapping mappings)
      76         4649 :   : WithInnerAttrs (std::move (inner_attrs)), items (std::move (items)),
      77         4649 :     mappings (mappings)
      78         4649 : {}
      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            4 : Visibility::to_string () const
     164              : {
     165            4 :   switch (vis_type)
     166              :     {
     167            4 :     case VisType::Private:
     168            4 :       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            3 : VisItem::to_string () const
     182              : {
     183              :   // FIXME: can't do formatting on string to make identation occur.
     184            3 :   std::string str = Item::to_string ();
     185              : 
     186            3 :   if (has_visibility ())
     187              :     {
     188            6 :       str = visibility.to_string () + " ";
     189              :     }
     190              : 
     191            3 :   return str;
     192              : }
     193              : 
     194              : // Creates a string that reflects the outer attributes stored.
     195              : std::string
     196            6 : Item::to_string () const
     197              : {
     198            6 :   std::string str;
     199              : 
     200            6 :   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            6 :   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            3 : Enum::to_string () const
     683              : {
     684            3 :   std::string str = VisItem::to_string ();
     685            3 :   str += enum_name.as_string ();
     686              : 
     687              :   // generic params
     688            3 :   str += "\n Generic params: ";
     689            3 :   if (generic_params.empty ())
     690              :     {
     691            3 :       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            3 :   str += "\n Where clause: ";
     711            3 :   if (has_where_clause ())
     712              :     {
     713            0 :       str += where_clause.to_string ();
     714              :     }
     715              :   else
     716              :     {
     717            3 :       str += "none";
     718              :     }
     719              : 
     720              :   // items
     721            3 :   str += "\n Items: ";
     722            3 :   if (items.empty ())
     723              :     {
     724            1 :       str += "none";
     725              :     }
     726              :   else
     727              :     {
     728            5 :       for (const auto &item : items)
     729              :         {
     730              :           // DEBUG: null pointer check
     731            3 :           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            6 :           str += "\n  " + item->to_string ();
     740              :         }
     741              :     }
     742              : 
     743            3 :   return str;
     744            3 : }
     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            5 : BlockExpr::to_string () const
    1006              : {
    1007            5 :   std::string istr = indent_spaces (enter);
    1008            5 :   std::string str = istr + "BlockExpr:\n" + istr;
    1009              :   // get outer attributes
    1010           10 :   str += "{\n" + indent_spaces (stay) + Expr::to_string ();
    1011              : 
    1012              :   // inner attributes
    1013           15 :   str += "\n" + indent_spaces (stay) + "inner attributes: ";
    1014            5 :   if (inner_attrs.empty ())
    1015              :     {
    1016            5 :       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           15 :   str += "\n" + indent_spaces (stay) + "statements: ";
    1030            5 :   if (statements.empty ())
    1031              :     {
    1032            0 :       str += "none";
    1033              :     }
    1034              :   else
    1035              :     {
    1036           11 :       for (const auto &stmt : statements)
    1037              :         {
    1038              :           // DEBUG: null pointer check
    1039            6 :           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           12 :           str += "\n" + indent_spaces (stay) + stmt->to_string ();
    1048              :         }
    1049              :     }
    1050              : 
    1051              :   // final expression
    1052           15 :   str += "\n" + indent_spaces (stay) + "final expression: ";
    1053            5 :   if (expr == nullptr)
    1054              :     {
    1055            1 :       str += "none";
    1056              :     }
    1057              :   else
    1058              :     {
    1059            8 :       str += "\n" + expr->to_string ();
    1060              :     }
    1061              : 
    1062           15 :   str += "\n" + indent_spaces (out) + "}";
    1063            5 :   return str;
    1064            5 : }
    1065              : 
    1066              : std::string
    1067            0 : AnonConst::to_string () const
    1068              : {
    1069            0 :   std::string istr = indent_spaces (enter);
    1070            0 :   std::string str = istr + "AnonConst:\n" + istr;
    1071              : 
    1072            0 :   if (expr.has_value ())
    1073            0 :     str += get_inner_expr ().to_string ();
    1074              :   else
    1075            0 :     str += "_";
    1076              : 
    1077            0 :   str += "\n" + indent_spaces (out);
    1078              : 
    1079            0 :   return str;
    1080            0 : }
    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           77 : PathInExpression::to_string () const
    1179              : {
    1180           77 :   std::string str;
    1181              : 
    1182           77 :   if (has_opening_scope_resolution)
    1183              :     {
    1184            0 :       str = "::";
    1185              :     }
    1186              : 
    1187           77 :   return str + PathPattern::to_string ();
    1188           77 : }
    1189              : 
    1190              : std::string
    1191            1 : ExprStmt::to_string () const
    1192              : {
    1193            2 :   std::string str = indent_spaces (enter) + "ExprStmt:\n";
    1194              : 
    1195            1 :   if (expr == nullptr)
    1196              :     {
    1197            0 :       str += "none (this should not happen and is an error)";
    1198              :     }
    1199              :   else
    1200              :     {
    1201            1 :       indent_spaces (enter);
    1202            2 :       str += expr->to_string ();
    1203            1 :       indent_spaces (out);
    1204              :     }
    1205              : 
    1206            1 :   indent_spaces (out);
    1207            1 :   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           77 : PathPattern::to_string () const
    1259              : {
    1260           77 :   if (is_lang_item ())
    1261            0 :     return LangItem::PrettyString (*lang_item);
    1262              : 
    1263           77 :   std::string str;
    1264              : 
    1265          162 :   for (const auto &segment : segments)
    1266              :     {
    1267          255 :       str += segment.to_string () + "::";
    1268              :     }
    1269              : 
    1270              :   // basically a hack - remove last two characters of string (remove final ::)
    1271           77 :   str.erase (str.length () - 2);
    1272              : 
    1273           77 :   return str;
    1274           77 : }
    1275              : 
    1276              : std::string
    1277            6 : QualifiedPathType::to_string () const
    1278              : {
    1279            6 :   std::string str ("<");
    1280           12 :   str += type->to_string ();
    1281              : 
    1282            6 :   if (has_as_clause ())
    1283              :     {
    1284           12 :       str += " as " + trait->to_string ();
    1285              :     }
    1286              : 
    1287            6 :   return str + ">";
    1288            6 : }
    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         2199 : NegationExpr::to_string () const
    1380              : {
    1381         2199 :   std::string str;
    1382              : 
    1383         2199 :   switch (expr_type)
    1384              :     {
    1385         2199 :     case NegationOperator::NEGATE:
    1386         2199 :       str = "-";
    1387         2199 :       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         4398 :   str += main_or_left_expr->to_string ();
    1396              : 
    1397         2199 :   return str;
    1398         2199 : }
    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            7 : ArithmeticOrLogicalExpr::get_operator_str () const
    1667              : {
    1668            7 :   std::string operator_str;
    1669            7 :   operator_str.reserve (1);
    1670              : 
    1671              :   // get operator string
    1672            7 :   switch (expr_type)
    1673              :     {
    1674            7 :     case ArithmeticOrLogicalOperator::ADD:
    1675            7 :       operator_str = "+";
    1676            7 :       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            7 :       break;
    1707              :     }
    1708              : 
    1709            7 :   return operator_str;
    1710              : }
    1711              : 
    1712              : std::string
    1713            4 : ArithmeticOrLogicalExpr::to_string () const
    1714              : {
    1715            8 :   std::string str = main_or_left_expr->to_string () + " ";
    1716           12 :   str += get_operator_str () + " ";
    1717            8 :   str += right_expr->to_string ();
    1718              : 
    1719            8 :   return "( " + str + " )";
    1720            4 : }
    1721              : 
    1722              : std::string
    1723            1 : CallExpr::to_string () const
    1724              : {
    1725            2 :   std::string str = function->to_string () + "(";
    1726            1 :   if (!has_params ())
    1727            1 :     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            1 :   return str + ")";
    1741            1 : }
    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            0 : TraitBound::to_string () const
    2098              : {
    2099            0 :   std::string str;
    2100            0 :   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            0 :   if (has_for_lifetimes ())
    2113            0 :     for (const auto &lifetime : for_lifetimes)
    2114            0 :       str += "\n  " + lifetime.to_string ();
    2115              : 
    2116            0 :   str += "\n" + type_path.to_string ();
    2117              : 
    2118            0 :   return str;
    2119              : }
    2120              : 
    2121              : std::string
    2122            6 : QualifiedPathInType::to_string () const
    2123              : {
    2124            6 :   std::string str = path_type.to_string ();
    2125              : 
    2126           12 :   str += "::" + associated_segment->to_string ();
    2127            6 :   for (const auto &segment : segments)
    2128              :     {
    2129            0 :       str += "::" + segment->to_string ();
    2130              :     }
    2131              : 
    2132            6 :   return str;
    2133              : }
    2134              : 
    2135              : std::string
    2136          146 : Lifetime::to_string () const
    2137              : {
    2138          146 :   switch (lifetime_type)
    2139              :     {
    2140           37 :     case AST::Lifetime::LifetimeType::NAMED:
    2141           37 :       return "'" + lifetime_name;
    2142           14 :     case AST::Lifetime::LifetimeType::STATIC:
    2143           14 :       return "'static";
    2144           95 :     case AST::Lifetime::LifetimeType::WILDCARD:
    2145           95 :       return "'_";
    2146            0 :     default:
    2147            0 :       return "ERROR-MARK-STRING: lifetime type failure";
    2148              :     }
    2149              : }
    2150              : 
    2151              : std::string
    2152         2013 : TypePath::to_string () const
    2153              : {
    2154         2013 :   std::string str;
    2155              : 
    2156         2013 :   if (has_opening_scope_resolution)
    2157              :     {
    2158           59 :       str = "::";
    2159              :     }
    2160              : 
    2161         4276 :   for (const auto &segment : segments)
    2162              :     {
    2163         6789 :       str += segment->to_string () + "::";
    2164              :     }
    2165              : 
    2166              :   // kinda hack - remove last 2 '::' characters
    2167         2013 :   str.erase (str.length () - 2);
    2168              : 
    2169         2013 :   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          103 : PathExprSegment::to_string () const
    2327              : {
    2328          103 :   std::string ident_str = segment_name.to_string ();
    2329          103 :   if (has_generic_args ())
    2330              :     {
    2331            0 :       ident_str += "::<" + generic_args.to_string () + ">";
    2332              :     }
    2333              : 
    2334          103 :   return ident_str;
    2335              : }
    2336              : 
    2337              : std::string
    2338         1920 : GenericArgs::to_string () const
    2339              : {
    2340         1920 :   std::string args;
    2341              : 
    2342              :   // lifetime args
    2343         1920 :   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         1920 :   if (!type_args.empty ())
    2358              :     {
    2359         3862 :       auto i = type_args.begin ();
    2360         3862 :       auto e = type_args.end ();
    2361              : 
    2362         3862 :       for (; i != e; i++)
    2363              :         {
    2364         4030 :           args += (*i)->to_string ();
    2365         2015 :           if (e != i + 1)
    2366          168 :             args += ", ";
    2367              :         }
    2368              :     }
    2369              : 
    2370              :   // binding args
    2371         1920 :   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         1920 :   return args;
    2385              : }
    2386              : 
    2387              : std::string
    2388            0 : GenericArgsBinding::to_string () const
    2389              : {
    2390            0 :   return identifier.as_string () + " = " + type->to_string ();
    2391              : }
    2392              : 
    2393              : std::string
    2394            0 : RangePattern::to_string () const
    2395              : {
    2396            0 :   if (has_ellipsis_syntax)
    2397              :     {
    2398            0 :       return lower->to_string () + "..." + upper->to_string ();
    2399              :     }
    2400              :   else
    2401              :     {
    2402            0 :       return lower->to_string () + "..=" + upper->to_string ();
    2403              :     }
    2404              : }
    2405              : 
    2406              : std::string
    2407            0 : RangePatternBoundLiteral::to_string () const
    2408              : {
    2409            0 :   std::string str;
    2410              : 
    2411            0 :   if (has_minus)
    2412              :     {
    2413            0 :       str += "-";
    2414              :     }
    2415              : 
    2416            0 :   str += literal.as_string ();
    2417              : 
    2418            0 :   return str;
    2419              : }
    2420              : 
    2421              : std::string
    2422            4 : SlicePatternItemsNoRest::to_string () const
    2423              : {
    2424            4 :   std::string str;
    2425              : 
    2426           16 :   for (const auto &pattern : patterns)
    2427              :     {
    2428           24 :       str += "\n " + pattern->to_string ();
    2429              :     }
    2430              : 
    2431            4 :   return str;
    2432              : }
    2433              : 
    2434              : std::string
    2435            0 : SlicePatternItemsHasRest::to_string () const
    2436              : {
    2437            0 :   std::string str;
    2438              : 
    2439            0 :   str += "\n Lower patterns: ";
    2440            0 :   if (lower_patterns.empty ())
    2441              :     {
    2442            0 :       str += "none";
    2443              :     }
    2444              :   else
    2445              :     {
    2446            0 :       for (const auto &lower : lower_patterns)
    2447              :         {
    2448            0 :           str += "\n  " + lower->to_string ();
    2449              :         }
    2450              :     }
    2451              : 
    2452            0 :   str += "\n Upper patterns: ";
    2453            0 :   if (upper_patterns.empty ())
    2454              :     {
    2455            0 :       str += "none";
    2456              :     }
    2457              :   else
    2458              :     {
    2459            0 :       for (const auto &upper : upper_patterns)
    2460              :         {
    2461            0 :           str += "\n  " + upper->to_string ();
    2462              :         }
    2463              :     }
    2464              : 
    2465            0 :   return str;
    2466              : }
    2467              : 
    2468              : std::string
    2469            4 : SlicePattern::to_string () const
    2470              : {
    2471            4 :   return "SlicePattern: " + items->to_string ();
    2472              : }
    2473              : 
    2474              : std::string
    2475            0 : AltPattern::to_string () const
    2476              : {
    2477            0 :   std::string str ("AltPattern: ");
    2478              : 
    2479            0 :   for (const auto &pattern : alts)
    2480              :     {
    2481            0 :       str += "\n " + pattern->to_string ();
    2482              :     }
    2483              : 
    2484            0 :   return str;
    2485              : }
    2486              : 
    2487              : std::string
    2488           36 : TuplePatternItemsNoRest::to_string () const
    2489              : {
    2490           36 :   std::string str;
    2491              : 
    2492          108 :   for (const auto &pattern : patterns)
    2493              :     {
    2494          144 :       str += "\n " + pattern->to_string ();
    2495              :     }
    2496              : 
    2497           36 :   return str;
    2498              : }
    2499              : 
    2500              : std::string
    2501           12 : TuplePatternItemsHasRest::to_string () const
    2502              : {
    2503           12 :   std::string str;
    2504              : 
    2505           12 :   str += "\n Lower patterns: ";
    2506           12 :   if (lower_patterns.empty ())
    2507              :     {
    2508            8 :       str += "none";
    2509              :     }
    2510              :   else
    2511              :     {
    2512            8 :       for (const auto &lower : lower_patterns)
    2513              :         {
    2514            8 :           str += "\n  " + lower->to_string ();
    2515              :         }
    2516              :     }
    2517              : 
    2518           12 :   str += "\n Upper patterns: ";
    2519           12 :   if (upper_patterns.empty ())
    2520              :     {
    2521            8 :       str += "none";
    2522              :     }
    2523              :   else
    2524              :     {
    2525            8 :       for (const auto &upper : upper_patterns)
    2526              :         {
    2527            8 :           str += "\n  " + upper->to_string ();
    2528              :         }
    2529              :     }
    2530              : 
    2531           12 :   return str;
    2532              : }
    2533              : 
    2534              : std::string
    2535           48 : TuplePattern::to_string () const
    2536              : {
    2537           48 :   return items->to_string ();
    2538              : }
    2539              : 
    2540              : std::string
    2541           24 : StructPatternField::to_string () const
    2542              : {
    2543              :   // outer attributes
    2544           24 :   std::string str ("Outer attributes: ");
    2545           24 :   if (outer_attrs.empty ())
    2546              :     {
    2547           24 :       str += "none";
    2548              :     }
    2549              :   else
    2550              :     {
    2551              :       /* note that this does not print them with "outer attribute" syntax -
    2552              :        * just the body */
    2553            0 :       for (const auto &attr : outer_attrs)
    2554              :         {
    2555            0 :           str += "\n    " + attr.as_string ();
    2556              :         }
    2557              :     }
    2558              : 
    2559           24 :   str += "\n   item type: ";
    2560           24 :   switch (get_item_type ())
    2561              :     {
    2562            0 :     case ItemType::TUPLE_PAT:
    2563            0 :       str += "TUPLE_PAT";
    2564            0 :       break;
    2565           16 :     case ItemType::IDENT_PAT:
    2566           16 :       str += "IDENT_PAT";
    2567           16 :       break;
    2568            8 :     case ItemType::IDENT:
    2569            8 :       str += "IDENT";
    2570            8 :       break;
    2571            0 :     default:
    2572            0 :       str += "UNKNOWN";
    2573            0 :       break;
    2574              :     }
    2575              : 
    2576           24 :   return str;
    2577              : }
    2578              : 
    2579              : std::string
    2580            8 : StructPatternFieldIdent::to_string () const
    2581              : {
    2582            8 :   std::string str = StructPatternField::to_string ();
    2583              : 
    2584            8 :   str += "\n";
    2585              : 
    2586            8 :   if (has_ref)
    2587              :     {
    2588            0 :       str += "ref ";
    2589              :     }
    2590              : 
    2591            8 :   if (is_mut ())
    2592              :     {
    2593            0 :       str += "mut ";
    2594              :     }
    2595              : 
    2596            8 :   str += ident.as_string ();
    2597              : 
    2598            8 :   return str;
    2599              : }
    2600              : 
    2601              : std::string
    2602            0 : StructPatternFieldTuplePat::to_string () const
    2603              : {
    2604            0 :   std::string str = StructPatternField::to_string ();
    2605              : 
    2606            0 :   str += "\n";
    2607              : 
    2608            0 :   str += std::to_string (index) + " : " + tuple_pattern->to_string ();
    2609              : 
    2610            0 :   return str;
    2611              : }
    2612              : 
    2613              : std::string
    2614           16 : StructPatternFieldIdentPat::to_string () const
    2615              : {
    2616           16 :   std::string str = StructPatternField::to_string ();
    2617              : 
    2618           16 :   str += "\n";
    2619              : 
    2620           32 :   str += ident.as_string () + " : " + ident_pattern->to_string ();
    2621              : 
    2622           16 :   return str;
    2623              : }
    2624              : 
    2625              : std::string
    2626           12 : StructPatternElements::to_string () const
    2627              : {
    2628           12 :   std::string str ("\n  Fields: ");
    2629              : 
    2630           12 :   if (!has_struct_pattern_fields ())
    2631              :     {
    2632            0 :       str += "none";
    2633              :     }
    2634              :   else
    2635              :     {
    2636           36 :       for (const auto &field : fields)
    2637              :         {
    2638           48 :           str += "\n   " + field->to_string ();
    2639              :         }
    2640              :     }
    2641              : 
    2642           12 :   return str;
    2643              : }
    2644              : 
    2645              : std::string
    2646           12 : StructPattern::to_string () const
    2647              : {
    2648           12 :   std::string str ("StructPattern: \n Path: ");
    2649              : 
    2650           24 :   str += path.to_string ();
    2651              : 
    2652           12 :   str += "\n Struct pattern elems: ";
    2653           12 :   if (!has_struct_pattern_elems ())
    2654              :     {
    2655            0 :       str += "none";
    2656              :     }
    2657              :   else
    2658              :     {
    2659           24 :       str += elems.to_string ();
    2660              :     }
    2661              : 
    2662           12 :   return str;
    2663              : }
    2664              : 
    2665              : std::string
    2666            0 : LiteralPattern::to_string () const
    2667              : {
    2668            0 :   return (has_minus ? "-" : "") + lit.as_string ();
    2669              : }
    2670              : 
    2671              : std::string
    2672           52 : ReferencePattern::to_string () const
    2673              : {
    2674           52 :   std::string str ("&");
    2675              : 
    2676           52 :   if (is_mut ())
    2677              :     {
    2678            0 :       str += "mut ";
    2679              :     }
    2680              : 
    2681          104 :   str += pattern->to_string ();
    2682              : 
    2683           52 :   return str;
    2684              : }
    2685              : 
    2686              : std::string
    2687       142954 : IdentifierPattern::to_string () const
    2688              : {
    2689       142954 :   std::string str;
    2690              : 
    2691       142954 :   if (is_ref)
    2692              :     {
    2693        42510 :       str += "ref ";
    2694              :     }
    2695              : 
    2696       142954 :   if (is_mut ())
    2697              :     {
    2698         2287 :       str += "mut ";
    2699              :     }
    2700              : 
    2701       142954 :   str += variable_ident.as_string ();
    2702              : 
    2703       142954 :   if (has_subpattern ())
    2704              :     {
    2705           16 :       str += " @ " + subpattern->to_string ();
    2706              :     }
    2707              : 
    2708       142954 :   return str;
    2709              : }
    2710              : 
    2711              : std::string
    2712           43 : TupleStructItemsNoRest::to_string () const
    2713              : {
    2714           43 :   std::string str;
    2715              : 
    2716           90 :   for (const auto &pattern : patterns)
    2717              :     {
    2718           94 :       str += "\n  " + pattern->to_string ();
    2719              :     }
    2720              : 
    2721           43 :   return str;
    2722              : }
    2723              : 
    2724              : std::string
    2725            8 : TupleStructItemsHasRest::to_string () const
    2726              : {
    2727            8 :   std::string str ("\n  Lower patterns: ");
    2728              : 
    2729            8 :   if (lower_patterns.empty ())
    2730              :     {
    2731            0 :       str += "none";
    2732              :     }
    2733              :   else
    2734              :     {
    2735           16 :       for (const auto &lower : lower_patterns)
    2736              :         {
    2737           16 :           str += "\n   " + lower->to_string ();
    2738              :         }
    2739              :     }
    2740              : 
    2741            8 :   str += "\n  Upper patterns: ";
    2742            8 :   if (upper_patterns.empty ())
    2743              :     {
    2744            0 :       str += "none";
    2745              :     }
    2746              :   else
    2747              :     {
    2748           16 :       for (const auto &upper : upper_patterns)
    2749              :         {
    2750           16 :           str += "\n   " + upper->to_string ();
    2751              :         }
    2752              :     }
    2753              : 
    2754            8 :   return str;
    2755              : }
    2756              : 
    2757              : std::string
    2758           51 : TupleStructPattern::to_string () const
    2759              : {
    2760           51 :   std::string str ("TupleStructPattern: \n Path: ");
    2761              : 
    2762          102 :   str += path.to_string ();
    2763              : 
    2764          102 :   str += "\n Tuple struct items: " + items->to_string ();
    2765              : 
    2766           51 :   return str;
    2767              : }
    2768              : 
    2769              : std::string
    2770            2 : LetStmt::to_string () const
    2771              : {
    2772              :   // outer attributes
    2773            2 :   std::string str = "Outer attributes: ";
    2774            2 :   if (outer_attrs.empty ())
    2775              :     {
    2776            2 :       str += "none";
    2777              :     }
    2778              :   else
    2779              :     {
    2780              :       /* note that this does not print them with "outer attribute" syntax -
    2781              :        * just the body */
    2782            0 :       indent_spaces (enter);
    2783            0 :       for (const auto &attr : outer_attrs)
    2784              :         {
    2785            0 :           str += "\n" + indent_spaces (stay) + attr.as_string ();
    2786              :         }
    2787            0 :       indent_spaces (out);
    2788              :     }
    2789              : 
    2790            6 :   str += "\n" + indent_spaces (stay) + "let " + variables_pattern->to_string ();
    2791              : 
    2792            2 :   if (has_type ())
    2793              :     {
    2794            0 :       str += " : " + get_type ().to_string ();
    2795              :     }
    2796              : 
    2797            2 :   if (has_init_expr ())
    2798              :     {
    2799            4 :       str += " = " + get_init_expr ().to_string ();
    2800              :     }
    2801              : 
    2802            2 :   return str;
    2803              : }
    2804              : 
    2805              : // Used to get outer attributes for expressions.
    2806              : std::string
    2807            5 : Expr::to_string () const
    2808              : {
    2809              :   // outer attributes
    2810            5 :   std::string str = "outer attributes: ";
    2811            5 :   if (outer_attrs.empty ())
    2812              :     {
    2813            5 :       str += "none";
    2814              :     }
    2815              :   else
    2816              :     {
    2817              :       /* note that this does not print them with "outer attribute" syntax -
    2818              :        * just the body */
    2819            0 :       for (const auto &attr : outer_attrs)
    2820              :         {
    2821            0 :           str += "\n  " + attr.as_string ();
    2822              :         }
    2823              :     }
    2824              : 
    2825            5 :   return str;
    2826              : }
    2827              : 
    2828              : // hopefully definition here will prevent circular dependency issue
    2829              : std::unique_ptr<TraitBound>
    2830            0 : TypePath::to_trait_bound (bool in_parens) const
    2831              : {
    2832              :   // If already in parentheses, don't convert to trait bound
    2833              :   // This ensures (TypePath) stays as ParenthesisedType in the parser
    2834            0 :   if (in_parens)
    2835            0 :     return nullptr;
    2836              : 
    2837              :   // create clone FIXME is this required? or is copy constructor automatically
    2838              :   // called?
    2839            0 :   TypePath copy (*this);
    2840            0 :   return std::make_unique<TraitBound> (mappings, std::move (copy),
    2841            0 :                                        copy.get_locus (), in_parens);
    2842            0 : }
    2843              : 
    2844              : std::string
    2845            3 : InferredType::to_string () const
    2846              : {
    2847            3 :   return "_ (inferred)";
    2848              : }
    2849              : 
    2850              : std::string
    2851            0 : TypeCastExpr::to_string () const
    2852              : {
    2853            0 :   return main_or_left_expr->to_string () + " as "
    2854            0 :          + type_to_convert_to->to_string ();
    2855              : }
    2856              : 
    2857              : std::string
    2858            0 : ImplTraitType::to_string () const
    2859              : {
    2860            0 :   std::string str ("ImplTraitType: \n TypeParamBounds: ");
    2861              : 
    2862            0 :   if (type_param_bounds.empty ())
    2863              :     {
    2864            0 :       str += "none";
    2865              :     }
    2866              :   else
    2867              :     {
    2868            0 :       for (const auto &bound : type_param_bounds)
    2869              :         {
    2870            0 :           str += "\n  " + bound->to_string ();
    2871              :         }
    2872              :     }
    2873              : 
    2874            0 :   return str;
    2875              : }
    2876              : 
    2877              : std::string
    2878          110 : ReferenceType::to_string () const
    2879              : {
    2880          110 :   std::string str ("&");
    2881              : 
    2882          110 :   if (has_lifetime ())
    2883              :     {
    2884          330 :       str += get_lifetime ().to_string () + " ";
    2885              :     }
    2886              : 
    2887          110 :   if (is_mut ())
    2888              :     {
    2889            7 :       str += "mut ";
    2890              :     }
    2891              : 
    2892          220 :   str += type->to_string ();
    2893              : 
    2894          110 :   return str;
    2895              : }
    2896              : 
    2897              : std::string
    2898            0 : RawPointerType::to_string () const
    2899              : {
    2900            0 :   return std::string ("*") + (is_mut () ? "mut " : "const ")
    2901            0 :          + type->to_string ();
    2902              : }
    2903              : 
    2904              : std::string
    2905            0 : TraitObjectType::to_string () const
    2906              : {
    2907            0 :   std::string str ("TraitObjectType: \n Has dyn dispatch: ");
    2908              : 
    2909            0 :   if (has_dyn)
    2910              :     {
    2911            0 :       str += "true";
    2912              :     }
    2913              :   else
    2914              :     {
    2915            0 :       str += "false";
    2916              :     }
    2917              : 
    2918            0 :   str += "\n TypeParamBounds: ";
    2919            0 :   if (type_param_bounds.empty ())
    2920              :     {
    2921            0 :       str += "none";
    2922              :     }
    2923              :   else
    2924              :     {
    2925            0 :       for (const auto &bound : type_param_bounds)
    2926              :         {
    2927            0 :           str += "\n  " + bound->to_string ();
    2928              :         }
    2929              :     }
    2930              : 
    2931            0 :   return str;
    2932              : }
    2933              : 
    2934              : std::string
    2935            2 : BareFunctionType::to_string () const
    2936              : {
    2937            2 :   std::string str ("BareFunctionType: \n For lifetimes: ");
    2938              : 
    2939            2 :   if (!has_for_lifetimes ())
    2940              :     {
    2941            2 :       str += "none";
    2942              :     }
    2943              :   else
    2944              :     {
    2945            0 :       for (const auto &for_lifetime : for_lifetimes)
    2946              :         {
    2947            0 :           str += "\n  " + for_lifetime.to_string ();
    2948              :         }
    2949              :     }
    2950              : 
    2951            4 :   str += "\n Qualifiers: " + function_qualifiers.to_string ();
    2952              : 
    2953            2 :   str += "\n Params: ";
    2954            2 :   if (params.empty ())
    2955              :     {
    2956            2 :       str += "none";
    2957              :     }
    2958              :   else
    2959              :     {
    2960            0 :       for (const auto &param : params)
    2961              :         {
    2962            0 :           str += "\n  " + param.to_string ();
    2963              :         }
    2964              :     }
    2965              : 
    2966            2 :   str += "\n Is variadic: ";
    2967            2 :   if (is_variadic)
    2968              :     {
    2969            0 :       str += "true";
    2970              :     }
    2971              :   else
    2972              :     {
    2973            2 :       str += "false";
    2974              :     }
    2975              : 
    2976            2 :   str += "\n Return type: ";
    2977            2 :   if (!has_return_type ())
    2978              :     {
    2979            2 :       str += "none (void)";
    2980              :     }
    2981              :   else
    2982              :     {
    2983            0 :       str += return_type->to_string ();
    2984              :     }
    2985              : 
    2986            2 :   return str;
    2987              : }
    2988              : 
    2989              : std::string
    2990         1920 : TypePathSegmentGeneric::to_string () const
    2991              : {
    2992         5760 :   return TypePathSegment::to_string () + "<" + generic_args.to_string () + ">";
    2993              : }
    2994              : 
    2995              : std::string
    2996            0 : TypePathFunction::to_string () const
    2997              : {
    2998            0 :   std::string str ("(");
    2999              : 
    3000            0 :   if (has_inputs ())
    3001              :     {
    3002            0 :       auto i = inputs.begin ();
    3003            0 :       auto e = inputs.end ();
    3004              : 
    3005            0 :       for (; i != e; i++)
    3006              :         {
    3007            0 :           str += (*i)->to_string ();
    3008            0 :           if (e != i + 1)
    3009            0 :             str += ", ";
    3010              :         }
    3011              :     }
    3012              : 
    3013            0 :   str += ")";
    3014              : 
    3015            0 :   if (has_return_type ())
    3016              :     {
    3017            0 :       str += " -> " + return_type->to_string ();
    3018              :     }
    3019              : 
    3020            0 :   return str;
    3021              : }
    3022              : 
    3023              : std::string
    3024            0 : TypePathSegmentFunction::to_string () const
    3025              : {
    3026            0 :   return TypePathSegment::to_string () + function_path.to_string ();
    3027              : }
    3028              : 
    3029              : std::string
    3030            0 : ArrayType::to_string () const
    3031              : {
    3032            0 :   return "[" + elem_type->to_string () + "; " + size->to_string () + "]";
    3033              : }
    3034              : 
    3035              : std::string
    3036           28 : SliceType::to_string () const
    3037              : {
    3038           56 :   return "[" + elem_type->to_string () + "]";
    3039              : }
    3040              : 
    3041              : std::string
    3042            9 : TupleType::to_string () const
    3043              : {
    3044            9 :   std::string str ("(");
    3045              : 
    3046            9 :   if (!is_unit_type ())
    3047              :     {
    3048            5 :       auto i = elems.begin ();
    3049            5 :       auto e = elems.end ();
    3050              : 
    3051            5 :       for (; i != e; i++)
    3052              :         {
    3053            6 :           str += (*i)->to_string ();
    3054            3 :           if (e != i + 1)
    3055            1 :             str += ", ";
    3056              :         }
    3057              :     }
    3058              : 
    3059            9 :   str += ")";
    3060              : 
    3061            9 :   return str;
    3062              : }
    3063              : 
    3064              : std::string
    3065            0 : StructExpr::to_string () const
    3066              : {
    3067            0 :   std::string str = ExprWithoutBlock::to_string ();
    3068            0 :   indent_spaces (enter);
    3069            0 :   str += "\n" + indent_spaces (stay) + "StructExpr:";
    3070            0 :   indent_spaces (enter);
    3071            0 :   str += "\n" + indent_spaces (stay) + "PathInExpr:\n";
    3072            0 :   str += indent_spaces (stay) + struct_name.to_string ();
    3073            0 :   indent_spaces (out);
    3074            0 :   indent_spaces (out);
    3075            0 :   return str;
    3076              : }
    3077              : 
    3078              : std::string
    3079            0 : StructExprStruct::to_string () const
    3080              : {
    3081            0 :   std::string str ("StructExprStruct (or subclass): ");
    3082              : 
    3083            0 :   str += "\n Path: " + struct_name.to_string ();
    3084              : 
    3085              :   // inner attributes
    3086            0 :   str += "\n inner attributes: ";
    3087            0 :   if (inner_attrs.empty ())
    3088              :     {
    3089            0 :       str += "none";
    3090              :     }
    3091              :   else
    3092              :     {
    3093              :       /* note that this does not print them with "inner attribute" syntax -
    3094              :        * just the body */
    3095            0 :       for (const auto &attr : inner_attrs)
    3096              :         {
    3097            0 :           str += "\n  " + attr.as_string ();
    3098              :         }
    3099              :     }
    3100              : 
    3101            0 :   return str;
    3102              : }
    3103              : 
    3104              : std::string
    3105            0 : StructBase::to_string () const
    3106              : {
    3107            0 :   if (base_struct != nullptr)
    3108              :     {
    3109            0 :       return base_struct->to_string ();
    3110              :     }
    3111              :   else
    3112              :     {
    3113            0 :       return "ERROR_MARK_STRING - invalid struct base had as string applied";
    3114              :     }
    3115              : }
    3116              : 
    3117              : std::string
    3118            0 : StructExprFieldWithVal::to_string () const
    3119              : {
    3120              :   // used to get value string
    3121            0 :   return value->to_string ();
    3122              : }
    3123              : 
    3124              : std::string
    3125            0 : StructExprFieldIdentifierValue::to_string () const
    3126              : {
    3127            0 :   return field_name.as_string () + " : " + StructExprFieldWithVal::to_string ();
    3128              : }
    3129              : 
    3130              : std::string
    3131            0 : StructExprFieldIndexValue::to_string () const
    3132              : {
    3133            0 :   return std::to_string (index) + " : " + StructExprFieldWithVal::to_string ();
    3134              : }
    3135              : 
    3136              : std::string
    3137            0 : StructExprStructFields::to_string () const
    3138              : {
    3139            0 :   std::string str = StructExprStruct::to_string ();
    3140              : 
    3141            0 :   str += "\n Fields: ";
    3142            0 :   if (fields.empty ())
    3143              :     {
    3144            0 :       str += "none";
    3145              :     }
    3146              :   else
    3147              :     {
    3148            0 :       for (const auto &field : fields)
    3149              :         {
    3150            0 :           str += "\n  " + field->to_string ();
    3151              :         }
    3152              :     }
    3153              : 
    3154            0 :   str += "\n Struct base: ";
    3155            0 :   if (!has_struct_base ())
    3156              :     {
    3157            0 :       str += "none";
    3158              :     }
    3159              :   else
    3160              :     {
    3161            0 :       str += (*struct_base)->to_string ();
    3162              :     }
    3163              : 
    3164            0 :   return str;
    3165              : }
    3166              : 
    3167              : std::string
    3168            3 : EnumItem::to_string () const
    3169              : {
    3170            3 :   std::string str = Item::to_string ();
    3171            3 :   str += variant_name.as_string ();
    3172            3 :   str += " ";
    3173            3 :   switch (get_enum_item_kind ())
    3174              :     {
    3175            1 :     case Named:
    3176            1 :       str += "[Named variant]";
    3177            1 :       break;
    3178            1 :     case Tuple:
    3179            1 :       str += "[Tuple variant]";
    3180            1 :       break;
    3181            0 :     case Struct:
    3182            0 :       str += "[Struct variant]";
    3183            0 :       break;
    3184            1 :     case Discriminant:
    3185            1 :       str += "[Discriminant variant]";
    3186            1 :       break;
    3187              :     }
    3188              : 
    3189            3 :   return str;
    3190              : }
    3191              : 
    3192              : std::string
    3193            1 : EnumItemTuple::to_string () const
    3194              : {
    3195            1 :   std::string str = EnumItem::to_string ();
    3196              : 
    3197              :   // add tuple opening parens
    3198            1 :   str += "(";
    3199              : 
    3200              :   // tuple fields
    3201            1 :   if (has_tuple_fields ())
    3202              :     {
    3203            2 :       auto i = tuple_fields.begin ();
    3204            2 :       auto e = tuple_fields.end ();
    3205              : 
    3206            2 :       for (; i != e; i++)
    3207              :         {
    3208            2 :           str += (*i).to_string ();
    3209            1 :           if (e != i + 1)
    3210            0 :             str += ", ";
    3211              :         }
    3212              :     }
    3213              : 
    3214              :   // add tuple closing parens
    3215            1 :   str += ")";
    3216              : 
    3217            1 :   return str;
    3218              : }
    3219              : 
    3220              : std::string
    3221            1 : TupleField::to_string () const
    3222              : {
    3223              :   // outer attributes
    3224            1 :   std::string str = "outer attributes: ";
    3225            1 :   if (outer_attrs.empty ())
    3226              :     {
    3227            1 :       str += "none";
    3228              :     }
    3229              :   else
    3230              :     {
    3231              :       /* note that this does not print them with "outer attribute" syntax -
    3232              :        * just the body */
    3233            0 :       for (const auto &attr : outer_attrs)
    3234              :         {
    3235            0 :           str += "\n  " + attr.as_string ();
    3236              :         }
    3237              :     }
    3238              : 
    3239            1 :   if (has_visibility ())
    3240              :     {
    3241            2 :       str += "\n" + visibility.to_string ();
    3242              :     }
    3243              : 
    3244            2 :   str += " " + field_type->to_string ();
    3245              : 
    3246            1 :   return str;
    3247              : }
    3248              : 
    3249              : std::string
    3250            0 : EnumItemStruct::to_string () const
    3251              : {
    3252            0 :   std::string str = EnumItem::to_string ();
    3253              : 
    3254              :   // add struct opening parens
    3255            0 :   str += "{";
    3256              : 
    3257              :   // tuple fields
    3258            0 :   if (has_struct_fields ())
    3259              :     {
    3260            0 :       auto i = struct_fields.begin ();
    3261            0 :       auto e = struct_fields.end ();
    3262              : 
    3263            0 :       for (; i != e; i++)
    3264              :         {
    3265            0 :           str += (*i).to_string ();
    3266            0 :           if (e != i + 1)
    3267            0 :             str += ", ";
    3268              :         }
    3269              :     }
    3270              : 
    3271              :   // add struct closing parens
    3272            0 :   str += "}";
    3273              : 
    3274            0 :   return str;
    3275              : }
    3276              : 
    3277              : std::string
    3278            0 : StructField::to_string () const
    3279              : {
    3280              :   // outer attributes
    3281            0 :   std::string str = "outer attributes: ";
    3282            0 :   if (outer_attrs.empty ())
    3283              :     {
    3284            0 :       str += "none";
    3285              :     }
    3286              :   else
    3287              :     {
    3288              :       /* note that this does not print them with "outer attribute" syntax -
    3289              :        * just the body */
    3290            0 :       for (const auto &attr : outer_attrs)
    3291              :         {
    3292            0 :           str += "\n  " + attr.as_string ();
    3293              :         }
    3294              :     }
    3295              : 
    3296            0 :   if (has_visibility ())
    3297              :     {
    3298            0 :       str += "\n" + visibility.to_string ();
    3299              :     }
    3300              : 
    3301            0 :   str += " " + field_name.as_string () + " : " + field_type->to_string ();
    3302              : 
    3303            0 :   return str;
    3304              : }
    3305              : 
    3306              : std::string
    3307            1 : EnumItemDiscriminant::to_string () const
    3308              : {
    3309            1 :   std::string str = EnumItem::to_string ();
    3310              : 
    3311              :   // add equal and expression
    3312            2 :   str += " = " + expression->to_string ();
    3313              : 
    3314            1 :   return str;
    3315              : }
    3316              : 
    3317              : std::string
    3318            0 : ExternalItem::to_string () const
    3319              : {
    3320              :   // outer attributes
    3321            0 :   std::string str = "outer attributes: ";
    3322            0 :   if (outer_attrs.empty ())
    3323              :     {
    3324            0 :       str += "none";
    3325              :     }
    3326              :   else
    3327              :     {
    3328              :       /* note that this does not print them with "outer attribute" syntax -
    3329              :        * just the body */
    3330            0 :       for (const auto &attr : outer_attrs)
    3331              :         {
    3332            0 :           str += "\n  " + attr.as_string ();
    3333              :         }
    3334              :     }
    3335              : 
    3336              :   // start visibility on new line and with a space
    3337            0 :   str += "\n" + visibility.to_string () + " ";
    3338              : 
    3339            0 :   return str;
    3340              : }
    3341              : 
    3342              : std::string
    3343            0 : ExternalStaticItem::to_string () const
    3344              : {
    3345            0 :   std::string str = ExternalItem::to_string ();
    3346              : 
    3347            0 :   str += "static ";
    3348              : 
    3349            0 :   if (is_mut ())
    3350              :     {
    3351            0 :       str += "mut ";
    3352              :     }
    3353              : 
    3354              :   // add name
    3355            0 :   str += get_item_name ().as_string ();
    3356              : 
    3357              :   // add type on new line
    3358            0 :   str += "\n Type: " + item_type->to_string ();
    3359              : 
    3360            0 :   return str;
    3361              : }
    3362              : 
    3363              : std::string
    3364            0 : ExternalFunctionItem::to_string () const
    3365              : {
    3366            0 :   std::string str = ExternalItem::to_string ();
    3367              : 
    3368            0 :   str += "fn ";
    3369              : 
    3370              :   // add name
    3371            0 :   str += get_item_name ().as_string ();
    3372              : 
    3373              :   // generic params
    3374            0 :   str += "\n Generic params: ";
    3375            0 :   if (generic_params.empty ())
    3376              :     {
    3377            0 :       str += "none";
    3378              :     }
    3379              :   else
    3380              :     {
    3381            0 :       for (const auto &param : generic_params)
    3382              :         {
    3383              :           // DEBUG: null pointer check
    3384            0 :           if (param == nullptr)
    3385              :             {
    3386            0 :               rust_debug (
    3387              :                 "something really terrible has gone wrong - null pointer "
    3388              :                 "generic param in external function item.");
    3389            0 :               return "nullptr_POINTER_MARK";
    3390              :             }
    3391              : 
    3392            0 :           str += "\n  " + param->to_string ();
    3393              :         }
    3394              :     }
    3395              : 
    3396              :   // function params
    3397            0 :   str += "\n Function params: ";
    3398            0 :   if (function_params.empty ())
    3399              :     {
    3400            0 :       str += "none";
    3401              :     }
    3402              :   else
    3403              :     {
    3404            0 :       for (const auto &param : function_params)
    3405              :         {
    3406            0 :           str += "\n  " + param.to_string ();
    3407              :         }
    3408            0 :       if (has_variadics)
    3409              :         {
    3410            0 :           str += "\n  .. (variadic)";
    3411              :         }
    3412              :     }
    3413              : 
    3414              :   // add type on new line)
    3415            0 :   str += "\n (return) Type: "
    3416            0 :          + (has_return_type () ? return_type->to_string () : "()");
    3417              : 
    3418              :   // where clause
    3419            0 :   str += "\n Where clause: ";
    3420            0 :   if (has_where_clause ())
    3421              :     {
    3422            0 :       str += where_clause.to_string ();
    3423              :     }
    3424              :   else
    3425              :     {
    3426            0 :       str += "none";
    3427              :     }
    3428              : 
    3429            0 :   return str;
    3430            0 : }
    3431              : 
    3432              : std::string
    3433            0 : ExternalTypeItem::to_string () const
    3434              : {
    3435            0 :   std::string str = ExternalItem::to_string ();
    3436              : 
    3437            0 :   str += "type ";
    3438              : 
    3439              :   // add name
    3440            0 :   str += get_item_name ().as_string ();
    3441              : 
    3442            0 :   return str;
    3443              : }
    3444              : 
    3445              : std::string
    3446            0 : NamedFunctionParam::to_string () const
    3447              : {
    3448            0 :   std::string str = name.as_string ();
    3449              : 
    3450            0 :   str += "\n Type: " + param_type->to_string ();
    3451              : 
    3452            0 :   return str;
    3453              : }
    3454              : 
    3455              : /*std::string TraitItem::to_string() const {
    3456              :     // outer attributes
    3457              :     std::string str = "outer attributes: ";
    3458              :     if (outer_attrs.empty()) {
    3459              :         str += "none";
    3460              :     } else {
    3461              :         // note that this does not print them with "outer attribute" syntax -
    3462              : just the body for (const auto& attr : outer_attrs) { str += "\n  " +
    3463              : attr.to_string();
    3464              :         }
    3465              :     }
    3466              : 
    3467              :     return str;
    3468              : }*/
    3469              : 
    3470              : std::string
    3471            0 : TraitItemFunc::to_string () const
    3472              : {
    3473            0 :   std::string str = "outer attributes: ";
    3474            0 :   if (outer_attrs.empty ())
    3475              :     {
    3476            0 :       str += "none";
    3477              :     }
    3478              :   else
    3479              :     {
    3480              :       /* note that this does not print them with "outer attribute" syntax -
    3481              :        * just the body */
    3482            0 :       for (const auto &attr : outer_attrs)
    3483              :         {
    3484            0 :           str += "\n  " + attr.as_string ();
    3485              :         }
    3486              :     }
    3487              : 
    3488            0 :   str += "\n" + decl.to_string ();
    3489              : 
    3490            0 :   str += "\n Definition (block expr): ";
    3491            0 :   if (has_definition ())
    3492              :     {
    3493            0 :       str += block_expr->to_string ();
    3494              :     }
    3495              :   else
    3496              :     {
    3497            0 :       str += "none";
    3498              :     }
    3499              : 
    3500            0 :   return str;
    3501              : }
    3502              : 
    3503              : std::string
    3504            0 : TraitFunctionDecl::to_string () const
    3505              : {
    3506            0 :   std::string str
    3507            0 :     = qualifiers.to_string () + "fn " + function_name.as_string ();
    3508              : 
    3509              :   // generic params
    3510            0 :   str += "\n Generic params: ";
    3511            0 :   if (generic_params.empty ())
    3512              :     {
    3513            0 :       str += "none";
    3514              :     }
    3515              :   else
    3516              :     {
    3517            0 :       for (const auto &param : generic_params)
    3518              :         {
    3519              :           // DEBUG: null pointer check
    3520            0 :           if (param == nullptr)
    3521              :             {
    3522            0 :               rust_debug (
    3523              :                 "something really terrible has gone wrong - null pointer "
    3524              :                 "generic param in trait function decl.");
    3525            0 :               return "nullptr_POINTER_MARK";
    3526              :             }
    3527              : 
    3528            0 :           str += "\n  " + param->to_string ();
    3529              :         }
    3530              :     }
    3531              : 
    3532            0 :   str += "\n Function params: ";
    3533            0 :   if (is_method ())
    3534              :     {
    3535            0 :       str += get_self_unchecked ().to_string () + (has_params () ? ", " : "");
    3536              :     }
    3537              : 
    3538            0 :   if (has_params ())
    3539              :     {
    3540            0 :       for (const auto &param : function_params)
    3541              :         {
    3542            0 :           str += "\n  " + param.to_string ();
    3543              :         }
    3544              :     }
    3545            0 :   else if (!is_method ())
    3546              :     {
    3547            0 :       str += "none";
    3548              :     }
    3549              : 
    3550            0 :   str += "\n Return type: ";
    3551            0 :   if (has_return_type ())
    3552              :     {
    3553            0 :       str += return_type->to_string ();
    3554              :     }
    3555              :   else
    3556              :     {
    3557            0 :       str += "none (void)";
    3558              :     }
    3559              : 
    3560            0 :   str += "\n Where clause: ";
    3561            0 :   if (has_where_clause ())
    3562              :     {
    3563            0 :       str += where_clause.to_string ();
    3564              :     }
    3565              :   else
    3566              :     {
    3567            0 :       str += "none";
    3568              :     }
    3569              : 
    3570            0 :   return str;
    3571            0 : }
    3572              : 
    3573              : std::string
    3574            0 : TraitItemConst::to_string () const
    3575              : {
    3576            0 :   std::string str = "outer attributes: ";
    3577            0 :   if (outer_attrs.empty ())
    3578              :     {
    3579            0 :       str += "none";
    3580              :     }
    3581              :   else
    3582              :     {
    3583              :       /* note that this does not print them with "outer attribute" syntax -
    3584              :        * just the body */
    3585            0 :       for (const auto &attr : outer_attrs)
    3586              :         {
    3587            0 :           str += "\n  " + attr.as_string ();
    3588              :         }
    3589              :     }
    3590              : 
    3591            0 :   str += "\nconst " + name.as_string () + " : " + type->to_string ();
    3592              : 
    3593            0 :   if (has_expression ())
    3594              :     {
    3595            0 :       str += " = " + expr->to_string ();
    3596              :     }
    3597              : 
    3598            0 :   return str;
    3599              : }
    3600              : 
    3601              : std::string
    3602            0 : TraitItemType::to_string () const
    3603              : {
    3604            0 :   std::string str = "outer attributes: ";
    3605            0 :   if (outer_attrs.empty ())
    3606              :     {
    3607            0 :       str += "none";
    3608              :     }
    3609              :   else
    3610              :     {
    3611              :       /* note that this does not print them with "outer attribute" syntax -
    3612              :        * just the body */
    3613            0 :       for (const auto &attr : outer_attrs)
    3614              :         {
    3615            0 :           str += "\n  " + attr.as_string ();
    3616              :         }
    3617              :     }
    3618              : 
    3619            0 :   str += "\ntype " + name.as_string ();
    3620              : 
    3621            0 :   if (has_generics ())
    3622              :     {
    3623            0 :       str += "<";
    3624            0 :       for (size_t i = 0; i < generic_params.size (); i++)
    3625              :         {
    3626            0 :           if (i > 0)
    3627            0 :             str += ", ";
    3628            0 :           str += generic_params[i]->to_string ();
    3629              :         }
    3630            0 :       str += ">";
    3631              :     }
    3632              : 
    3633            0 :   str += "\n Type param bounds: ";
    3634            0 :   if (!has_type_param_bounds ())
    3635              :     {
    3636            0 :       str += "none";
    3637              :     }
    3638              :   else
    3639              :     {
    3640            0 :       for (const auto &bound : type_param_bounds)
    3641              :         {
    3642              :           // DEBUG: null pointer check
    3643            0 :           if (bound == nullptr)
    3644              :             {
    3645            0 :               rust_debug (
    3646              :                 "something really terrible has gone wrong - null pointer "
    3647              :                 "type param bound in trait item type.");
    3648            0 :               return "nullptr_POINTER_MARK";
    3649              :             }
    3650              : 
    3651            0 :           str += "\n  " + bound->to_string ();
    3652              :         }
    3653              :     }
    3654              : 
    3655            0 :   return str;
    3656            0 : }
    3657              : 
    3658              : std::string
    3659            0 : SelfParam::to_string () const
    3660              : {
    3661            0 :   if (has_type ())
    3662              :     {
    3663              :       // type (i.e. not ref, no lifetime)
    3664            0 :       std::string str;
    3665              : 
    3666            0 :       if (is_mut ())
    3667              :         {
    3668            0 :           str += "mut ";
    3669              :         }
    3670              : 
    3671            0 :       str += "self : ";
    3672              : 
    3673            0 :       str += type->to_string ();
    3674              : 
    3675            0 :       return str;
    3676              :     }
    3677            0 :   else if (has_lifetime ())
    3678              :     {
    3679              :       // ref and lifetime
    3680            0 :       std::string str = "&" + get_lifetime ().to_string () + " ";
    3681              : 
    3682            0 :       if (is_mut ())
    3683              :         {
    3684            0 :           str += "mut ";
    3685              :         }
    3686              : 
    3687            0 :       str += "self";
    3688              : 
    3689            0 :       return str;
    3690            0 :     }
    3691            0 :   else if (is_ref ())
    3692              :     {
    3693              :       // ref with no lifetime
    3694            0 :       std::string str = "&";
    3695              : 
    3696            0 :       if (is_mut ())
    3697              :         {
    3698            0 :           str += " mut ";
    3699              :         }
    3700              : 
    3701            0 :       str += "self";
    3702              : 
    3703            0 :       return str;
    3704            0 :     }
    3705              :   else
    3706              :     {
    3707              :       // no ref, no type
    3708            0 :       std::string str;
    3709              : 
    3710            0 :       if (is_mut ())
    3711              :         {
    3712            0 :           str += "mut ";
    3713              :         }
    3714              : 
    3715            0 :       str += "self";
    3716              : 
    3717            0 :       return str;
    3718            0 :     }
    3719              : }
    3720              : 
    3721              : std::string
    3722            0 : ArrayElemsCopied::to_string () const
    3723              : {
    3724            0 :   return elem_to_copy->to_string () + "; " + num_copies->to_string ();
    3725              : }
    3726              : 
    3727              : std::string
    3728            0 : LifetimeWhereClauseItem::to_string () const
    3729              : {
    3730            0 :   std::string str ("Lifetime: ");
    3731              : 
    3732            0 :   str += lifetime.to_string ();
    3733              : 
    3734            0 :   str += "\nLifetime bounds: ";
    3735              : 
    3736            0 :   for (const auto &bound : lifetime_bounds)
    3737              :     {
    3738            0 :       str += "\n " + bound.to_string ();
    3739              :     }
    3740              : 
    3741            0 :   return str;
    3742              : }
    3743              : 
    3744              : std::string
    3745            0 : TypeBoundWhereClauseItem::to_string () const
    3746              : {
    3747            0 :   std::string str ("For lifetimes: ");
    3748              : 
    3749            0 :   if (!has_for_lifetimes ())
    3750              :     {
    3751            0 :       str += "none";
    3752              :     }
    3753              :   else
    3754              :     {
    3755            0 :       for (const auto &for_lifetime : for_lifetimes)
    3756              :         {
    3757            0 :           str += "\n " + for_lifetime.to_string ();
    3758              :         }
    3759              :     }
    3760              : 
    3761            0 :   str += "\nType: " + bound_type->to_string ();
    3762              : 
    3763            0 :   str += "\nType param bounds bounds: ";
    3764              : 
    3765            0 :   for (const auto &bound : type_param_bounds)
    3766              :     {
    3767              :       // debug null pointer check
    3768            0 :       if (bound == nullptr)
    3769              :         {
    3770            0 :           return "nullptr_POINTER_MARK - type param bounds";
    3771              :         }
    3772              : 
    3773            0 :       str += "\n " + bound->to_string ();
    3774              :     }
    3775              : 
    3776            0 :   return str;
    3777            0 : }
    3778              : 
    3779              : std::string
    3780            0 : ArrayElemsValues::to_string () const
    3781              : {
    3782            0 :   std::string str;
    3783              : 
    3784            0 :   for (const auto &expr : values)
    3785              :     {
    3786              :       // DEBUG: null pointer check
    3787            0 :       if (expr == nullptr)
    3788              :         {
    3789            0 :           rust_debug ("something really terrible has gone wrong - null pointer "
    3790              :                       "expr in array elems values.");
    3791            0 :           return "nullptr_POINTER_MARK";
    3792              :         }
    3793              : 
    3794            0 :       str += "\n  " + expr->to_string ();
    3795              :     }
    3796              : 
    3797            0 :   return str;
    3798            0 : }
    3799              : 
    3800              : std::string
    3801            0 : MaybeNamedParam::to_string () const
    3802              : {
    3803            0 :   std::string str;
    3804              : 
    3805            0 :   switch (param_kind)
    3806              :     {
    3807              :     case UNNAMED:
    3808              :       break;
    3809            0 :     case IDENTIFIER:
    3810            0 :       str = name.as_string () + " : ";
    3811            0 :       break;
    3812            0 :     case WILDCARD:
    3813            0 :       str = "_ : ";
    3814            0 :       break;
    3815            0 :     default:
    3816            0 :       return "ERROR_MARK_STRING - maybe named param unrecognised param kind";
    3817              :     }
    3818              : 
    3819            0 :   str += param_type->to_string ();
    3820              : 
    3821            0 :   return str;
    3822            0 : }
    3823              : 
    3824              : std::string
    3825            0 : enum_to_str (MaybeNamedParam::ParamKind pk)
    3826              : {
    3827            0 :   switch (pk)
    3828              :     {
    3829            0 :     case MaybeNamedParam::ParamKind::UNNAMED:
    3830            0 :       return "UNNAMED";
    3831            0 :     case MaybeNamedParam::ParamKind::IDENTIFIER:
    3832            0 :       return "IDENTIFIER";
    3833            0 :     case MaybeNamedParam::ParamKind::WILDCARD:
    3834            0 :       return "WILDCARD";
    3835              :     }
    3836            0 :   gcc_unreachable ();
    3837              : }
    3838              : 
    3839              : std::string
    3840            0 : enum_to_str (UseTreeRebind::NewBindType nbt)
    3841              : {
    3842            0 :   switch (nbt)
    3843              :     {
    3844            0 :     case UseTreeRebind::NewBindType::NONE:
    3845            0 :       return "NONE";
    3846            0 :     case UseTreeRebind::NewBindType::IDENTIFIER:
    3847            0 :       return "IDENTIFIER";
    3848            0 :     case UseTreeRebind::NewBindType::WILDCARD:
    3849            0 :       return "WILDCARD";
    3850              :     }
    3851            0 :   gcc_unreachable ();
    3852              : }
    3853              : 
    3854              : /* Override that calls the function recursively on all items contained within
    3855              :  * the module. */
    3856              : void
    3857            0 : Module::add_crate_name (std::vector<std::string> &names) const
    3858              : {
    3859              :   /* TODO: test whether module has been 'cfg'-ed out to determine whether to
    3860              :    * exclude it from search */
    3861              : 
    3862            0 :   for (const auto &item : items)
    3863            0 :     item->add_crate_name (names);
    3864            0 : }
    3865              : 
    3866              : /* All accept_vis method below */
    3867              : 
    3868              : void
    3869         5916 : Lifetime::accept_vis (HIRFullVisitor &vis)
    3870              : {
    3871         5916 :   vis.visit (*this);
    3872         5916 : }
    3873              : 
    3874              : void
    3875          160 : LifetimeParam::accept_vis (HIRFullVisitor &vis)
    3876              : {
    3877          160 :   vis.visit (*this);
    3878          160 : }
    3879              : 
    3880              : void
    3881       174520 : PathInExpression::accept_vis (HIRFullVisitor &vis)
    3882              : {
    3883       174520 :   vis.visit (*this);
    3884       174520 : }
    3885              : void
    3886       136341 : PathInExpression::accept_vis (HIRExpressionVisitor &vis)
    3887              : {
    3888       136341 :   vis.visit (*this);
    3889       136341 : }
    3890              : 
    3891              : void
    3892        46222 : TypePathSegment::accept_vis (HIRFullVisitor &vis)
    3893              : {
    3894        46222 :   vis.visit (*this);
    3895        46222 : }
    3896              : 
    3897              : void
    3898         2345 : TypePathSegmentGeneric::accept_vis (HIRFullVisitor &vis)
    3899              : {
    3900         2345 :   vis.visit (*this);
    3901         2345 : }
    3902              : 
    3903              : void
    3904           27 : TypePathSegmentFunction::accept_vis (HIRFullVisitor &vis)
    3905              : {
    3906           27 :   vis.visit (*this);
    3907           27 : }
    3908              : 
    3909              : void
    3910        50215 : TypePath::accept_vis (HIRFullVisitor &vis)
    3911              : {
    3912        50215 :   vis.visit (*this);
    3913        50215 : }
    3914              : 
    3915              : void
    3916          195 : QualifiedPathInExpression::accept_vis (HIRFullVisitor &vis)
    3917              : {
    3918          195 :   vis.visit (*this);
    3919          195 : }
    3920              : void
    3921          336 : QualifiedPathInExpression::accept_vis (HIRExpressionVisitor &vis)
    3922              : {
    3923          336 :   vis.visit (*this);
    3924          336 : }
    3925              : 
    3926              : void
    3927          199 : QualifiedPathInType::accept_vis (HIRFullVisitor &vis)
    3928              : {
    3929          199 :   vis.visit (*this);
    3930          199 : }
    3931              : 
    3932              : void
    3933        90500 : LiteralExpr::accept_vis (HIRFullVisitor &vis)
    3934              : {
    3935        90500 :   vis.visit (*this);
    3936        90500 : }
    3937              : 
    3938              : void
    3939        63086 : LiteralExpr::accept_vis (HIRExpressionVisitor &vis)
    3940              : {
    3941        63086 :   vis.visit (*this);
    3942        63086 : }
    3943              : 
    3944              : void
    3945         8958 : BorrowExpr::accept_vis (HIRFullVisitor &vis)
    3946              : {
    3947         8958 :   vis.visit (*this);
    3948         8958 : }
    3949              : 
    3950              : void
    3951           80 : InlineAsm::accept_vis (HIRExpressionVisitor &vis)
    3952              : {
    3953           80 :   vis.visit (*this);
    3954           80 : }
    3955              : 
    3956              : void
    3957          131 : InlineAsm::accept_vis (HIRFullVisitor &vis)
    3958              : {
    3959          131 :   vis.visit (*this);
    3960          131 : }
    3961              : 
    3962              : void
    3963           12 : LlvmInlineAsm::accept_vis (HIRFullVisitor &vis)
    3964              : {
    3965           12 :   vis.visit (*this);
    3966           12 : }
    3967              : void
    3968            6 : LlvmInlineAsm::accept_vis (HIRExpressionVisitor &vis)
    3969              : {
    3970            6 :   vis.visit (*this);
    3971            6 : }
    3972              : 
    3973              : void
    3974         5582 : BorrowExpr::accept_vis (HIRExpressionVisitor &vis)
    3975              : {
    3976         5582 :   vis.visit (*this);
    3977         5582 : }
    3978              : 
    3979              : void
    3980        15904 : DereferenceExpr::accept_vis (HIRFullVisitor &vis)
    3981              : {
    3982        15904 :   vis.visit (*this);
    3983        15904 : }
    3984              : 
    3985              : void
    3986        11441 : DereferenceExpr::accept_vis (HIRExpressionVisitor &vis)
    3987              : {
    3988        11441 :   vis.visit (*this);
    3989        11441 : }
    3990              : 
    3991              : void
    3992            0 : ErrorPropagationExpr::accept_vis (HIRFullVisitor &vis)
    3993              : {
    3994            0 :   vis.visit (*this);
    3995            0 : }
    3996              : 
    3997              : void
    3998            0 : ErrorPropagationExpr::accept_vis (HIRExpressionVisitor &vis)
    3999              : {
    4000            0 :   vis.visit (*this);
    4001            0 : }
    4002              : 
    4003              : void
    4004         2776 : NegationExpr::accept_vis (HIRFullVisitor &vis)
    4005              : {
    4006         2776 :   vis.visit (*this);
    4007         2776 : }
    4008              : 
    4009              : void
    4010         1982 : NegationExpr::accept_vis (HIRExpressionVisitor &vis)
    4011              : {
    4012         1982 :   vis.visit (*this);
    4013         1982 : }
    4014              : 
    4015              : void
    4016        15056 : ArithmeticOrLogicalExpr::accept_vis (HIRFullVisitor &vis)
    4017              : {
    4018        15056 :   vis.visit (*this);
    4019        15056 : }
    4020              : 
    4021              : void
    4022        10051 : ArithmeticOrLogicalExpr::accept_vis (HIRExpressionVisitor &vis)
    4023              : {
    4024        10051 :   vis.visit (*this);
    4025        10051 : }
    4026              : 
    4027              : void
    4028        17265 : ComparisonExpr::accept_vis (HIRFullVisitor &vis)
    4029              : {
    4030        17265 :   vis.visit (*this);
    4031        17265 : }
    4032              : 
    4033              : void
    4034        10305 : ComparisonExpr::accept_vis (HIRExpressionVisitor &vis)
    4035              : {
    4036        10305 :   vis.visit (*this);
    4037        10305 : }
    4038              : 
    4039              : void
    4040         2492 : LazyBooleanExpr::accept_vis (HIRFullVisitor &vis)
    4041              : {
    4042         2492 :   vis.visit (*this);
    4043         2492 : }
    4044              : 
    4045              : void
    4046         1161 : LazyBooleanExpr::accept_vis (HIRExpressionVisitor &vis)
    4047              : {
    4048         1161 :   vis.visit (*this);
    4049         1161 : }
    4050              : 
    4051              : void
    4052        28199 : TypeCastExpr::accept_vis (HIRFullVisitor &vis)
    4053              : {
    4054        28199 :   vis.visit (*this);
    4055        28199 : }
    4056              : 
    4057              : void
    4058        14679 : TypeCastExpr::accept_vis (HIRExpressionVisitor &vis)
    4059              : {
    4060        14679 :   vis.visit (*this);
    4061        14679 : }
    4062              : 
    4063              : void
    4064        12231 : AssignmentExpr::accept_vis (HIRFullVisitor &vis)
    4065              : {
    4066        12231 :   vis.visit (*this);
    4067        12231 : }
    4068              : 
    4069              : void
    4070         7298 : AssignmentExpr::accept_vis (HIRExpressionVisitor &vis)
    4071              : {
    4072         7298 :   vis.visit (*this);
    4073         7298 : }
    4074              : 
    4075              : void
    4076         3349 : CompoundAssignmentExpr::accept_vis (HIRFullVisitor &vis)
    4077              : {
    4078         3349 :   vis.visit (*this);
    4079         3349 : }
    4080              : 
    4081              : void
    4082         2081 : CompoundAssignmentExpr::accept_vis (HIRExpressionVisitor &vis)
    4083              : {
    4084         2081 :   vis.visit (*this);
    4085         2081 : }
    4086              : 
    4087              : void
    4088         1484 : GroupedExpr::accept_vis (HIRFullVisitor &vis)
    4089              : {
    4090         1484 :   vis.visit (*this);
    4091         1484 : }
    4092              : 
    4093              : void
    4094          956 : GroupedExpr::accept_vis (HIRExpressionVisitor &vis)
    4095              : {
    4096          956 :   vis.visit (*this);
    4097          956 : }
    4098              : 
    4099              : void
    4100         1185 : ArrayElemsValues::accept_vis (HIRFullVisitor &vis)
    4101              : {
    4102         1185 :   vis.visit (*this);
    4103         1185 : }
    4104              : 
    4105              : void
    4106          464 : ArrayElemsCopied::accept_vis (HIRFullVisitor &vis)
    4107              : {
    4108          464 :   vis.visit (*this);
    4109          464 : }
    4110              : 
    4111              : void
    4112         1649 : ArrayExpr::accept_vis (HIRFullVisitor &vis)
    4113              : {
    4114         1649 :   vis.visit (*this);
    4115         1649 : }
    4116              : 
    4117              : void
    4118         1368 : ArrayIndexExpr::accept_vis (HIRFullVisitor &vis)
    4119              : {
    4120         1368 :   vis.visit (*this);
    4121         1368 : }
    4122              : 
    4123              : void
    4124         2515 : TupleExpr::accept_vis (HIRFullVisitor &vis)
    4125              : {
    4126         2515 :   vis.visit (*this);
    4127         2515 : }
    4128              : 
    4129              : void
    4130         3760 : TupleIndexExpr::accept_vis (HIRFullVisitor &vis)
    4131              : {
    4132         3760 :   vis.visit (*this);
    4133         3760 : }
    4134              : 
    4135              : void
    4136          327 : StructExprStruct::accept_vis (HIRFullVisitor &vis)
    4137              : {
    4138          327 :   vis.visit (*this);
    4139          327 : }
    4140              : 
    4141              : void
    4142          168 : StructExprFieldIndexValue::accept_vis (HIRFullVisitor &vis)
    4143              : {
    4144          168 :   vis.visit (*this);
    4145          168 : }
    4146              : 
    4147              : void
    4148         5553 : StructExprStructFields::accept_vis (HIRFullVisitor &vis)
    4149              : {
    4150         5553 :   vis.visit (*this);
    4151         5553 : }
    4152              : 
    4153              : void
    4154            0 : StructExprStructBase::accept_vis (HIRFullVisitor &vis)
    4155              : {
    4156            0 :   vis.visit (*this);
    4157            0 : }
    4158              : 
    4159              : void
    4160            0 : StructExprStructBase::accept_vis (HIRExpressionVisitor &vis)
    4161              : {
    4162            0 :   vis.visit (*this);
    4163            0 : }
    4164              : 
    4165              : void
    4166        60462 : CallExpr::accept_vis (HIRFullVisitor &vis)
    4167              : {
    4168        60462 :   vis.visit (*this);
    4169        60462 : }
    4170              : 
    4171              : void
    4172        11938 : MethodCallExpr::accept_vis (HIRFullVisitor &vis)
    4173              : {
    4174        11938 :   vis.visit (*this);
    4175        11938 : }
    4176              : 
    4177              : void
    4178        23878 : FieldAccessExpr::accept_vis (HIRFullVisitor &vis)
    4179              : {
    4180        23878 :   vis.visit (*this);
    4181        23878 : }
    4182              : 
    4183              : void
    4184          232 : ClosureExpr::accept_vis (HIRFullVisitor &vis)
    4185              : {
    4186          232 :   vis.visit (*this);
    4187          232 : }
    4188              : 
    4189              : void
    4190       113431 : BlockExpr::accept_vis (HIRFullVisitor &vis)
    4191              : {
    4192       113431 :   vis.visit (*this);
    4193       113431 : }
    4194              : 
    4195              : void
    4196          891 : AnonConst::accept_vis (HIRFullVisitor &vis)
    4197              : {
    4198          891 :   vis.visit (*this);
    4199          891 : }
    4200              : 
    4201              : void
    4202           59 : ConstBlock::accept_vis (HIRFullVisitor &vis)
    4203              : {
    4204           59 :   vis.visit (*this);
    4205           59 : }
    4206              : 
    4207              : void
    4208          128 : ContinueExpr::accept_vis (HIRFullVisitor &vis)
    4209              : {
    4210          128 :   vis.visit (*this);
    4211          128 : }
    4212              : 
    4213              : void
    4214          490 : BreakExpr::accept_vis (HIRFullVisitor &vis)
    4215              : {
    4216          490 :   vis.visit (*this);
    4217          490 : }
    4218              : 
    4219              : void
    4220          257 : RangeFromToExpr::accept_vis (HIRFullVisitor &vis)
    4221              : {
    4222          257 :   vis.visit (*this);
    4223          257 : }
    4224              : 
    4225              : void
    4226           21 : RangeFromExpr::accept_vis (HIRFullVisitor &vis)
    4227              : {
    4228           21 :   vis.visit (*this);
    4229           21 : }
    4230              : 
    4231              : void
    4232           21 : RangeToExpr::accept_vis (HIRFullVisitor &vis)
    4233              : {
    4234           21 :   vis.visit (*this);
    4235           21 : }
    4236              : 
    4237              : void
    4238            0 : RangeFullExpr::accept_vis (HIRFullVisitor &vis)
    4239              : {
    4240            0 :   vis.visit (*this);
    4241            0 : }
    4242              : 
    4243              : void
    4244            0 : RangeToInclExpr::accept_vis (HIRFullVisitor &vis)
    4245              : {
    4246            0 :   vis.visit (*this);
    4247            0 : }
    4248              : 
    4249              : void
    4250            6 : BoxExpr::accept_vis (HIRFullVisitor &vis)
    4251              : {
    4252            6 :   vis.visit (*this);
    4253            6 : }
    4254              : 
    4255              : void
    4256         3210 : ReturnExpr::accept_vis (HIRFullVisitor &vis)
    4257              : {
    4258         3210 :   vis.visit (*this);
    4259         3210 : }
    4260              : 
    4261              : void
    4262        19533 : UnsafeBlockExpr::accept_vis (HIRFullVisitor &vis)
    4263              : {
    4264        19533 :   vis.visit (*this);
    4265        19533 : }
    4266              : 
    4267              : void
    4268          666 : LoopExpr::accept_vis (HIRFullVisitor &vis)
    4269              : {
    4270          666 :   vis.visit (*this);
    4271          666 : }
    4272              : 
    4273              : void
    4274          460 : WhileLoopExpr::accept_vis (HIRFullVisitor &vis)
    4275              : {
    4276          460 :   vis.visit (*this);
    4277          460 : }
    4278              : 
    4279              : void
    4280            0 : WhileLetLoopExpr::accept_vis (HIRFullVisitor &vis)
    4281              : {
    4282            0 :   vis.visit (*this);
    4283            0 : }
    4284              : 
    4285              : void
    4286         7601 : IfExpr::accept_vis (HIRFullVisitor &vis)
    4287              : {
    4288         7601 :   vis.visit (*this);
    4289         7601 : }
    4290              : 
    4291              : void
    4292         5809 : IfExprConseqElse::accept_vis (HIRFullVisitor &vis)
    4293              : {
    4294         5809 :   vis.visit (*this);
    4295         5809 : }
    4296              : 
    4297              : void
    4298         5545 : MatchExpr::accept_vis (HIRFullVisitor &vis)
    4299              : {
    4300         5545 :   vis.visit (*this);
    4301         5545 : }
    4302              : 
    4303              : void
    4304            0 : AwaitExpr::accept_vis (HIRFullVisitor &vis)
    4305              : {
    4306            0 :   vis.visit (*this);
    4307            0 : }
    4308              : 
    4309              : void
    4310            0 : AsyncBlockExpr::accept_vis (HIRFullVisitor &vis)
    4311              : {
    4312            0 :   vis.visit (*this);
    4313            0 : }
    4314              : 
    4315              : void
    4316         8191 : TypeParam::accept_vis (HIRFullVisitor &vis)
    4317              : {
    4318         8191 :   vis.visit (*this);
    4319         8191 : }
    4320              : 
    4321              : void
    4322            0 : LifetimeWhereClauseItem::accept_vis (HIRFullVisitor &vis)
    4323              : {
    4324            0 :   vis.visit (*this);
    4325            0 : }
    4326              : 
    4327              : void
    4328          139 : TypeBoundWhereClauseItem::accept_vis (HIRFullVisitor &vis)
    4329              : {
    4330          139 :   vis.visit (*this);
    4331          139 : }
    4332              : 
    4333              : void
    4334         7206 : Module::accept_vis (HIRFullVisitor &vis)
    4335              : {
    4336         7206 :   vis.visit (*this);
    4337         7206 : }
    4338              : 
    4339              : void
    4340         2336 : Module::accept_vis (HIRStmtVisitor &vis)
    4341              : {
    4342         2336 :   vis.visit (*this);
    4343         2336 : }
    4344              : 
    4345              : void
    4346         4716 : Module::accept_vis (HIRVisItemVisitor &vis)
    4347              : {
    4348         4716 :   vis.visit (*this);
    4349         4716 : }
    4350              : 
    4351              : void
    4352            0 : ExternCrate::accept_vis (HIRFullVisitor &vis)
    4353              : {
    4354            0 :   vis.visit (*this);
    4355            0 : }
    4356              : 
    4357              : void
    4358            0 : UseTreeGlob::accept_vis (HIRFullVisitor &vis)
    4359              : {
    4360            0 :   vis.visit (*this);
    4361            0 : }
    4362              : 
    4363              : void
    4364            0 : UseTreeList::accept_vis (HIRFullVisitor &vis)
    4365              : {
    4366            0 :   vis.visit (*this);
    4367            0 : }
    4368              : 
    4369              : void
    4370            0 : UseTreeRebind::accept_vis (HIRFullVisitor &vis)
    4371              : {
    4372            0 :   vis.visit (*this);
    4373            0 : }
    4374              : 
    4375              : void
    4376            0 : UseDeclaration::accept_vis (HIRFullVisitor &vis)
    4377              : {
    4378            0 :   vis.visit (*this);
    4379            0 : }
    4380              : 
    4381              : void
    4382        83949 : Function::accept_vis (HIRFullVisitor &vis)
    4383              : {
    4384        83949 :   vis.visit (*this);
    4385        83944 : }
    4386              : 
    4387              : void
    4388         6249 : TypeAlias::accept_vis (HIRFullVisitor &vis)
    4389              : {
    4390         6249 :   vis.visit (*this);
    4391         6249 : }
    4392              : 
    4393              : void
    4394        11389 : StructStruct::accept_vis (HIRFullVisitor &vis)
    4395              : {
    4396        11389 :   vis.visit (*this);
    4397        11389 : }
    4398              : 
    4399              : void
    4400         7404 : TupleStruct::accept_vis (HIRFullVisitor &vis)
    4401              : {
    4402         7404 :   vis.visit (*this);
    4403         7404 : }
    4404              : 
    4405              : void
    4406         1585 : EnumItem::accept_vis (HIRFullVisitor &vis)
    4407              : {
    4408         1585 :   vis.visit (*this);
    4409         1585 : }
    4410              : 
    4411              : void
    4412          784 : EnumItemTuple::accept_vis (HIRFullVisitor &vis)
    4413              : {
    4414          784 :   vis.visit (*this);
    4415          784 : }
    4416              : 
    4417              : void
    4418          158 : EnumItemStruct::accept_vis (HIRFullVisitor &vis)
    4419              : {
    4420          158 :   vis.visit (*this);
    4421          158 : }
    4422              : 
    4423              : void
    4424          547 : EnumItemDiscriminant::accept_vis (HIRFullVisitor &vis)
    4425              : {
    4426          547 :   vis.visit (*this);
    4427          547 : }
    4428              : 
    4429              : void
    4430         3376 : Enum::accept_vis (HIRFullVisitor &vis)
    4431              : {
    4432         3376 :   vis.visit (*this);
    4433         3376 : }
    4434              : 
    4435              : void
    4436          738 : Union::accept_vis (HIRFullVisitor &vis)
    4437              : {
    4438          738 :   vis.visit (*this);
    4439          738 : }
    4440              : 
    4441              : void
    4442         3764 : ConstantItem::accept_vis (HIRFullVisitor &vis)
    4443              : {
    4444         3764 :   vis.visit (*this);
    4445         3764 : }
    4446              : 
    4447              : void
    4448          358 : StaticItem::accept_vis (HIRFullVisitor &vis)
    4449              : {
    4450          358 :   vis.visit (*this);
    4451          358 : }
    4452              : 
    4453              : void
    4454        10066 : TraitItemFunc::accept_vis (HIRFullVisitor &vis)
    4455              : {
    4456        10066 :   vis.visit (*this);
    4457        10066 : }
    4458              : 
    4459              : void
    4460          123 : TraitItemConst::accept_vis (HIRFullVisitor &vis)
    4461              : {
    4462          123 :   vis.visit (*this);
    4463          123 : }
    4464              : 
    4465              : void
    4466         2843 : TraitItemType::accept_vis (HIRFullVisitor &vis)
    4467              : {
    4468         2843 :   vis.visit (*this);
    4469         2843 : }
    4470              : 
    4471              : void
    4472        22263 : Trait::accept_vis (HIRFullVisitor &vis)
    4473              : {
    4474        22263 :   vis.visit (*this);
    4475        22263 : }
    4476              : 
    4477              : void
    4478        31744 : ImplBlock::accept_vis (HIRFullVisitor &vis)
    4479              : {
    4480        31744 :   vis.visit (*this);
    4481        31744 : }
    4482              : 
    4483              : void
    4484            3 : ExternalStaticItem::accept_vis (HIRFullVisitor &vis)
    4485              : {
    4486            3 :   vis.visit (*this);
    4487            3 : }
    4488              : 
    4489              : void
    4490        10147 : ExternalFunctionItem::accept_vis (HIRFullVisitor &vis)
    4491              : {
    4492        10147 :   vis.visit (*this);
    4493        10147 : }
    4494              : 
    4495              : void
    4496            0 : ExternalTypeItem::accept_vis (HIRFullVisitor &vis)
    4497              : {
    4498            0 :   vis.visit (*this);
    4499            0 : }
    4500              : 
    4501              : void
    4502         9901 : ExternBlock::accept_vis (HIRFullVisitor &vis)
    4503              : {
    4504         9901 :   vis.visit (*this);
    4505         9901 : }
    4506              : 
    4507              : void
    4508          405 : LiteralPattern::accept_vis (HIRFullVisitor &vis)
    4509              : {
    4510          405 :   vis.visit (*this);
    4511          405 : }
    4512              : 
    4513              : void
    4514         8436 : IdentifierPattern::accept_vis (HIRFullVisitor &vis)
    4515              : {
    4516         8436 :   vis.visit (*this);
    4517         8436 : }
    4518              : 
    4519              : void
    4520          755 : WildcardPattern::accept_vis (HIRFullVisitor &vis)
    4521              : {
    4522          755 :   vis.visit (*this);
    4523          755 : }
    4524              : 
    4525              : void
    4526           77 : RangePatternBoundLiteral::accept_vis (HIRFullVisitor &vis)
    4527              : {
    4528           77 :   vis.visit (*this);
    4529           77 : }
    4530              : 
    4531              : void
    4532           21 : RangePatternBoundPath::accept_vis (HIRFullVisitor &vis)
    4533              : {
    4534           21 :   vis.visit (*this);
    4535           21 : }
    4536              : 
    4537              : void
    4538            0 : RangePatternBoundQualPath::accept_vis (HIRFullVisitor &vis)
    4539              : {
    4540            0 :   vis.visit (*this);
    4541            0 : }
    4542              : 
    4543              : void
    4544           49 : RangePattern::accept_vis (HIRFullVisitor &vis)
    4545              : {
    4546           49 :   vis.visit (*this);
    4547           49 : }
    4548              : 
    4549              : void
    4550          175 : ReferencePattern::accept_vis (HIRFullVisitor &vis)
    4551              : {
    4552          175 :   vis.visit (*this);
    4553          175 : }
    4554              : 
    4555              : void
    4556           18 : StructPatternFieldTuplePat::accept_vis (HIRFullVisitor &vis)
    4557              : {
    4558           18 :   vis.visit (*this);
    4559           18 : }
    4560              : 
    4561              : void
    4562          120 : StructPatternFieldIdentPat::accept_vis (HIRFullVisitor &vis)
    4563              : {
    4564          120 :   vis.visit (*this);
    4565          120 : }
    4566              : 
    4567              : void
    4568           95 : StructPatternFieldIdent::accept_vis (HIRFullVisitor &vis)
    4569              : {
    4570           95 :   vis.visit (*this);
    4571           95 : }
    4572              : 
    4573              : void
    4574          137 : StructPattern::accept_vis (HIRFullVisitor &vis)
    4575              : {
    4576          137 :   vis.visit (*this);
    4577          137 : }
    4578              : 
    4579              : void
    4580          881 : TupleStructItemsNoRest::accept_vis (HIRFullVisitor &vis)
    4581              : {
    4582          881 :   vis.visit (*this);
    4583          881 : }
    4584              : 
    4585              : void
    4586           36 : TupleStructItemsHasRest::accept_vis (HIRFullVisitor &vis)
    4587              : {
    4588           36 :   vis.visit (*this);
    4589           36 : }
    4590              : 
    4591              : void
    4592          917 : TupleStructPattern::accept_vis (HIRFullVisitor &vis)
    4593              : {
    4594          917 :   vis.visit (*this);
    4595          917 : }
    4596              : 
    4597              : void
    4598          109 : TuplePatternItemsNoRest::accept_vis (HIRFullVisitor &vis)
    4599              : {
    4600          109 :   vis.visit (*this);
    4601          109 : }
    4602              : 
    4603              : void
    4604           26 : TuplePatternItemsHasRest::accept_vis (HIRFullVisitor &vis)
    4605              : {
    4606           26 :   vis.visit (*this);
    4607           26 : }
    4608              : 
    4609              : void
    4610          135 : TuplePattern::accept_vis (HIRFullVisitor &vis)
    4611              : {
    4612          135 :   vis.visit (*this);
    4613          135 : }
    4614              : 
    4615              : void
    4616           31 : SlicePatternItemsNoRest::accept_vis (HIRFullVisitor &vis)
    4617              : {
    4618           31 :   vis.visit (*this);
    4619           31 : }
    4620              : 
    4621              : void
    4622           44 : SlicePatternItemsHasRest::accept_vis (HIRFullVisitor &vis)
    4623              : {
    4624           44 :   vis.visit (*this);
    4625           44 : }
    4626              : 
    4627              : void
    4628           75 : SlicePattern::accept_vis (HIRFullVisitor &vis)
    4629              : {
    4630           75 :   vis.visit (*this);
    4631           75 : }
    4632              : 
    4633              : void
    4634          145 : AltPattern::accept_vis (HIRFullVisitor &vis)
    4635              : {
    4636          145 :   vis.visit (*this);
    4637          145 : }
    4638              : 
    4639              : void
    4640          226 : EmptyStmt::accept_vis (HIRFullVisitor &vis)
    4641              : {
    4642          226 :   vis.visit (*this);
    4643          226 : }
    4644              : 
    4645              : void
    4646        66795 : LetStmt::accept_vis (HIRFullVisitor &vis)
    4647              : {
    4648        66795 :   vis.visit (*this);
    4649        66795 : }
    4650              : 
    4651              : void
    4652        57832 : ExprStmt::accept_vis (HIRFullVisitor &vis)
    4653              : {
    4654        57832 :   vis.visit (*this);
    4655        57832 : }
    4656              : 
    4657              : void
    4658         1690 : TraitBound::accept_vis (HIRFullVisitor &vis)
    4659              : {
    4660         1690 :   vis.visit (*this);
    4661         1690 : }
    4662              : 
    4663              : void
    4664           28 : ImplTraitType::accept_vis (HIRFullVisitor &vis)
    4665              : {
    4666           28 :   vis.visit (*this);
    4667           28 : }
    4668              : 
    4669              : void
    4670           94 : TraitObjectType::accept_vis (HIRFullVisitor &vis)
    4671              : {
    4672           94 :   vis.visit (*this);
    4673           94 : }
    4674              : 
    4675              : void
    4676            5 : ParenthesisedType::accept_vis (HIRFullVisitor &vis)
    4677              : {
    4678            5 :   vis.visit (*this);
    4679            5 : }
    4680              : 
    4681              : void
    4682          360 : TupleType::accept_vis (HIRFullVisitor &vis)
    4683              : {
    4684          360 :   vis.visit (*this);
    4685          360 : }
    4686              : 
    4687              : void
    4688          185 : NeverType::accept_vis (HIRFullVisitor &vis)
    4689              : {
    4690          185 :   vis.visit (*this);
    4691          185 : }
    4692              : 
    4693              : void
    4694         4426 : RawPointerType::accept_vis (HIRFullVisitor &vis)
    4695              : {
    4696         4426 :   vis.visit (*this);
    4697         4426 : }
    4698              : 
    4699              : void
    4700         5921 : ReferenceType::accept_vis (HIRFullVisitor &vis)
    4701              : {
    4702         5921 :   vis.visit (*this);
    4703         5921 : }
    4704              : 
    4705              : void
    4706          839 : ArrayType::accept_vis (HIRFullVisitor &vis)
    4707              : {
    4708          839 :   vis.visit (*this);
    4709          839 : }
    4710              : 
    4711              : void
    4712          849 : SliceType::accept_vis (HIRFullVisitor &vis)
    4713              : {
    4714          849 :   vis.visit (*this);
    4715          849 : }
    4716              : 
    4717              : void
    4718           14 : InferredType::accept_vis (HIRFullVisitor &vis)
    4719              : {
    4720           14 :   vis.visit (*this);
    4721           14 : }
    4722              : 
    4723              : void
    4724           41 : BareFunctionType::accept_vis (HIRFullVisitor &vis)
    4725              : {
    4726           41 :   vis.visit (*this);
    4727           41 : }
    4728              : 
    4729              : void
    4730          188 : NeverType::accept_vis (HIRTypeVisitor &vis)
    4731              : {
    4732          188 :   vis.visit (*this);
    4733          188 : }
    4734              : 
    4735              : void
    4736            5 : ParenthesisedType::accept_vis (HIRTypeVisitor &vis)
    4737              : {
    4738            5 :   vis.visit (*this);
    4739            5 : }
    4740              : 
    4741              : void
    4742          136 : EmptyStmt::accept_vis (HIRStmtVisitor &vis)
    4743              : {
    4744          136 :   vis.visit (*this);
    4745          136 : }
    4746              : 
    4747              : void
    4748         2829 : WildcardPattern::accept_vis (HIRPatternVisitor &vis)
    4749              : {
    4750         2829 :   vis.visit (*this);
    4751         2829 : }
    4752              : 
    4753              : void
    4754          739 : TraitItemType::accept_vis (HIRTraitItemVisitor &vis)
    4755              : {
    4756          739 :   vis.visit (*this);
    4757          739 : }
    4758              : 
    4759              : void
    4760           39 : TraitItemConst::accept_vis (HIRTraitItemVisitor &vis)
    4761              : {
    4762           39 :   vis.visit (*this);
    4763           39 : }
    4764              : 
    4765              : void
    4766         2843 : TraitItemFunc::accept_vis (HIRTraitItemVisitor &vis)
    4767              : {
    4768         2843 :   vis.visit (*this);
    4769         2843 : }
    4770              : 
    4771              : void
    4772         5111 : ExternalFunctionItem::accept_vis (HIRExternalItemVisitor &vis)
    4773              : {
    4774         5111 :   vis.visit (*this);
    4775         5111 : }
    4776              : 
    4777              : void
    4778            0 : ExternalTypeItem::accept_vis (HIRExternalItemVisitor &vis)
    4779              : {
    4780            0 :   vis.visit (*this);
    4781            0 : }
    4782              : 
    4783              : void
    4784            1 : ExternalStaticItem::accept_vis (HIRExternalItemVisitor &vis)
    4785              : {
    4786            1 :   vis.visit (*this);
    4787            1 : }
    4788              : 
    4789              : void
    4790            0 : EnumItemDiscriminant::accept_vis (HIRStmtVisitor &vis)
    4791              : {
    4792            0 :   vis.visit (*this);
    4793            0 : }
    4794              : 
    4795              : void
    4796            0 : EnumItemStruct::accept_vis (HIRStmtVisitor &vis)
    4797              : {
    4798            0 :   vis.visit (*this);
    4799            0 : }
    4800              : 
    4801              : void
    4802            0 : EnumItemTuple::accept_vis (HIRStmtVisitor &vis)
    4803              : {
    4804            0 :   vis.visit (*this);
    4805            0 : }
    4806              : 
    4807              : void
    4808            0 : EnumItem::accept_vis (HIRStmtVisitor &vis)
    4809              : {
    4810            0 :   vis.visit (*this);
    4811            0 : }
    4812              : 
    4813              : void
    4814         4020 : StructExprStructFields::accept_vis (HIRExpressionVisitor &vis)
    4815              : {
    4816         4020 :   vis.visit (*this);
    4817         4020 : }
    4818              : 
    4819              : void
    4820           42 : StructExprFieldIndexValue::accept_vis (HIRExpressionVisitor &vis)
    4821              : {
    4822           42 :   vis.visit (*this);
    4823           42 : }
    4824              : 
    4825              : void
    4826        10926 : StructExprFieldIdentifierValue::accept_vis (HIRFullVisitor &vis)
    4827              : {
    4828        10926 :   vis.visit (*this);
    4829        10926 : }
    4830              : 
    4831              : void
    4832         2655 : StructExprFieldIdentifierValue::accept_vis (HIRExpressionVisitor &vis)
    4833              : {
    4834         2655 :   vis.visit (*this);
    4835         2655 : }
    4836              : 
    4837              : void
    4838          901 : StructExprFieldIdentifier::accept_vis (HIRFullVisitor &vis)
    4839              : {
    4840          901 :   vis.visit (*this);
    4841          901 : }
    4842              : 
    4843              : void
    4844          229 : StructExprFieldIdentifier::accept_vis (HIRExpressionVisitor &vis)
    4845              : {
    4846          229 :   vis.visit (*this);
    4847          229 : }
    4848              : 
    4849              : void
    4850          239 : StructExprStruct::accept_vis (HIRExpressionVisitor &vis)
    4851              : {
    4852          239 :   vis.visit (*this);
    4853          239 : }
    4854              : 
    4855              : void
    4856          420 : TupleType::accept_vis (HIRTypeVisitor &vis)
    4857              : {
    4858          420 :   vis.visit (*this);
    4859          420 : }
    4860              : 
    4861              : void
    4862          878 : SliceType::accept_vis (HIRTypeVisitor &vis)
    4863              : {
    4864          878 :   vis.visit (*this);
    4865          878 : }
    4866              : 
    4867              : void
    4868          682 : ArrayType::accept_vis (HIRTypeVisitor &vis)
    4869              : {
    4870          682 :   vis.visit (*this);
    4871          682 : }
    4872              : 
    4873              : void
    4874           63 : BareFunctionType::accept_vis (HIRTypeVisitor &vis)
    4875              : {
    4876           63 :   vis.visit (*this);
    4877           63 : }
    4878              : 
    4879              : void
    4880          216 : TraitObjectType::accept_vis (HIRTypeVisitor &vis)
    4881              : {
    4882          216 :   vis.visit (*this);
    4883          216 : }
    4884              : 
    4885              : void
    4886         6769 : RawPointerType::accept_vis (HIRTypeVisitor &vis)
    4887              : {
    4888         6769 :   vis.visit (*this);
    4889         6769 : }
    4890              : 
    4891              : void
    4892         4432 : ReferenceType::accept_vis (HIRTypeVisitor &vis)
    4893              : {
    4894         4432 :   vis.visit (*this);
    4895         4432 : }
    4896              : 
    4897              : void
    4898           29 : ImplTraitType::accept_vis (HIRTypeVisitor &vis)
    4899              : {
    4900           29 :   vis.visit (*this);
    4901           29 : }
    4902              : 
    4903              : void
    4904          211 : InferredType::accept_vis (HIRTypeVisitor &vis)
    4905              : {
    4906          211 :   vis.visit (*this);
    4907          211 : }
    4908              : 
    4909              : void
    4910        37452 : LetStmt::accept_vis (HIRStmtVisitor &vis)
    4911              : {
    4912        37452 :   vis.visit (*this);
    4913        37452 : }
    4914              : 
    4915              : void
    4916         2511 : TupleStructPattern::accept_vis (HIRPatternVisitor &vis)
    4917              : {
    4918         2511 :   vis.visit (*this);
    4919         2509 : }
    4920              : 
    4921              : void
    4922        75100 : IdentifierPattern::accept_vis (HIRPatternVisitor &vis)
    4923              : {
    4924        75100 :   vis.visit (*this);
    4925        75100 : }
    4926              : 
    4927              : void
    4928          581 : ReferencePattern::accept_vis (HIRPatternVisitor &vis)
    4929              : {
    4930          581 :   vis.visit (*this);
    4931          581 : }
    4932              : 
    4933              : void
    4934         1253 : LiteralPattern::accept_vis (HIRPatternVisitor &vis)
    4935              : {
    4936         1253 :   vis.visit (*this);
    4937         1253 : }
    4938              : 
    4939              : void
    4940          459 : StructPattern::accept_vis (HIRPatternVisitor &vis)
    4941              : {
    4942          459 :   vis.visit (*this);
    4943          459 : }
    4944              : 
    4945              : void
    4946         1339 : TuplePattern::accept_vis (HIRPatternVisitor &vis)
    4947              : {
    4948         1339 :   vis.visit (*this);
    4949         1339 : }
    4950              : 
    4951              : void
    4952          234 : SlicePattern::accept_vis (HIRPatternVisitor &vis)
    4953              : {
    4954          234 :   vis.visit (*this);
    4955          234 : }
    4956              : 
    4957              : void
    4958          235 : AltPattern::accept_vis (HIRPatternVisitor &vis)
    4959              : {
    4960          235 :   vis.visit (*this);
    4961          235 : }
    4962              : 
    4963              : void
    4964          134 : RangePattern::accept_vis (HIRPatternVisitor &vis)
    4965              : {
    4966          134 :   vis.visit (*this);
    4967          134 : }
    4968              : 
    4969              : void
    4970        48048 : TypePath::accept_vis (HIRTypeVisitor &vis)
    4971              : {
    4972        48048 :   vis.visit (*this);
    4973        48048 : }
    4974              : 
    4975              : void
    4976          242 : QualifiedPathInType::accept_vis (HIRTypeVisitor &vis)
    4977              : {
    4978          242 :   vis.visit (*this);
    4979          242 : }
    4980              : 
    4981              : void
    4982        32207 : ExprStmt::accept_vis (HIRStmtVisitor &vis)
    4983              : {
    4984        32207 :   vis.visit (*this);
    4985        32207 : }
    4986              : 
    4987              : void
    4988         1649 : TupleExpr::accept_vis (HIRExpressionVisitor &vis)
    4989              : {
    4990         1649 :   vis.visit (*this);
    4991         1649 : }
    4992              : 
    4993              : void
    4994         2698 : MatchExpr::accept_vis (HIRExpressionVisitor &vis)
    4995              : {
    4996         2698 :   vis.visit (*this);
    4997         2698 : }
    4998              : 
    4999              : void
    5000          268 : BreakExpr::accept_vis (HIRExpressionVisitor &vis)
    5001              : {
    5002          268 :   vis.visit (*this);
    5003          268 : }
    5004              : 
    5005              : void
    5006            0 : AwaitExpr::accept_vis (HIRExpressionVisitor &vis)
    5007              : {
    5008            0 :   vis.visit (*this);
    5009            0 : }
    5010              : 
    5011              : void
    5012         1231 : ArrayExpr::accept_vis (HIRExpressionVisitor &vis)
    5013              : {
    5014         1231 :   vis.visit (*this);
    5015         1231 : }
    5016              : 
    5017              : void
    5018          393 : LoopExpr::accept_vis (HIRExpressionVisitor &vis)
    5019              : {
    5020          393 :   vis.visit (*this);
    5021          393 : }
    5022              : 
    5023              : void
    5024            0 : WhileLetLoopExpr::accept_vis (HIRExpressionVisitor &vis)
    5025              : {
    5026            0 :   vis.visit (*this);
    5027            0 : }
    5028              : 
    5029              : void
    5030          250 : WhileLoopExpr::accept_vis (HIRExpressionVisitor &vis)
    5031              : {
    5032          250 :   vis.visit (*this);
    5033          250 : }
    5034              : 
    5035              : void
    5036        36314 : CallExpr::accept_vis (HIRExpressionVisitor &vis)
    5037              : {
    5038        36314 :   vis.visit (*this);
    5039        36314 : }
    5040              : 
    5041              : void
    5042         4648 : IfExprConseqElse::accept_vis (HIRExpressionVisitor &vis)
    5043              : {
    5044         4648 :   vis.visit (*this);
    5045         4648 : }
    5046              : 
    5047              : void
    5048         4987 : IfExpr::accept_vis (HIRExpressionVisitor &vis)
    5049              : {
    5050         4987 :   vis.visit (*this);
    5051         4987 : }
    5052              : 
    5053              : void
    5054          186 : ClosureExpr::accept_vis (HIRExpressionVisitor &vis)
    5055              : {
    5056          186 :   vis.visit (*this);
    5057          186 : }
    5058              : 
    5059              : void
    5060        10369 : UnsafeBlockExpr::accept_vis (HIRExpressionVisitor &vis)
    5061              : {
    5062        10369 :   vis.visit (*this);
    5063        10369 : }
    5064              : 
    5065              : void
    5066            0 : RangeToInclExpr::accept_vis (HIRExpressionVisitor &vis)
    5067              : {
    5068            0 :   vis.visit (*this);
    5069            0 : }
    5070              : 
    5071              : void
    5072          198 : RangeFromToExpr::accept_vis (HIRExpressionVisitor &vis)
    5073              : {
    5074          198 :   vis.visit (*this);
    5075          198 : }
    5076              : 
    5077              : void
    5078        16181 : FieldAccessExpr::accept_vis (HIRExpressionVisitor &vis)
    5079              : {
    5080        16181 :   vis.visit (*this);
    5081        16181 : }
    5082              : 
    5083              : void
    5084         2670 : TupleIndexExpr::accept_vis (HIRExpressionVisitor &vis)
    5085              : {
    5086         2670 :   vis.visit (*this);
    5087         2670 : }
    5088              : 
    5089              : void
    5090         8120 : MethodCallExpr::accept_vis (HIRExpressionVisitor &vis)
    5091              : {
    5092         8120 :   vis.visit (*this);
    5093         8120 : }
    5094              : 
    5095              : void
    5096            0 : AsyncBlockExpr::accept_vis (HIRExpressionVisitor &vis)
    5097              : {
    5098            0 :   vis.visit (*this);
    5099            0 : }
    5100              : 
    5101              : void
    5102          865 : ArrayIndexExpr::accept_vis (HIRExpressionVisitor &vis)
    5103              : {
    5104          865 :   vis.visit (*this);
    5105          865 : }
    5106              : 
    5107              : void
    5108            0 : RangeFullExpr::accept_vis (HIRExpressionVisitor &vis)
    5109              : {
    5110            0 :   vis.visit (*this);
    5111            0 : }
    5112              : 
    5113              : void
    5114           21 : RangeFromExpr::accept_vis (HIRExpressionVisitor &vis)
    5115              : {
    5116           21 :   vis.visit (*this);
    5117           21 : }
    5118              : 
    5119              : void
    5120           69 : ContinueExpr::accept_vis (HIRExpressionVisitor &vis)
    5121              : {
    5122           69 :   vis.visit (*this);
    5123           69 : }
    5124              : 
    5125              : void
    5126           21 : RangeToExpr::accept_vis (HIRExpressionVisitor &vis)
    5127              : {
    5128           21 :   vis.visit (*this);
    5129           21 : }
    5130              : 
    5131              : void
    5132            5 : BoxExpr::accept_vis (HIRExpressionVisitor &vis)
    5133              : {
    5134            5 :   vis.visit (*this);
    5135            5 : }
    5136              : 
    5137              : void
    5138         1495 : ReturnExpr::accept_vis (HIRExpressionVisitor &vis)
    5139              : {
    5140         1495 :   vis.visit (*this);
    5141         1495 : }
    5142              : 
    5143              : void
    5144            0 : QualifiedPathInExpression::accept_vis (HIRPatternVisitor &vis)
    5145              : {
    5146            0 :   vis.visit (*this);
    5147            0 : }
    5148              : 
    5149              : void
    5150         2636 : PathInExpression::accept_vis (HIRPatternVisitor &vis)
    5151              : {
    5152         2636 :   vis.visit (*this);
    5153         2636 : }
    5154              : 
    5155              : void
    5156         3334 : ExternBlock::accept_vis (HIRStmtVisitor &vis)
    5157              : {
    5158         3334 :   vis.visit (*this);
    5159         3334 : }
    5160              : 
    5161              : void
    5162         6597 : ExternBlock::accept_vis (HIRVisItemVisitor &vis)
    5163              : {
    5164         6597 :   vis.visit (*this);
    5165         6597 : }
    5166              : 
    5167              : void
    5168         2472 : TypeAlias::accept_vis (HIRStmtVisitor &vis)
    5169              : {
    5170         2472 :   vis.visit (*this);
    5171         2472 : }
    5172              : 
    5173              : void
    5174         1423 : TypeAlias::accept_vis (HIRVisItemVisitor &vis)
    5175              : {
    5176         1423 :   vis.visit (*this);
    5177         1423 : }
    5178              : 
    5179              : void
    5180         4348 : TypeAlias::accept_vis (HIRImplVisitor &vis)
    5181              : {
    5182         4348 :   vis.visit (*this);
    5183         4348 : }
    5184              : 
    5185              : void
    5186        49954 : BlockExpr::accept_vis (HIRExpressionVisitor &vis)
    5187              : {
    5188        49954 :   vis.visit (*this);
    5189        49954 : }
    5190              : 
    5191              : void
    5192         1370 : AnonConst::accept_vis (HIRExpressionVisitor &vis)
    5193              : {
    5194         1370 :   vis.visit (*this);
    5195         1370 : }
    5196              : 
    5197              : void
    5198           45 : ConstBlock::accept_vis (HIRExpressionVisitor &vis)
    5199              : {
    5200           45 :   vis.visit (*this);
    5201           45 : }
    5202              : 
    5203              : void
    5204        32122 : Function::accept_vis (HIRStmtVisitor &vis)
    5205              : {
    5206        32122 :   vis.visit (*this);
    5207        32120 : }
    5208              : 
    5209              : void
    5210        32811 : Function::accept_vis (HIRVisItemVisitor &vis)
    5211              : {
    5212        32811 :   vis.visit (*this);
    5213        32811 : }
    5214              : 
    5215              : void
    5216        18892 : Function::accept_vis (HIRImplVisitor &vis)
    5217              : {
    5218        18892 :   vis.visit (*this);
    5219        18892 : }
    5220              : 
    5221              : void
    5222          203 : Union::accept_vis (HIRStmtVisitor &vis)
    5223              : {
    5224          203 :   vis.visit (*this);
    5225          203 : }
    5226              : 
    5227              : void
    5228          411 : Union::accept_vis (HIRVisItemVisitor &vis)
    5229              : {
    5230          411 :   vis.visit (*this);
    5231          411 : }
    5232              : 
    5233              : void
    5234         7563 : Trait::accept_vis (HIRStmtVisitor &vis)
    5235              : {
    5236         7563 :   vis.visit (*this);
    5237         7563 : }
    5238              : 
    5239              : void
    5240        15655 : Trait::accept_vis (HIRVisItemVisitor &vis)
    5241              : {
    5242        15655 :   vis.visit (*this);
    5243        15655 : }
    5244              : 
    5245              : void
    5246          999 : Enum::accept_vis (HIRStmtVisitor &vis)
    5247              : {
    5248          999 :   vis.visit (*this);
    5249          999 : }
    5250              : 
    5251              : void
    5252         2010 : Enum::accept_vis (HIRVisItemVisitor &vis)
    5253              : {
    5254         2010 :   vis.visit (*this);
    5255         2010 : }
    5256              : 
    5257              : void
    5258            0 : UseDeclaration::accept_vis (HIRStmtVisitor &vis)
    5259              : {
    5260            0 :   vis.visit (*this);
    5261            0 : }
    5262              : 
    5263              : void
    5264            0 : UseDeclaration::accept_vis (HIRVisItemVisitor &vis)
    5265              : {
    5266            0 :   vis.visit (*this);
    5267            0 : }
    5268              : 
    5269              : void
    5270         3155 : StructStruct::accept_vis (HIRStmtVisitor &vis)
    5271              : {
    5272         3155 :   vis.visit (*this);
    5273         3155 : }
    5274              : 
    5275              : void
    5276         5797 : StructStruct::accept_vis (HIRVisItemVisitor &vis)
    5277              : {
    5278         5797 :   vis.visit (*this);
    5279         5797 : }
    5280              : 
    5281              : void
    5282        11293 : ImplBlock::accept_vis (HIRStmtVisitor &vis)
    5283              : {
    5284        11293 :   vis.visit (*this);
    5285        11293 : }
    5286              : 
    5287              : void
    5288        22648 : ImplBlock::accept_vis (HIRVisItemVisitor &vis)
    5289              : {
    5290        22648 :   vis.visit (*this);
    5291        22648 : }
    5292              : 
    5293              : void
    5294         1221 : ConstantItem::accept_vis (HIRStmtVisitor &vis)
    5295              : {
    5296         1221 :   vis.visit (*this);
    5297         1221 : }
    5298              : 
    5299              : void
    5300         1693 : ConstantItem::accept_vis (HIRVisItemVisitor &vis)
    5301              : {
    5302         1693 :   vis.visit (*this);
    5303         1693 : }
    5304              : 
    5305              : void
    5306          194 : ConstantItem::accept_vis (HIRImplVisitor &vis)
    5307              : {
    5308          194 :   vis.visit (*this);
    5309          194 : }
    5310              : 
    5311              : void
    5312         2008 : TupleStruct::accept_vis (HIRStmtVisitor &vis)
    5313              : {
    5314         2008 :   vis.visit (*this);
    5315         2008 : }
    5316              : 
    5317              : void
    5318         3360 : TupleStruct::accept_vis (HIRVisItemVisitor &vis)
    5319              : {
    5320         3360 :   vis.visit (*this);
    5321         3360 : }
    5322              : 
    5323              : void
    5324            0 : ExternCrate::accept_vis (HIRStmtVisitor &vis)
    5325              : {
    5326            0 :   vis.visit (*this);
    5327            0 : }
    5328              : 
    5329              : void
    5330            0 : ExternCrate::accept_vis (HIRVisItemVisitor &vis)
    5331              : {
    5332            0 :   vis.visit (*this);
    5333            0 : }
    5334              : 
    5335              : void
    5336          113 : StaticItem::accept_vis (HIRStmtVisitor &vis)
    5337              : {
    5338          113 :   vis.visit (*this);
    5339          113 : }
    5340              : 
    5341              : void
    5342          210 : StaticItem::accept_vis (HIRVisItemVisitor &vis)
    5343              : {
    5344          210 :   vis.visit (*this);
    5345          210 : }
    5346              : 
    5347              : } // namespace HIR
    5348              : } // 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.