Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 15e8e70

Browse files
author
Hendrik van Antwerpen
committed
Use separate names for list of appended things, and the arena
1 parent 8acf805 commit 15e8e70

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

stack-graphs/src/cycles.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub struct AppendingCycleDetector<A> {
158158
appendages: List<A>,
159159
}
160160

161-
pub type Appendages<A> = ListArena<A>;
161+
pub type Appendables<A> = ListArena<A>;
162162

163163
impl<A: Appendable + Clone> AppendingCycleDetector<A> {
164164
pub fn new() -> Self {
@@ -167,9 +167,9 @@ impl<A: Appendable + Clone> AppendingCycleDetector<A> {
167167
}
168168
}
169169

170-
pub fn from(appendages: &mut Appendages<A>, appendage: A) -> Self {
170+
pub fn from(appendables: &mut Appendables<A>, appendage: A) -> Self {
171171
let mut result = Self::new();
172-
result.appendages.push_front(appendages, appendage);
172+
result.appendages.push_front(appendables, appendage);
173173
result
174174
}
175175

@@ -178,11 +178,11 @@ impl<A: Appendable + Clone> AppendingCycleDetector<A> {
178178
graph: &StackGraph,
179179
partials: &mut PartialPaths,
180180
ctx: &mut A::Ctx,
181-
appendages: &mut Appendages<A>,
181+
appendables: &mut Appendables<A>,
182182
appendage: A,
183183
) -> Result<(), PathResolutionError> {
184184
let end_node = appendage.end_node(ctx);
185-
self.appendages.push_front(appendages, appendage);
185+
self.appendages.push_front(appendables, appendage);
186186

187187
let mut maybe_cyclic_path = None;
188188
let mut index = self.appendages;
@@ -191,7 +191,7 @@ impl<A: Appendable + Clone> AppendingCycleDetector<A> {
191191
// find loop point
192192
let mut count = 0usize;
193193
loop {
194-
match index.pop_front(appendages) {
194+
match index.pop_front(appendables) {
195195
Some(appendage) => {
196196
count += 1;
197197
if appendage.start_node(ctx) == end_node {
@@ -205,13 +205,13 @@ impl<A: Appendable + Clone> AppendingCycleDetector<A> {
205205
// get prefix edges
206206
let mut prefix_appendages = List::empty();
207207
for _ in 0..count {
208-
let appendage = values.pop_front(appendages).unwrap();
209-
prefix_appendages.push_front(appendages, appendage.clone());
208+
let appendage = values.pop_front(appendables).unwrap();
209+
prefix_appendages.push_front(appendables, appendage.clone());
210210
}
211211

212212
// build prefix path -- prefix starts at end_node, because this is a cycle
213213
let mut prefix_path = PartialPath::from_node(graph, partials, end_node);
214-
while let Some(appendage) = prefix_appendages.pop_front(appendages) {
214+
while let Some(appendage) = prefix_appendages.pop_front(appendables) {
215215
prefix_path
216216
.resolve_to(graph, partials, appendage.start_node(ctx))
217217
.unwrap();

stack-graphs/src/partial.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use smallvec::SmallVec;
4545
use crate::arena::Deque;
4646
use crate::arena::DequeArena;
4747
use crate::arena::Handle;
48-
use crate::cycles::Appendages;
48+
use crate::cycles::Appendables;
4949
use crate::cycles::AppendingCycleDetector;
5050
use crate::cycles::SimilarPathDetector;
5151
use crate::graph::Edge;
@@ -2383,7 +2383,7 @@ impl PartialPath {
23832383
graph: &StackGraph,
23842384
partials: &mut PartialPaths,
23852385
file: Handle<File>,
2386-
edges: &mut Appendages<Edge>,
2386+
edges: &mut Appendables<Edge>,
23872387
path_cycle_detector: AppendingCycleDetector<Edge>,
23882388
result: &mut R,
23892389
) {
@@ -2700,7 +2700,7 @@ impl PartialPaths {
27002700
copious_debugging!("Find all partial paths in {}", graph[file]);
27012701
let mut similar_path_detector = SimilarPathDetector::new();
27022702
let mut queue = VecDeque::new();
2703-
let mut edges = Appendages::new();
2703+
let mut edges = Appendables::new();
27042704
queue.extend(
27052705
graph
27062706
.nodes_for_file(file)

stack-graphs/src/stitching.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use crate::arena::List;
4848
use crate::arena::ListArena;
4949
use crate::arena::ListCell;
5050
use crate::arena::SupplementalArena;
51-
use crate::cycles::Appendages;
51+
use crate::cycles::Appendables;
5252
use crate::cycles::AppendingCycleDetector;
5353
use crate::cycles::SimilarPathDetector;
5454
use crate::graph::Node;
@@ -726,7 +726,7 @@ pub struct ForwardPartialPathStitcher {
726726
VecDeque<PartialPath>,
727727
VecDeque<AppendingCycleDetector<OwnedOrDatabasePath>>,
728728
),
729-
appended_paths: Appendages<OwnedOrDatabasePath>,
729+
appended_paths: Appendables<OwnedOrDatabasePath>,
730730
similar_path_detector: SimilarPathDetector<PartialPath>,
731731
max_work_per_phase: usize,
732732
#[cfg(feature = "copious-debugging")]
@@ -776,7 +776,7 @@ impl ForwardPartialPathStitcher {
776776
);
777777
}
778778
}
779-
let mut appended_paths = Appendages::new();
779+
let mut appended_paths = Appendables::new();
780780
let next_iteration = candidate_partial_paths
781781
.iter()
782782
.copied()
@@ -817,7 +817,7 @@ impl ForwardPartialPathStitcher {
817817
_db: &mut Database,
818818
initial_partial_paths: Vec<PartialPath>,
819819
) -> ForwardPartialPathStitcher {
820-
let mut appended_paths = Appendages::new();
820+
let mut appended_paths = Appendables::new();
821821
let next_iteration = initial_partial_paths
822822
.into_iter()
823823
.map(|p| {

stack-graphs/tests/it/cycles.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Please see the LICENSE-APACHE or LICENSE-MIT files in this distribution for license details.
66
// ------------------------------------------------------------------------------------------------
77

8-
use stack_graphs::cycles::Appendages;
8+
use stack_graphs::cycles::Appendables;
99
use stack_graphs::cycles::AppendingCycleDetector;
1010
use stack_graphs::graph::StackGraph;
1111
use stack_graphs::partial::PartialPaths;
@@ -147,7 +147,7 @@ fn finding_simple_identity_cycle_is_detected() {
147147

148148
// test edge cycle detector
149149
{
150-
let mut edges = Appendages::new();
150+
let mut edges = Appendables::new();
151151
let mut cd = AppendingCycleDetector::new();
152152
let ctx = &mut ();
153153
assert!(cd
@@ -198,7 +198,7 @@ fn stitching_simple_identity_cycle_is_detected() {
198198

199199
// test partial path cycle detector
200200
{
201-
let mut paths = Appendages::new();
201+
let mut paths = Appendables::new();
202202
let mut cd: AppendingCycleDetector<OwnedOrDatabasePath> =
203203
AppendingCycleDetector::from(&mut paths, p0.into());
204204
assert!(cd
@@ -228,7 +228,7 @@ fn finding_composite_identity_cycle_is_detected() {
228228

229229
// test edge cycle detector
230230
{
231-
let mut edges = Appendages::new();
231+
let mut edges = Appendables::new();
232232
let mut cd = AppendingCycleDetector::new();
233233
let ctx = &mut ();
234234
assert!(cd
@@ -303,7 +303,7 @@ fn stitching_composite_identity_cycle_is_detected() {
303303

304304
// test joining cycle detector
305305
{
306-
let mut paths = Appendages::new();
306+
let mut paths = Appendables::new();
307307
let mut cd: AppendingCycleDetector<OwnedOrDatabasePath> =
308308
AppendingCycleDetector::from(&mut paths, p0.into());
309309
assert!(cd

0 commit comments

Comments
 (0)