LCOV - code coverage report
Current view: top level - gcc/rust/hir/tree - rust-hir-item.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 32.4 % 624 202
Test Date: 2025-09-20 13:40:47 Functions: 40.7 % 91 37
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (C) 2020-2024 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-hir-item.h"
      20                 :             : #include "optional.h"
      21                 :             : 
      22                 :             : namespace Rust {
      23                 :             : namespace HIR {
      24                 :             : 
      25                 :        7924 : TypeParam::TypeParam (
      26                 :             :   Analysis::NodeMapping mappings, Identifier type_representation,
      27                 :             :   location_t locus,
      28                 :             :   std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
      29                 :             :   tl::optional<std::unique_ptr<Type>> type, AST::AttrVec outer_attrs,
      30                 :        7924 :   bool was_impl_trait)
      31                 :        7924 :   : GenericParam (mappings), outer_attrs (std::move (outer_attrs)),
      32                 :        7924 :     type_representation (std::move (type_representation)),
      33                 :        7924 :     type_param_bounds (std::move (type_param_bounds)), type (std::move (type)),
      34                 :        7924 :     locus (locus), was_impl_trait (was_impl_trait)
      35                 :        7924 : {}
      36                 :             : 
      37                 :           0 : TypeParam::TypeParam (TypeParam const &other)
      38                 :           0 :   : GenericParam (other.mappings), outer_attrs (other.outer_attrs),
      39                 :           0 :     type_representation (other.type_representation), locus (other.locus),
      40                 :           0 :     was_impl_trait (other.was_impl_trait)
      41                 :             : {
      42                 :             :   // guard to prevent null pointer dereference
      43                 :           0 :   if (other.has_type ())
      44                 :           0 :     type = {other.type.value ()->clone_type ()};
      45                 :             :   else
      46                 :           0 :     type = tl::nullopt;
      47                 :             : 
      48                 :           0 :   type_param_bounds.reserve (other.type_param_bounds.size ());
      49                 :           0 :   for (const auto &e : other.type_param_bounds)
      50                 :           0 :     type_param_bounds.push_back (e->clone_type_param_bound ());
      51                 :           0 : }
      52                 :             : 
      53                 :             : TypeParam &
      54                 :           0 : TypeParam::operator= (TypeParam const &other)
      55                 :             : {
      56                 :           0 :   type_representation = other.type_representation;
      57                 :           0 :   outer_attrs = other.outer_attrs;
      58                 :           0 :   locus = other.locus;
      59                 :           0 :   mappings = other.mappings;
      60                 :           0 :   was_impl_trait = other.was_impl_trait;
      61                 :             : 
      62                 :             :   // guard to prevent null pointer dereference
      63                 :           0 :   if (other.has_type ())
      64                 :           0 :     type = {other.type.value ()->clone_type ()};
      65                 :             :   else
      66                 :           0 :     type = tl::nullopt;
      67                 :             : 
      68                 :           0 :   type_param_bounds.reserve (other.type_param_bounds.size ());
      69                 :           0 :   for (const auto &e : other.type_param_bounds)
      70                 :           0 :     type_param_bounds.push_back (e->clone_type_param_bound ());
      71                 :             : 
      72                 :           0 :   return *this;
      73                 :             : }
      74                 :             : 
      75                 :             : Analysis::NodeMapping
      76                 :        1124 : TypeParam::get_type_mappings () const
      77                 :             : {
      78                 :        1124 :   rust_assert (type.has_value ());
      79                 :        1124 :   return type.value ()->get_mappings ();
      80                 :             : }
      81                 :             : 
      82                 :             : std::vector<std::unique_ptr<TypeParamBound>> &
      83                 :        1270 : TypeParam::get_type_param_bounds ()
      84                 :             : {
      85                 :        1270 :   return type_param_bounds;
      86                 :             : }
      87                 :             : 
      88                 :         141 : TypeBoundWhereClauseItem::TypeBoundWhereClauseItem (
      89                 :             :   Analysis::NodeMapping mappings, std::vector<LifetimeParam> for_lifetimes,
      90                 :             :   std::unique_ptr<Type> bound_type,
      91                 :             :   std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
      92                 :         141 :   location_t locus)
      93                 :         141 :   : for_lifetimes (std::move (for_lifetimes)),
      94                 :         141 :     bound_type (std::move (bound_type)),
      95                 :         141 :     type_param_bounds (std::move (type_param_bounds)),
      96                 :         141 :     mappings (std::move (mappings)), locus (locus)
      97                 :         141 : {}
      98                 :             : 
      99                 :          90 : TypeBoundWhereClauseItem::TypeBoundWhereClauseItem (
     100                 :          90 :   TypeBoundWhereClauseItem const &other)
     101                 :          90 :   : for_lifetimes (other.for_lifetimes),
     102                 :          90 :     bound_type (other.bound_type->clone_type ()), mappings (other.mappings)
     103                 :             : {
     104                 :          90 :   type_param_bounds.reserve (other.type_param_bounds.size ());
     105                 :         180 :   for (const auto &e : other.type_param_bounds)
     106                 :          90 :     type_param_bounds.push_back (e->clone_type_param_bound ());
     107                 :          90 : }
     108                 :             : 
     109                 :             : TypeBoundWhereClauseItem &
     110                 :           0 : TypeBoundWhereClauseItem::operator= (TypeBoundWhereClauseItem const &other)
     111                 :             : {
     112                 :           0 :   mappings = other.mappings;
     113                 :           0 :   for_lifetimes = other.for_lifetimes;
     114                 :           0 :   bound_type = other.bound_type->clone_type ();
     115                 :           0 :   type_param_bounds.reserve (other.type_param_bounds.size ());
     116                 :           0 :   for (const auto &e : other.type_param_bounds)
     117                 :           0 :     type_param_bounds.push_back (e->clone_type_param_bound ());
     118                 :             : 
     119                 :           0 :   return *this;
     120                 :             : }
     121                 :             : 
     122                 :             : std::vector<std::unique_ptr<TypeParamBound>> &
     123                 :         626 : TypeBoundWhereClauseItem::get_type_param_bounds ()
     124                 :             : {
     125                 :         626 :   return type_param_bounds;
     126                 :             : }
     127                 :             : 
     128                 :           0 : SelfParam::SelfParam (Analysis::NodeMapping mappings,
     129                 :             :                       ImplicitSelfKind self_kind,
     130                 :           0 :                       tl::optional<Lifetime> lifetime, Type *type)
     131                 :           0 :   : self_kind (self_kind), lifetime (std::move (lifetime)), type (type),
     132                 :           0 :     mappings (mappings)
     133                 :           0 : {}
     134                 :             : 
     135                 :        3086 : SelfParam::SelfParam (Analysis::NodeMapping mappings,
     136                 :        3086 :                       std::unique_ptr<Type> type, bool is_mut, location_t locus)
     137                 :        3086 :   : self_kind (is_mut ? ImplicitSelfKind::MUT : ImplicitSelfKind::IMM),
     138                 :        3086 :     lifetime (tl::nullopt), type (std::move (type)), locus (locus),
     139                 :        3086 :     mappings (mappings)
     140                 :        3086 : {}
     141                 :             : 
     142                 :        4830 : SelfParam::SelfParam (Analysis::NodeMapping mappings,
     143                 :             :                       tl::optional<Lifetime> lifetime, bool is_mut,
     144                 :        4830 :                       location_t locus)
     145                 :        4830 :   : self_kind (is_mut ? ImplicitSelfKind::MUT_REF : ImplicitSelfKind::IMM_REF),
     146                 :        4830 :     lifetime (std::move (lifetime)), locus (locus), mappings (mappings)
     147                 :        4830 : {}
     148                 :             : 
     149                 :           0 : SelfParam::SelfParam (SelfParam const &other)
     150                 :           0 :   : self_kind (other.self_kind), lifetime (other.lifetime), locus (other.locus),
     151                 :           0 :     mappings (other.mappings)
     152                 :             : {
     153                 :           0 :   if (other.type != nullptr)
     154                 :           0 :     type = other.type->clone_type ();
     155                 :           0 : }
     156                 :             : 
     157                 :             : SelfParam &
     158                 :           0 : SelfParam::operator= (SelfParam const &other)
     159                 :             : {
     160                 :           0 :   if (other.type != nullptr)
     161                 :           0 :     type = other.type->clone_type ();
     162                 :             : 
     163                 :           0 :   self_kind = other.self_kind;
     164                 :           0 :   lifetime = other.lifetime;
     165                 :           0 :   locus = other.locus;
     166                 :           0 :   mappings = other.mappings;
     167                 :             : 
     168                 :           0 :   return *this;
     169                 :             : }
     170                 :             : 
     171                 :             : Mutability
     172                 :        5702 : SelfParam::get_mut () const
     173                 :             : {
     174                 :        5702 :   return (self_kind == ImplicitSelfKind::MUT
     175                 :        5702 :           || self_kind == ImplicitSelfKind::MUT_REF)
     176                 :        5702 :            ? Mutability::Mut
     177                 :        5702 :            : Mutability::Imm;
     178                 :             : }
     179                 :             : 
     180                 :             : bool
     181                 :       23662 : SelfParam::is_mut () const
     182                 :             : {
     183                 :       23662 :   return self_kind == ImplicitSelfKind::MUT
     184                 :       23662 :          || self_kind == ImplicitSelfKind::MUT_REF;
     185                 :             : }
     186                 :             : 
     187                 :             : bool
     188                 :       29364 : SelfParam::is_ref () const
     189                 :             : {
     190                 :       29364 :   return self_kind == ImplicitSelfKind::IMM_REF
     191                 :       29364 :          || self_kind == ImplicitSelfKind::MUT_REF;
     192                 :             : }
     193                 :             : 
     194                 :        7869 : FunctionParam::FunctionParam (Analysis::NodeMapping mappings,
     195                 :             :                               std::unique_ptr<Pattern> param_name,
     196                 :             :                               std::unique_ptr<Type> param_type,
     197                 :        7869 :                               location_t locus)
     198                 :        7869 :   : param_name (std::move (param_name)), type (std::move (param_type)),
     199                 :        7869 :     locus (locus), mappings (mappings)
     200                 :        7869 : {}
     201                 :             : 
     202                 :           0 : FunctionParam::FunctionParam (FunctionParam const &other)
     203                 :           0 :   : param_name (other.param_name->clone_pattern ()),
     204                 :           0 :     type (other.type->clone_type ()), locus (other.locus),
     205                 :           0 :     mappings (other.mappings)
     206                 :           0 : {}
     207                 :             : 
     208                 :             : FunctionParam &
     209                 :           0 : FunctionParam::operator= (FunctionParam const &other)
     210                 :             : {
     211                 :           0 :   param_name = other.param_name->clone_pattern ();
     212                 :           0 :   type = other.type->clone_type ();
     213                 :           0 :   locus = other.locus;
     214                 :           0 :   mappings = other.mappings;
     215                 :             : 
     216                 :           0 :   return *this;
     217                 :             : }
     218                 :             : 
     219                 :             : VisItem &
     220                 :           0 : VisItem::operator= (VisItem const &other)
     221                 :             : {
     222                 :           0 :   Item::operator= (other);
     223                 :           0 :   visibility = other.visibility;
     224                 :             :   // outer_attrs = other.outer_attrs;
     225                 :             : 
     226                 :           0 :   return *this;
     227                 :             : }
     228                 :             : 
     229                 :           0 : VisItem::VisItem (VisItem const &other)
     230                 :           0 :   : Item (other), visibility (other.visibility)
     231                 :           0 : {}
     232                 :             : 
     233                 :        1177 : Module::Module (Analysis::NodeMapping mappings, Identifier module_name,
     234                 :             :                 location_t locus, std::vector<std::unique_ptr<Item>> items,
     235                 :             :                 Visibility visibility, AST::AttrVec inner_attrs,
     236                 :        1177 :                 AST::AttrVec outer_attrs)
     237                 :             :   : VisItem (std::move (mappings), std::move (visibility),
     238                 :             :              std::move (outer_attrs)),
     239                 :        1177 :     WithInnerAttrs (std::move (inner_attrs)), module_name (module_name),
     240                 :        1177 :     locus (locus), items (std::move (items))
     241                 :        1177 : {}
     242                 :             : 
     243                 :           0 : Module::Module (Module const &other)
     244                 :           0 :   : VisItem (other), WithInnerAttrs (other.inner_attrs), module_name ("")
     245                 :             : {
     246                 :           0 :   items.reserve (other.items.size ());
     247                 :           0 :   for (const auto &e : other.items)
     248                 :           0 :     items.push_back (e->clone_item ());
     249                 :           0 : }
     250                 :             : 
     251                 :             : Module &
     252                 :           0 : Module::operator= (Module const &other)
     253                 :             : {
     254                 :           0 :   VisItem::operator= (other);
     255                 :           0 :   inner_attrs = other.inner_attrs;
     256                 :             : 
     257                 :           0 :   items.reserve (other.items.size ());
     258                 :           0 :   for (const auto &e : other.items)
     259                 :           0 :     items.push_back (e->clone_item ());
     260                 :             : 
     261                 :           0 :   return *this;
     262                 :             : }
     263                 :             : 
     264                 :       12958 : Function::Function (Analysis::NodeMapping mappings, Identifier function_name,
     265                 :             :                     FunctionQualifiers qualifiers,
     266                 :             :                     std::vector<std::unique_ptr<GenericParam>> generic_params,
     267                 :             :                     std::vector<FunctionParam> function_params,
     268                 :             :                     std::unique_ptr<Type> return_type, WhereClause where_clause,
     269                 :             :                     std::unique_ptr<BlockExpr> function_body, Visibility vis,
     270                 :             :                     AST::AttrVec outer_attrs, tl::optional<SelfParam> self,
     271                 :       12958 :                     Defaultness defaultness, location_t locus)
     272                 :             :   : VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
     273                 :       12958 :     qualifiers (std::move (qualifiers)),
     274                 :       12958 :     function_name (std::move (function_name)),
     275                 :       12958 :     generic_params (std::move (generic_params)),
     276                 :       12958 :     function_params (std::move (function_params)),
     277                 :       12958 :     return_type (std::move (return_type)),
     278                 :       12958 :     where_clause (std::move (where_clause)),
     279                 :       12958 :     function_body (std::move (function_body)), self (std::move (self)),
     280                 :       12958 :     locus (locus), defaultness (defaultness)
     281                 :       12958 : {}
     282                 :             : 
     283                 :           0 : Function::Function (Function const &other)
     284                 :           0 :   : VisItem (other), qualifiers (other.qualifiers),
     285                 :           0 :     function_name (other.function_name),
     286                 :           0 :     function_params (other.function_params), where_clause (other.where_clause),
     287                 :           0 :     function_body (other.function_body->clone_block_expr ()), self (other.self),
     288                 :           0 :     locus (other.locus), defaultness (other.defaultness)
     289                 :             : {
     290                 :             :   // guard to prevent null dereference (always required)
     291                 :           0 :   if (other.return_type != nullptr)
     292                 :           0 :     return_type = other.return_type->clone_type ();
     293                 :             :   else
     294                 :           0 :     return_type = nullptr;
     295                 :             : 
     296                 :           0 :   generic_params.reserve (other.generic_params.size ());
     297                 :           0 :   for (const auto &e : other.generic_params)
     298                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     299                 :           0 : }
     300                 :             : 
     301                 :             : Function &
     302                 :           0 : Function::operator= (Function const &other)
     303                 :             : {
     304                 :           0 :   VisItem::operator= (other);
     305                 :           0 :   function_name = other.function_name;
     306                 :           0 :   qualifiers = other.qualifiers;
     307                 :           0 :   function_params = other.function_params;
     308                 :             : 
     309                 :             :   // guard to prevent null dereference (always required)
     310                 :           0 :   if (other.return_type != nullptr)
     311                 :           0 :     return_type = other.return_type->clone_type ();
     312                 :             :   else
     313                 :           0 :     return_type = nullptr;
     314                 :             : 
     315                 :           0 :   where_clause = other.where_clause;
     316                 :           0 :   function_body = other.function_body->clone_block_expr ();
     317                 :           0 :   locus = other.locus;
     318                 :           0 :   self = other.self;
     319                 :             : 
     320                 :           0 :   defaultness = other.defaultness;
     321                 :             : 
     322                 :           0 :   generic_params.reserve (other.generic_params.size ());
     323                 :           0 :   for (const auto &e : other.generic_params)
     324                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     325                 :             : 
     326                 :           0 :   return *this;
     327                 :             : }
     328                 :             : 
     329                 :        1210 : TypeAlias::TypeAlias (Analysis::NodeMapping mappings, Identifier new_type_name,
     330                 :             :                       std::vector<std::unique_ptr<GenericParam>> generic_params,
     331                 :             :                       WhereClause where_clause,
     332                 :             :                       std::unique_ptr<Type> existing_type, Visibility vis,
     333                 :        1210 :                       AST::AttrVec outer_attrs, location_t locus)
     334                 :             :   : VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
     335                 :        1210 :     new_type_name (std::move (new_type_name)),
     336                 :        1210 :     generic_params (std::move (generic_params)),
     337                 :        1210 :     where_clause (std::move (where_clause)),
     338                 :        1210 :     existing_type (std::move (existing_type)), locus (locus)
     339                 :        1210 : {}
     340                 :             : 
     341                 :           0 : TypeAlias::TypeAlias (TypeAlias const &other)
     342                 :           0 :   : VisItem (other), new_type_name (other.new_type_name),
     343                 :           0 :     where_clause (other.where_clause),
     344                 :           0 :     existing_type (other.existing_type->clone_type ()), locus (other.locus)
     345                 :             : {
     346                 :           0 :   generic_params.reserve (other.generic_params.size ());
     347                 :           0 :   for (const auto &e : other.generic_params)
     348                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     349                 :           0 : }
     350                 :             : 
     351                 :             : TypeAlias &
     352                 :           0 : TypeAlias::operator= (TypeAlias const &other)
     353                 :             : {
     354                 :           0 :   VisItem::operator= (other);
     355                 :           0 :   new_type_name = other.new_type_name;
     356                 :           0 :   where_clause = other.where_clause;
     357                 :           0 :   existing_type = other.existing_type->clone_type ();
     358                 :           0 :   locus = other.locus;
     359                 :             : 
     360                 :           0 :   generic_params.reserve (other.generic_params.size ());
     361                 :           0 :   for (const auto &e : other.generic_params)
     362                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     363                 :             : 
     364                 :           0 :   return *this;
     365                 :             : }
     366                 :             : 
     367                 :        2261 : StructField::StructField (Analysis::NodeMapping mappings, Identifier field_name,
     368                 :             :                           std::unique_ptr<Type> field_type, Visibility vis,
     369                 :        2261 :                           location_t locus, AST::AttrVec outer_attrs)
     370                 :        2261 :   : outer_attrs (std::move (outer_attrs)), visibility (std::move (vis)),
     371                 :        2261 :     field_name (std::move (field_name)), field_type (std::move (field_type)),
     372                 :        2261 :     mappings (mappings), locus (locus)
     373                 :        2261 : {}
     374                 :             : 
     375                 :           0 : StructField::StructField (StructField const &other)
     376                 :           0 :   : outer_attrs (other.outer_attrs), visibility (other.visibility),
     377                 :           0 :     field_name (other.field_name), field_type (other.field_type->clone_type ()),
     378                 :           0 :     mappings (other.mappings)
     379                 :           0 : {}
     380                 :             : 
     381                 :             : StructField &
     382                 :           0 : StructField::operator= (StructField const &other)
     383                 :             : {
     384                 :           0 :   field_name = other.field_name;
     385                 :           0 :   field_type = other.field_type->clone_type ();
     386                 :           0 :   visibility = other.visibility;
     387                 :           0 :   outer_attrs = other.outer_attrs;
     388                 :           0 :   mappings = other.mappings;
     389                 :             : 
     390                 :           0 :   return *this;
     391                 :             : }
     392                 :             : 
     393                 :        1985 : TupleField::TupleField (Analysis::NodeMapping mapping,
     394                 :             :                         std::unique_ptr<Type> field_type, Visibility vis,
     395                 :        1985 :                         location_t locus, AST::AttrVec outer_attrs)
     396                 :        1985 :   : outer_attrs (std::move (outer_attrs)), visibility (std::move (vis)),
     397                 :        1985 :     field_type (std::move (field_type)), locus (locus), mappings (mapping)
     398                 :        1985 : {}
     399                 :             : 
     400                 :           0 : TupleField::TupleField (TupleField const &other)
     401                 :           0 :   : outer_attrs (other.outer_attrs), visibility (other.visibility),
     402                 :           0 :     field_type (other.field_type->clone_type ()), locus (other.locus),
     403                 :           0 :     mappings (other.mappings)
     404                 :           0 : {}
     405                 :             : 
     406                 :             : TupleField &
     407                 :           0 : TupleField::operator= (TupleField const &other)
     408                 :             : {
     409                 :           0 :   field_type = other.field_type->clone_type ();
     410                 :           0 :   visibility = other.visibility;
     411                 :           0 :   outer_attrs = other.outer_attrs;
     412                 :           0 :   locus = other.locus;
     413                 :           0 :   mappings = other.mappings;
     414                 :             : 
     415                 :           0 :   return *this;
     416                 :             : }
     417                 :             : 
     418                 :         928 : TupleStruct::TupleStruct (
     419                 :             :   Analysis::NodeMapping mappings, std::vector<TupleField> fields,
     420                 :             :   Identifier struct_name,
     421                 :             :   std::vector<std::unique_ptr<GenericParam>> generic_params,
     422                 :             :   WhereClause where_clause, Visibility vis, AST::AttrVec outer_attrs,
     423                 :         928 :   location_t locus)
     424                 :             :   : Struct (std::move (mappings), std::move (struct_name),
     425                 :             :             std::move (generic_params), std::move (where_clause),
     426                 :             :             std::move (vis), locus, std::move (outer_attrs)),
     427                 :         928 :     fields (std::move (fields))
     428                 :         928 : {}
     429                 :             : 
     430                 :        1210 : EnumItem::EnumItem (Analysis::NodeMapping mappings, Identifier variant_name,
     431                 :        1210 :                     AST::AttrVec outer_attrs, location_t locus)
     432                 :             :   : Item (std::move (mappings), std::move (outer_attrs)),
     433                 :        1210 :     variant_name (std::move (variant_name)), locus (locus)
     434                 :        1210 : {}
     435                 :             : 
     436                 :         413 : EnumItemTuple::EnumItemTuple (Analysis::NodeMapping mappings,
     437                 :             :                               Identifier variant_name,
     438                 :             :                               std::vector<TupleField> tuple_fields,
     439                 :         413 :                               AST::AttrVec outer_attrs, location_t locus)
     440                 :             :   : EnumItem (std::move (mappings), std::move (variant_name),
     441                 :             :               std::move (outer_attrs), locus),
     442                 :         413 :     tuple_fields (std::move (tuple_fields))
     443                 :         413 : {}
     444                 :             : 
     445                 :          88 : EnumItemStruct::EnumItemStruct (Analysis::NodeMapping mappings,
     446                 :             :                                 Identifier variant_name,
     447                 :             :                                 std::vector<StructField> struct_fields,
     448                 :          88 :                                 AST::AttrVec outer_attrs, location_t locus)
     449                 :             :   : EnumItem (std::move (mappings), std::move (variant_name),
     450                 :             :               std::move (outer_attrs), locus),
     451                 :          88 :     struct_fields (std::move (struct_fields))
     452                 :          88 : {}
     453                 :             : 
     454                 :         272 : EnumItemDiscriminant::EnumItemDiscriminant (Analysis::NodeMapping mappings,
     455                 :             :                                             Identifier variant_name,
     456                 :             :                                             std::unique_ptr<Expr> expr,
     457                 :             :                                             AST::AttrVec outer_attrs,
     458                 :         272 :                                             location_t locus)
     459                 :             :   : EnumItem (std::move (mappings), std::move (variant_name),
     460                 :             :               std::move (outer_attrs), locus),
     461                 :         272 :     expression (std::move (expr))
     462                 :         272 : {}
     463                 :             : 
     464                 :           0 : EnumItemDiscriminant::EnumItemDiscriminant (EnumItemDiscriminant const &other)
     465                 :           0 :   : EnumItem (other), expression (other.expression->clone_expr ())
     466                 :           0 : {}
     467                 :             : 
     468                 :             : EnumItemDiscriminant &
     469                 :           0 : EnumItemDiscriminant::operator= (EnumItemDiscriminant const &other)
     470                 :             : {
     471                 :           0 :   EnumItem::operator= (other);
     472                 :           0 :   expression = other.expression->clone_expr ();
     473                 :             :   // variant_name = other.variant_name;
     474                 :             :   // outer_attrs = other.outer_attrs;
     475                 :             : 
     476                 :           0 :   return *this;
     477                 :             : }
     478                 :             : 
     479                 :         511 : Enum::Enum (Analysis::NodeMapping mappings, Identifier enum_name,
     480                 :             :             Visibility vis,
     481                 :             :             std::vector<std::unique_ptr<GenericParam>> generic_params,
     482                 :             :             WhereClause where_clause,
     483                 :             :             std::vector<std::unique_ptr<EnumItem>> items,
     484                 :         511 :             AST::AttrVec outer_attrs, location_t locus)
     485                 :             :   : VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
     486                 :        1022 :     enum_name (std::move (enum_name)),
     487                 :         511 :     generic_params (std::move (generic_params)),
     488                 :         511 :     where_clause (std::move (where_clause)), items (std::move (items)),
     489                 :         511 :     locus (locus)
     490                 :         511 : {}
     491                 :             : 
     492                 :           0 : Enum::Enum (Enum const &other)
     493                 :           0 :   : VisItem (other), enum_name (other.enum_name),
     494                 :           0 :     where_clause (other.where_clause), locus (other.locus)
     495                 :             : {
     496                 :           0 :   generic_params.reserve (other.generic_params.size ());
     497                 :           0 :   for (const auto &e : other.generic_params)
     498                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     499                 :             : 
     500                 :           0 :   items.reserve (other.items.size ());
     501                 :           0 :   for (const auto &e : other.items)
     502                 :           0 :     items.push_back (e->clone_enum_item ());
     503                 :           0 : }
     504                 :             : 
     505                 :             : Enum &
     506                 :           0 : Enum::operator= (Enum const &other)
     507                 :             : {
     508                 :           0 :   VisItem::operator= (other);
     509                 :           0 :   enum_name = other.enum_name;
     510                 :           0 :   where_clause = other.where_clause;
     511                 :           0 :   locus = other.locus;
     512                 :             : 
     513                 :           0 :   generic_params.reserve (other.generic_params.size ());
     514                 :           0 :   for (const auto &e : other.generic_params)
     515                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     516                 :             : 
     517                 :           0 :   items.reserve (other.items.size ());
     518                 :           0 :   for (const auto &e : other.items)
     519                 :           0 :     items.push_back (e->clone_enum_item ());
     520                 :             : 
     521                 :           0 :   return *this;
     522                 :             : }
     523                 :             : 
     524                 :         102 : Union::Union (Analysis::NodeMapping mappings, Identifier union_name,
     525                 :             :               Visibility vis,
     526                 :             :               std::vector<std::unique_ptr<GenericParam>> generic_params,
     527                 :             :               WhereClause where_clause, std::vector<StructField> variants,
     528                 :         102 :               AST::AttrVec outer_attrs, location_t locus)
     529                 :             :   : VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
     530                 :         204 :     union_name (std::move (union_name)),
     531                 :         102 :     generic_params (std::move (generic_params)),
     532                 :         102 :     where_clause (std::move (where_clause)), variants (std::move (variants)),
     533                 :         102 :     locus (locus)
     534                 :         102 : {}
     535                 :             : 
     536                 :           0 : Union::Union (Union const &other)
     537                 :           0 :   : VisItem (other), union_name (other.union_name),
     538                 :           0 :     where_clause (other.where_clause), variants (other.variants),
     539                 :           0 :     locus (other.locus)
     540                 :             : {
     541                 :           0 :   generic_params.reserve (other.generic_params.size ());
     542                 :           0 :   for (const auto &e : other.generic_params)
     543                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     544                 :           0 : }
     545                 :             : 
     546                 :             : Union &
     547                 :           0 : Union::operator= (Union const &other)
     548                 :             : {
     549                 :           0 :   VisItem::operator= (other);
     550                 :           0 :   union_name = other.union_name;
     551                 :           0 :   where_clause = other.where_clause;
     552                 :           0 :   variants = other.variants;
     553                 :           0 :   locus = other.locus;
     554                 :             : 
     555                 :           0 :   generic_params.reserve (other.generic_params.size ());
     556                 :           0 :   for (const auto &e : other.generic_params)
     557                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     558                 :             : 
     559                 :           0 :   return *this;
     560                 :             : }
     561                 :             : 
     562                 :         487 : ConstantItem::ConstantItem (Analysis::NodeMapping mappings, Identifier ident,
     563                 :             :                             Visibility vis, std::unique_ptr<Type> type,
     564                 :             :                             std::unique_ptr<Expr> const_expr,
     565                 :         487 :                             AST::AttrVec outer_attrs, location_t locus)
     566                 :             :   : VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
     567                 :         487 :     identifier (std::move (ident)), type (std::move (type)),
     568                 :         487 :     const_expr (std::move (const_expr)), locus (locus)
     569                 :         487 : {}
     570                 :             : 
     571                 :           0 : ConstantItem::ConstantItem (ConstantItem const &other)
     572                 :           0 :   : VisItem (other), identifier (other.identifier),
     573                 :           0 :     type (other.type->clone_type ()),
     574                 :           0 :     const_expr (other.const_expr->clone_expr ()), locus (other.locus)
     575                 :           0 : {}
     576                 :             : 
     577                 :             : ConstantItem &
     578                 :           0 : ConstantItem::operator= (ConstantItem const &other)
     579                 :             : {
     580                 :           0 :   VisItem::operator= (other);
     581                 :           0 :   identifier = other.identifier;
     582                 :           0 :   type = other.type->clone_type ();
     583                 :           0 :   const_expr = other.const_expr->clone_expr ();
     584                 :           0 :   locus = other.locus;
     585                 :             : 
     586                 :           0 :   return *this;
     587                 :             : }
     588                 :             : 
     589                 :          52 : StaticItem::StaticItem (Analysis::NodeMapping mappings, Identifier name,
     590                 :             :                         Mutability mut, std::unique_ptr<Type> type,
     591                 :             :                         std::unique_ptr<Expr> expr, Visibility vis,
     592                 :          52 :                         AST::AttrVec outer_attrs, location_t locus)
     593                 :             :   : VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
     594                 :         104 :     mut (mut), name (std::move (name)), type (std::move (type)),
     595                 :          52 :     expr (std::move (expr)), locus (locus)
     596                 :          52 : {}
     597                 :             : 
     598                 :           0 : StaticItem::StaticItem (StaticItem const &other)
     599                 :           0 :   : VisItem (other), mut (other.mut), name (other.name),
     600                 :           0 :     type (other.type->clone_type ()), expr (other.expr->clone_expr ()),
     601                 :           0 :     locus (other.locus)
     602                 :           0 : {}
     603                 :             : 
     604                 :             : StaticItem &
     605                 :           0 : StaticItem::operator= (StaticItem const &other)
     606                 :             : {
     607                 :           0 :   VisItem::operator= (other);
     608                 :           0 :   name = other.name;
     609                 :           0 :   mut = other.mut;
     610                 :           0 :   type = other.type->clone_type ();
     611                 :           0 :   expr = other.expr->clone_expr ();
     612                 :           0 :   locus = other.locus;
     613                 :             : 
     614                 :           0 :   return *this;
     615                 :             : }
     616                 :             : 
     617                 :        2523 : TraitFunctionDecl::TraitFunctionDecl (
     618                 :             :   Identifier function_name, FunctionQualifiers qualifiers,
     619                 :             :   std::vector<std::unique_ptr<GenericParam>> generic_params,
     620                 :             :   tl::optional<SelfParam> self, std::vector<FunctionParam> function_params,
     621                 :        2523 :   std::unique_ptr<Type> return_type, WhereClause where_clause)
     622                 :        2523 :   : qualifiers (std::move (qualifiers)),
     623                 :        2523 :     function_name (std::move (function_name)),
     624                 :        2523 :     generic_params (std::move (generic_params)),
     625                 :        2523 :     function_params (std::move (function_params)),
     626                 :        2523 :     return_type (std::move (return_type)),
     627                 :        2523 :     where_clause (std::move (where_clause)), self (std::move (self))
     628                 :        2523 : {}
     629                 :             : 
     630                 :           0 : TraitFunctionDecl::TraitFunctionDecl (TraitFunctionDecl const &other)
     631                 :           0 :   : qualifiers (other.qualifiers), function_name (other.function_name),
     632                 :           0 :     function_params (other.function_params),
     633                 :           0 :     return_type (other.return_type->clone_type ()),
     634                 :           0 :     where_clause (other.where_clause), self (other.self)
     635                 :             : {
     636                 :           0 :   generic_params.reserve (other.generic_params.size ());
     637                 :           0 :   for (const auto &e : other.generic_params)
     638                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     639                 :           0 : }
     640                 :             : 
     641                 :             : TraitFunctionDecl &
     642                 :           0 : TraitFunctionDecl::operator= (TraitFunctionDecl const &other)
     643                 :             : {
     644                 :           0 :   function_name = other.function_name;
     645                 :           0 :   qualifiers = other.qualifiers;
     646                 :           0 :   function_params = other.function_params;
     647                 :           0 :   return_type = other.return_type->clone_type ();
     648                 :           0 :   where_clause = other.where_clause;
     649                 :           0 :   self = other.self;
     650                 :             : 
     651                 :           0 :   generic_params.reserve (other.generic_params.size ());
     652                 :           0 :   for (const auto &e : other.generic_params)
     653                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     654                 :             : 
     655                 :           0 :   return *this;
     656                 :             : }
     657                 :             : 
     658                 :        2523 : TraitItemFunc::TraitItemFunc (Analysis::NodeMapping mappings,
     659                 :             :                               TraitFunctionDecl decl,
     660                 :             :                               std::unique_ptr<BlockExpr> block_expr,
     661                 :        2523 :                               AST::AttrVec outer_attrs, location_t locus)
     662                 :        2523 :   : TraitItem (mappings), outer_attrs (std::move (outer_attrs)),
     663                 :        2523 :     decl (std::move (decl)), block_expr (std::move (block_expr)), locus (locus)
     664                 :        2523 : {}
     665                 :             : 
     666                 :           0 : TraitItemFunc::TraitItemFunc (TraitItemFunc const &other)
     667                 :           0 :   : TraitItem (other.mappings), outer_attrs (other.outer_attrs),
     668                 :           0 :     decl (other.decl), locus (other.locus)
     669                 :             : {
     670                 :           0 :   if (other.block_expr != nullptr)
     671                 :           0 :     block_expr = other.block_expr->clone_block_expr ();
     672                 :           0 : }
     673                 :             : 
     674                 :             : TraitItemFunc &
     675                 :           0 : TraitItemFunc::operator= (TraitItemFunc const &other)
     676                 :             : {
     677                 :           0 :   TraitItem::operator= (other);
     678                 :           0 :   outer_attrs = other.outer_attrs;
     679                 :           0 :   decl = other.decl;
     680                 :           0 :   locus = other.locus;
     681                 :           0 :   mappings = other.mappings;
     682                 :           0 :   if (other.block_expr != nullptr)
     683                 :           0 :     block_expr = other.block_expr->clone_block_expr ();
     684                 :             : 
     685                 :           0 :   return *this;
     686                 :             : }
     687                 :             : 
     688                 :          38 : TraitItemConst::TraitItemConst (Analysis::NodeMapping mappings, Identifier name,
     689                 :             :                                 std::unique_ptr<Type> type,
     690                 :             :                                 std::unique_ptr<Expr> expr,
     691                 :          38 :                                 AST::AttrVec outer_attrs, location_t locus)
     692                 :          38 :   : TraitItem (mappings), outer_attrs (std::move (outer_attrs)),
     693                 :          38 :     name (std::move (name)), type (std::move (type)), expr (std::move (expr)),
     694                 :          38 :     locus (locus)
     695                 :          38 : {}
     696                 :             : 
     697                 :           0 : TraitItemConst::TraitItemConst (TraitItemConst const &other)
     698                 :           0 :   : TraitItem (other.mappings), outer_attrs (other.outer_attrs),
     699                 :           0 :     name (other.name), type (other.type->clone_type ()),
     700                 :           0 :     expr (other.expr->clone_expr ()), locus (other.locus)
     701                 :           0 : {}
     702                 :             : 
     703                 :             : TraitItemConst &
     704                 :           0 : TraitItemConst::operator= (TraitItemConst const &other)
     705                 :             : {
     706                 :           0 :   TraitItem::operator= (other);
     707                 :           0 :   outer_attrs = other.outer_attrs;
     708                 :           0 :   name = other.name;
     709                 :           0 :   type = other.type->clone_type ();
     710                 :           0 :   expr = other.expr->clone_expr ();
     711                 :           0 :   locus = other.locus;
     712                 :           0 :   mappings = other.mappings;
     713                 :             : 
     714                 :           0 :   return *this;
     715                 :             : }
     716                 :             : 
     717                 :         725 : TraitItemType::TraitItemType (
     718                 :             :   Analysis::NodeMapping mappings, Identifier name,
     719                 :             :   std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
     720                 :         725 :   AST::AttrVec outer_attrs, location_t locus)
     721                 :         725 :   : TraitItem (mappings), outer_attrs (std::move (outer_attrs)),
     722                 :         725 :     name (std::move (name)), type_param_bounds (std::move (type_param_bounds)),
     723                 :         725 :     locus (locus)
     724                 :         725 : {}
     725                 :             : 
     726                 :           0 : TraitItemType::TraitItemType (TraitItemType const &other)
     727                 :           0 :   : TraitItem (other.mappings), outer_attrs (other.outer_attrs),
     728                 :           0 :     name (other.name), locus (other.locus)
     729                 :             : {
     730                 :           0 :   type_param_bounds.reserve (other.type_param_bounds.size ());
     731                 :           0 :   for (const auto &e : other.type_param_bounds)
     732                 :           0 :     type_param_bounds.push_back (e->clone_type_param_bound ());
     733                 :           0 : }
     734                 :             : 
     735                 :             : TraitItemType &
     736                 :           0 : TraitItemType::operator= (TraitItemType const &other)
     737                 :             : {
     738                 :           0 :   TraitItem::operator= (other);
     739                 :           0 :   outer_attrs = other.outer_attrs;
     740                 :           0 :   name = other.name;
     741                 :           0 :   locus = other.locus;
     742                 :           0 :   mappings = other.mappings;
     743                 :             : 
     744                 :           0 :   type_param_bounds.reserve (other.type_param_bounds.size ());
     745                 :           0 :   for (const auto &e : other.type_param_bounds)
     746                 :           0 :     type_param_bounds.push_back (e->clone_type_param_bound ());
     747                 :             : 
     748                 :           0 :   return *this;
     749                 :             : }
     750                 :             : 
     751                 :        3608 : Trait::Trait (Analysis::NodeMapping mappings, Identifier name,
     752                 :             :               Unsafety unsafety,
     753                 :             :               std::vector<std::unique_ptr<GenericParam>> generic_params,
     754                 :             :               std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
     755                 :             :               WhereClause where_clause,
     756                 :             :               std::vector<std::unique_ptr<TraitItem>> trait_items,
     757                 :        3608 :               Visibility vis, AST::AttrVec outer_attrs, location_t locus)
     758                 :             :   : VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
     759                 :        7216 :     unsafety (unsafety), name (std::move (name)),
     760                 :        3608 :     generic_params (std::move (generic_params)),
     761                 :        3608 :     type_param_bounds (std::move (type_param_bounds)),
     762                 :        3608 :     where_clause (std::move (where_clause)),
     763                 :        3608 :     trait_items (std::move (trait_items)), locus (locus)
     764                 :        3608 : {}
     765                 :             : 
     766                 :           0 : Trait::Trait (Trait const &other)
     767                 :           0 :   : VisItem (other), unsafety (other.unsafety), name (other.name),
     768                 :           0 :     where_clause (other.where_clause), locus (other.locus)
     769                 :             : {
     770                 :           0 :   generic_params.reserve (other.generic_params.size ());
     771                 :           0 :   for (const auto &e : other.generic_params)
     772                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     773                 :             : 
     774                 :           0 :   type_param_bounds.reserve (other.type_param_bounds.size ());
     775                 :           0 :   for (const auto &e : other.type_param_bounds)
     776                 :           0 :     type_param_bounds.push_back (e->clone_type_param_bound ());
     777                 :             : 
     778                 :           0 :   trait_items.reserve (other.trait_items.size ());
     779                 :           0 :   for (const auto &e : other.trait_items)
     780                 :           0 :     trait_items.push_back (e->clone_trait_item ());
     781                 :           0 : }
     782                 :             : 
     783                 :             : Trait &
     784                 :           0 : Trait::operator= (Trait const &other)
     785                 :             : {
     786                 :           0 :   VisItem::operator= (other);
     787                 :           0 :   name = other.name;
     788                 :           0 :   unsafety = other.unsafety;
     789                 :           0 :   where_clause = other.where_clause;
     790                 :           0 :   locus = other.locus;
     791                 :             : 
     792                 :           0 :   generic_params.reserve (other.generic_params.size ());
     793                 :           0 :   for (const auto &e : other.generic_params)
     794                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     795                 :             : 
     796                 :           0 :   type_param_bounds.reserve (other.type_param_bounds.size ());
     797                 :           0 :   for (const auto &e : other.type_param_bounds)
     798                 :           0 :     type_param_bounds.push_back (e->clone_type_param_bound ());
     799                 :             : 
     800                 :           0 :   trait_items.reserve (other.trait_items.size ());
     801                 :           0 :   for (const auto &e : other.trait_items)
     802                 :           0 :     trait_items.push_back (e->clone_trait_item ());
     803                 :             : 
     804                 :           0 :   return *this;
     805                 :             : }
     806                 :             : 
     807                 :        9944 : ImplBlock::ImplBlock (Analysis::NodeMapping mappings,
     808                 :             :                       std::vector<std::unique_ptr<ImplItem>> impl_items,
     809                 :             :                       std::vector<std::unique_ptr<GenericParam>> generic_params,
     810                 :             :                       std::unique_ptr<Type> impl_type,
     811                 :             :                       std::unique_ptr<TypePath> trait_ref,
     812                 :             :                       WhereClause where_clause, BoundPolarity polarity,
     813                 :             :                       Visibility vis, AST::AttrVec inner_attrs,
     814                 :        9944 :                       AST::AttrVec outer_attrs, location_t locus, bool unsafe)
     815                 :             :   : VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
     816                 :             :     WithInnerAttrs (std::move (inner_attrs)),
     817                 :        9944 :     generic_params (std::move (generic_params)),
     818                 :        9944 :     impl_type (std::move (impl_type)), trait_ref (std::move (trait_ref)),
     819                 :        9944 :     where_clause (std::move (where_clause)), polarity (polarity), locus (locus),
     820                 :        9944 :     impl_items (std::move (impl_items)), unsafe (unsafe)
     821                 :        9944 : {}
     822                 :             : 
     823                 :           0 : ImplBlock::ImplBlock (ImplBlock const &other)
     824                 :           0 :   : VisItem (other), WithInnerAttrs (other.inner_attrs),
     825                 :           0 :     impl_type (other.impl_type->clone_type ()),
     826                 :           0 :     where_clause (other.where_clause), polarity (other.polarity),
     827                 :           0 :     locus (other.locus), unsafe (other.unsafe)
     828                 :             : {
     829                 :           0 :   generic_params.reserve (other.generic_params.size ());
     830                 :           0 :   for (const auto &e : other.generic_params)
     831                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     832                 :             : 
     833                 :           0 :   impl_items.reserve (other.impl_items.size ());
     834                 :           0 :   for (const auto &e : other.impl_items)
     835                 :           0 :     impl_items.push_back (e->clone_inherent_impl_item ());
     836                 :           0 : }
     837                 :             : 
     838                 :             : ImplBlock &
     839                 :           0 : ImplBlock::operator= (ImplBlock const &other)
     840                 :             : {
     841                 :           0 :   VisItem::operator= (other);
     842                 :           0 :   impl_type = other.impl_type->clone_type ();
     843                 :           0 :   where_clause = other.where_clause;
     844                 :           0 :   polarity = other.polarity;
     845                 :           0 :   inner_attrs = other.inner_attrs;
     846                 :           0 :   locus = other.locus;
     847                 :           0 :   unsafe = other.unsafe;
     848                 :             : 
     849                 :           0 :   generic_params.reserve (other.generic_params.size ());
     850                 :           0 :   for (const auto &e : other.generic_params)
     851                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     852                 :             : 
     853                 :           0 :   impl_items.reserve (other.impl_items.size ());
     854                 :           0 :   for (const auto &e : other.impl_items)
     855                 :           0 :     impl_items.push_back (e->clone_inherent_impl_item ());
     856                 :             : 
     857                 :           0 :   return *this;
     858                 :             : }
     859                 :             : 
     860                 :        2170 : ExternalItem::ExternalItem (Analysis::NodeMapping mappings,
     861                 :             :                             Identifier item_name, Visibility vis,
     862                 :        2170 :                             AST::AttrVec outer_attrs, location_t locus)
     863                 :        2170 :   : mappings (mappings), outer_attrs (std::move (outer_attrs)),
     864                 :        2170 :     visibility (std::move (vis)), item_name (std::move (item_name)),
     865                 :        2170 :     locus (locus)
     866                 :        2170 : {}
     867                 :             : 
     868                 :           0 : ExternalItem::ExternalItem (ExternalItem const &other)
     869                 :           0 :   : mappings (other.mappings), outer_attrs (other.outer_attrs),
     870                 :           0 :     visibility (other.visibility), item_name (other.item_name),
     871                 :           0 :     locus (other.locus)
     872                 :           0 : {}
     873                 :             : 
     874                 :             : ExternalItem &
     875                 :           0 : ExternalItem::operator= (ExternalItem const &other)
     876                 :             : {
     877                 :           0 :   mappings = other.mappings;
     878                 :           0 :   item_name = other.item_name;
     879                 :           0 :   visibility = other.visibility;
     880                 :           0 :   outer_attrs = other.outer_attrs;
     881                 :           0 :   locus = other.locus;
     882                 :             : 
     883                 :           0 :   return *this;
     884                 :             : }
     885                 :             : 
     886                 :           1 : ExternalStaticItem::ExternalStaticItem (Analysis::NodeMapping mappings,
     887                 :             :                                         Identifier item_name,
     888                 :             :                                         std::unique_ptr<Type> item_type,
     889                 :             :                                         Mutability mut, Visibility vis,
     890                 :             :                                         AST::AttrVec outer_attrs,
     891                 :           1 :                                         location_t locus)
     892                 :             :   : ExternalItem (std::move (mappings), std::move (item_name), std::move (vis),
     893                 :             :                   std::move (outer_attrs), locus),
     894                 :           1 :     mut (mut), item_type (std::move (item_type))
     895                 :           1 : {}
     896                 :             : 
     897                 :           0 : ExternalStaticItem::ExternalStaticItem (ExternalStaticItem const &other)
     898                 :           0 :   : ExternalItem (other), mut (other.mut),
     899                 :           0 :     item_type (other.item_type->clone_type ())
     900                 :           0 : {}
     901                 :             : 
     902                 :             : ExternalStaticItem &
     903                 :           0 : ExternalStaticItem::operator= (ExternalStaticItem const &other)
     904                 :             : {
     905                 :           0 :   ExternalItem::operator= (other);
     906                 :           0 :   item_type = other.item_type->clone_type ();
     907                 :           0 :   mut = other.mut;
     908                 :             : 
     909                 :           0 :   return *this;
     910                 :             : }
     911                 :             : 
     912                 :        2651 : NamedFunctionParam::NamedFunctionParam (Analysis::NodeMapping mappings,
     913                 :             :                                         Identifier name,
     914                 :        2651 :                                         std::unique_ptr<Type> param_type)
     915                 :        2651 :   : name (std::move (name)), param_type (std::move (param_type)),
     916                 :        2651 :     mappings (std::move (mappings))
     917                 :        2651 : {}
     918                 :             : 
     919                 :           0 : NamedFunctionParam::NamedFunctionParam (NamedFunctionParam const &other)
     920                 :           0 :   : name (other.name), param_type (other.param_type->clone_type ()),
     921                 :           0 :     mappings (other.mappings)
     922                 :           0 : {}
     923                 :             : 
     924                 :             : NamedFunctionParam &
     925                 :           0 : NamedFunctionParam::operator= (NamedFunctionParam const &other)
     926                 :             : {
     927                 :           0 :   mappings = other.mappings;
     928                 :           0 :   name = other.name;
     929                 :           0 :   param_type = other.param_type->clone_type ();
     930                 :             :   // has_name = other.has_name;
     931                 :             : 
     932                 :           0 :   return *this;
     933                 :             : }
     934                 :             : 
     935                 :        2169 : ExternalFunctionItem::ExternalFunctionItem (
     936                 :             :   Analysis::NodeMapping mappings, Identifier item_name,
     937                 :             :   std::vector<std::unique_ptr<GenericParam>> generic_params,
     938                 :             :   std::unique_ptr<Type> return_type, WhereClause where_clause,
     939                 :             :   std::vector<NamedFunctionParam> function_params, bool has_variadics,
     940                 :        2169 :   Visibility vis, AST::AttrVec outer_attrs, location_t locus)
     941                 :             :   : ExternalItem (std::move (mappings), std::move (item_name), std::move (vis),
     942                 :             :                   std::move (outer_attrs), locus),
     943                 :        2169 :     generic_params (std::move (generic_params)),
     944                 :        2169 :     return_type (std::move (return_type)),
     945                 :        2169 :     where_clause (std::move (where_clause)),
     946                 :        2169 :     function_params (std::move (function_params)), has_variadics (has_variadics)
     947                 :        2169 : {}
     948                 :             : 
     949                 :           0 : ExternalFunctionItem::ExternalFunctionItem (ExternalFunctionItem const &other)
     950                 :           0 :   : ExternalItem (other), where_clause (other.where_clause),
     951                 :           0 :     function_params (other.function_params), has_variadics (other.has_variadics)
     952                 :             : {
     953                 :           0 :   if (other.return_type)
     954                 :           0 :     return_type = other.return_type->clone_type ();
     955                 :             : 
     956                 :           0 :   generic_params.reserve (other.generic_params.size ());
     957                 :           0 :   for (const auto &e : other.generic_params)
     958                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     959                 :           0 : }
     960                 :             : 
     961                 :             : ExternalFunctionItem &
     962                 :           0 : ExternalFunctionItem::operator= (ExternalFunctionItem const &other)
     963                 :             : {
     964                 :           0 :   ExternalItem::operator= (other);
     965                 :             : 
     966                 :           0 :   where_clause = other.where_clause;
     967                 :           0 :   function_params = other.function_params;
     968                 :           0 :   has_variadics = other.has_variadics;
     969                 :             : 
     970                 :           0 :   if (other.return_type)
     971                 :           0 :     return_type = other.return_type->clone_type ();
     972                 :             : 
     973                 :           0 :   generic_params.reserve (other.generic_params.size ());
     974                 :           0 :   for (const auto &e : other.generic_params)
     975                 :           0 :     generic_params.push_back (e->clone_generic_param ());
     976                 :             : 
     977                 :           0 :   return *this;
     978                 :             : }
     979                 :             : 
     980                 :           0 : ExternalTypeItem::ExternalTypeItem (Analysis::NodeMapping mappings,
     981                 :             :                                     Identifier item_name, Visibility vis,
     982                 :           0 :                                     location_t locus)
     983                 :             :   : ExternalItem (std::move (mappings), std::move (item_name),
     984                 :           0 :                   Visibility (std::move (vis)),
     985                 :             :                   /* FIXME: Is that correct? */
     986                 :           0 :                   {}, locus)
     987                 :           0 : {}
     988                 :             : 
     989                 :           0 : ExternalTypeItem::ExternalTypeItem (ExternalTypeItem const &other)
     990                 :           0 :   : ExternalItem (other)
     991                 :           0 : {}
     992                 :             : 
     993                 :        1425 : ExternBlock::ExternBlock (
     994                 :             :   Analysis::NodeMapping mappings, ABI abi,
     995                 :             :   std::vector<std::unique_ptr<ExternalItem>> extern_items, Visibility vis,
     996                 :        1425 :   AST::AttrVec inner_attrs, AST::AttrVec outer_attrs, location_t locus)
     997                 :             :   : VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
     998                 :        1425 :     WithInnerAttrs (std::move (inner_attrs)), abi (abi),
     999                 :        1425 :     extern_items (std::move (extern_items)), locus (locus)
    1000                 :        1425 : {}
    1001                 :             : 
    1002                 :           0 : ExternBlock::ExternBlock (ExternBlock const &other)
    1003                 :           0 :   : VisItem (other), WithInnerAttrs (other.inner_attrs), abi (other.abi),
    1004                 :           0 :     locus (other.locus)
    1005                 :             : {
    1006                 :           0 :   extern_items.reserve (other.extern_items.size ());
    1007                 :           0 :   for (const auto &e : other.extern_items)
    1008                 :           0 :     extern_items.push_back (e->clone_external_item ());
    1009                 :           0 : }
    1010                 :             : 
    1011                 :             : ExternBlock &
    1012                 :           0 : ExternBlock::operator= (ExternBlock const &other)
    1013                 :             : {
    1014                 :           0 :   VisItem::operator= (other);
    1015                 :           0 :   abi = other.abi;
    1016                 :           0 :   inner_attrs = other.inner_attrs;
    1017                 :           0 :   locus = other.locus;
    1018                 :             : 
    1019                 :           0 :   extern_items.reserve (other.extern_items.size ());
    1020                 :           0 :   for (const auto &e : other.extern_items)
    1021                 :           0 :     extern_items.push_back (e->clone_external_item ());
    1022                 :             : 
    1023                 :           0 :   return *this;
    1024                 :             : }
    1025                 :             : 
    1026                 :             : } // namespace HIR
    1027                 :             : } // 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.