LCOV - code coverage report
Current view: top level - gcc/rust/hir/tree - rust-hir.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 33.4 % 2300 768
Test Date: 2025-06-21 16:26:05 Functions: 52.3 % 396 207
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

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

Generated by: LCOV version 2.1-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.