1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// vim:fileencoding=utf-8:noet
//! Port of `powerline/lib/debug.py`.
//!
//! Upstream is a single function `print_cycles(objects, outstream,
//! show_progress)` that walks Python's GC referent graph to find
//! cyclic references — a Python-specific debugging tool relying on
//! `gc.get_referents()`, runtime introspection of `__dict__`, and
//! `id()`-based object identity.
//!
//! **Rust has no tracing garbage collector.** Cycles in Rust arise
//! only through `Rc`/`Arc` reference loops and are detected via:
//! - `Weak` references that break the strong-count cycle, OR
//! - external tools (Miri, Valgrind, address sanitizer) at debug time.
//!
//! The Python cycle-finder has no equivalent in Rust because the
//! premise — a runtime GC accumulating "garbage" objects with hidden
//! cyclic owners — does not exist. powerliners's memory model is
//! ownership + borrow checking; if a cycle compiles, it's intentional.
//!
//! This module therefore ports `print_cycles` as a documented no-op
//! that exists for upstream-API parity. Callers that exist solely to
//! invoke this fn (none in the current tree) are effectively unreachable.
// from __future__ import (unicode_literals, division, absolute_import, print_function) // py:2
// import gc // py:4
// import sys // py:5
// from types import FrameType // py:7
// from itertools import chain // py:8
/// Port of `print_cycles()` from `powerline/lib/debug.py:12`.
///
/// **Rust port is a no-op** — see module-level doc-comment for the
/// rationale. The signature is preserved for upstream API parity, but
/// the body does nothing because Rust has no tracing GC and therefore
/// no cyclic-reference graph to walk.
///
/// :param list objects: ignored (no Rust analogue of `gc.garbage`)
/// :param file outstream: ignored
/// :param bool show_progress: ignored