Debian Codegraph @

gcc/rust/typecheck/rust-tyty-bounds.h

raw
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 #ifndef RUST_TYTY_BOUNDS_H
20 #define RUST_TYTY_BOUNDS_H
21
22 #include "rust-location.h"
23 #include "rust-mapping-common.h"
24
25 namespace Rust {
26
27 namespace Resolver {
28 class TraitReference;
29 class TraitItemReference;
30 class AssociatedImplTrait;
31 } // namespace Resolver
32
33 namespace TyTy {
34
35 class BaseType;
36 class TypeBoundPredicate;
37 class TypeBoundsMappings
38 {
39 protected:
40 TypeBoundsMappings (std::vector<TypeBoundPredicate> specified_bounds);
41
42 public:
43 std::vector<TypeBoundPredicate> &get_specified_bounds ();
44
45 const std::vector<TypeBoundPredicate> &get_specified_bounds () const;
46
47 TypeBoundPredicate lookup_predicate (DefId id);
48
49 size_t num_specified_bounds () const;
50
51 std::string raw_bounds_as_string () const;
52
53 std::string bounds_as_string () const;
54
55 std::string raw_bounds_as_name () const;
56
57 protected:
58 void add_bound (TypeBoundPredicate predicate);
59
60 std::vector<TypeBoundPredicate> specified_bounds;
61 };
62
63 } // namespace TyTy
64 } // namespace Rust
65
66 #endif // RUST_TYTY_BOUNDS_H