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