(root)/
gcc-13.2.0/
gcc/
rust/
typecheck/
rust-tyty-bounds.h
       1  // Copyright (C) 2020-2023 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  #ifndef RUST_TYTY_BOUNDS_H
      20  #define RUST_TYTY_BOUNDS_H
      21  
      22  #include "rust-location.h"
      23  
      24  namespace Rust {
      25  
      26  namespace Resolver {
      27  class TraitReference;
      28  class TraitItemReference;
      29  class AssociatedImplTrait;
      30  } // namespace Resolver
      31  
      32  namespace TyTy {
      33  
      34  class BaseType;
      35  class TypeBoundPredicate;
      36  class TypeBoundPredicateItem
      37  {
      38  public:
      39    TypeBoundPredicateItem (const TypeBoundPredicate *parent,
      40  			  const Resolver::TraitItemReference *trait_item_ref);
      41  
      42    static TypeBoundPredicateItem error ();
      43  
      44    bool is_error () const;
      45  
      46    BaseType *get_tyty_for_receiver (const TyTy::BaseType *receiver);
      47  
      48    const Resolver::TraitItemReference *get_raw_item () const;
      49  
      50    bool needs_implementation () const;
      51  
      52    const TypeBoundPredicate *get_parent () const;
      53  
      54    Location get_locus () const;
      55  
      56  private:
      57    const TypeBoundPredicate *parent;
      58    const Resolver::TraitItemReference *trait_item_ref;
      59  };
      60  
      61  class TypeBoundsMappings
      62  {
      63  protected:
      64    TypeBoundsMappings (std::vector<TypeBoundPredicate> specified_bounds);
      65  
      66  public:
      67    std::vector<TypeBoundPredicate> &get_specified_bounds ();
      68  
      69    const std::vector<TypeBoundPredicate> &get_specified_bounds () const;
      70  
      71    size_t num_specified_bounds () const;
      72  
      73    std::string raw_bounds_as_string () const;
      74  
      75    std::string bounds_as_string () const;
      76  
      77    std::string raw_bounds_as_name () const;
      78  
      79  protected:
      80    void add_bound (TypeBoundPredicate predicate);
      81  
      82    std::vector<TypeBoundPredicate> specified_bounds;
      83  };
      84  
      85  } // namespace TyTy
      86  } // namespace Rust
      87  
      88  #endif // RUST_TYTY_BOUNDS_H