@@ -108,92 +108,24 @@ class TypeBoundPredicateItem
108
108
const Resolver::TraitItemReference *trait_item_ref;
109
109
};
110
110
111
- class TypeBoundPredicate
112
- {
113
- public:
114
- TypeBoundPredicate (DefId reference, Location locus)
115
- : reference (reference), locus (locus), args (nullptr )
116
- {}
117
-
118
- std::string as_string () const ;
119
-
120
- const Resolver::TraitReference *get () const ;
121
-
122
- Location get_locus () const { return locus; }
123
-
124
- std::string get_name () const ;
125
-
126
- // check that this predicate is object-safe see:
127
- // https://doc.rust-lang.org/reference/items/traits.html#object-safety
128
- bool is_object_safe (bool emit_error, Location locus) const ;
129
-
130
- void apply_generic_arguments (HIR::GenericArgs *generic_args);
131
-
132
- bool contains_item (const std::string &search) const ;
133
-
134
- TypeBoundPredicateItem
135
- lookup_associated_item (const std::string &search) const ;
136
-
137
- HIR::GenericArgs *get_generic_args () { return args; }
138
-
139
- const HIR::GenericArgs *get_generic_args () const { return args; }
140
-
141
- bool has_generic_args () const
142
- {
143
- if (args == nullptr )
144
- return false ;
145
-
146
- return args->has_generic_args ();
147
- }
148
-
149
- private:
150
- DefId reference;
151
- Location locus;
152
- HIR::GenericArgs *args;
153
- };
154
-
155
111
class TypeBoundsMappings
156
112
{
157
113
protected:
158
- TypeBoundsMappings (std::vector<TypeBoundPredicate> specified_bounds)
159
- : specified_bounds (specified_bounds)
160
- {}
114
+ TypeBoundsMappings (std::vector<TypeBoundPredicate> specified_bounds);
161
115
162
116
public:
163
- std::vector<TypeBoundPredicate> &get_specified_bounds ()
164
- {
165
- return specified_bounds;
166
- }
117
+ std::vector<TypeBoundPredicate> &get_specified_bounds ();
167
118
168
- const std::vector<TypeBoundPredicate> &get_specified_bounds () const
169
- {
170
- return specified_bounds;
171
- }
119
+ const std::vector<TypeBoundPredicate> &get_specified_bounds () const ;
172
120
173
- size_t num_specified_bounds () const { return specified_bounds. size (); }
121
+ size_t num_specified_bounds () const ;
174
122
175
- std::string raw_bounds_as_string () const
176
- {
177
- std::string buf;
178
- for (size_t i = 0 ; i < specified_bounds.size (); i++)
179
- {
180
- const TypeBoundPredicate &b = specified_bounds.at (i);
181
- bool has_next = (i + 1 ) < specified_bounds.size ();
182
- buf += b.get_name () + (has_next ? " + " : " " );
183
- }
184
- return buf;
185
- }
123
+ std::string raw_bounds_as_string () const ;
186
124
187
- std::string bounds_as_string () const
188
- {
189
- return " bounds:[" + raw_bounds_as_string () + " ]" ;
190
- }
125
+ std::string bounds_as_string () const ;
191
126
192
127
protected:
193
- void add_bound (TypeBoundPredicate predicate)
194
- {
195
- specified_bounds.push_back (predicate);
196
- }
128
+ void add_bound (TypeBoundPredicate predicate);
197
129
198
130
std::vector<TypeBoundPredicate> specified_bounds;
199
131
};
@@ -1007,6 +939,48 @@ class SubstitutionRef
1007
939
SubstitutionArgumentMappings used_arguments;
1008
940
};
1009
941
942
+ class TypeBoundPredicate
943
+ {
944
+ public:
945
+ TypeBoundPredicate (DefId reference, Location locus);
946
+
947
+ std::string as_string () const ;
948
+
949
+ const Resolver::TraitReference *get () const ;
950
+
951
+ Location get_locus () const { return locus; }
952
+
953
+ std::string get_name () const ;
954
+
955
+ // check that this predicate is object-safe see:
956
+ // https://doc.rust-lang.org/reference/items/traits.html#object-safety
957
+ bool is_object_safe (bool emit_error, Location locus) const ;
958
+
959
+ void apply_generic_arguments (HIR::GenericArgs *generic_args);
960
+
961
+ bool contains_item (const std::string &search) const ;
962
+
963
+ TypeBoundPredicateItem
964
+ lookup_associated_item (const std::string &search) const ;
965
+
966
+ HIR::GenericArgs *get_generic_args () { return args; }
967
+
968
+ const HIR::GenericArgs *get_generic_args () const { return args; }
969
+
970
+ bool has_generic_args () const
971
+ {
972
+ if (args == nullptr )
973
+ return false ;
974
+
975
+ return args->has_generic_args ();
976
+ }
977
+
978
+ private:
979
+ DefId reference;
980
+ Location locus;
981
+ HIR::GenericArgs *args;
982
+ };
983
+
1010
984
// https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.VariantDef.html
1011
985
class VariantDef
1012
986
{
0 commit comments