Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit e9f906f

Browse files
PaoloPenazzilm98
authored andcommitted
fix: now aligned neighbors are correctly returned
1 parent fba8c89 commit e9f906f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/core/lang/lang.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn rep<A: Copy + 'static>(mut vm: RoundVM, init: impl Fn() -> A, fun: impl F
2929

3030
pub fn foldhood<A: Copy + 'static + Debug>(mut vm: RoundVM, init: impl Fn() -> A, aggr: impl Fn(A, A) -> A, expr: impl Fn(RoundVM) -> (RoundVM, A)) -> (RoundVM, A) {
3131
// here we do nest_in after retrieving the neighbours because otherwise it would disalign the device
32-
let nbrs = vm.aligned_neighbours().clone();
32+
let nbrs = vm.aligned_neighbours::<A>().clone();
3333
vm.nest_in(FoldHood(vm.index().clone()));
3434
let (vm_, preval) = expr(vm);
3535
let (mut vm__, local_init) = locally(vm_, |vm_| (vm_, init()));

src/core/path/slot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl Slot {
2929
match self {
3030
Slot::Nbr(index) => "Nbr(".to_owned() + &index.to_string() + ")",
3131
Slot::Rep(index) => "Rep(".to_owned() + &index.to_string() + ")",
32-
Slot::FoldHood(index) => "FoldHood".to_owned() + &index.to_string() + ")",
32+
Slot::FoldHood(index) => "FoldHood(".to_owned() + &index.to_string() + ")",
3333
Slot::Branch(index) => "Branch(".to_owned() + &index.to_string() + ")",
3434
Slot::Exchange(index) => "Exchange(".to_owned() + &index.to_string() + ")",
3535
}

src/core/vm/round_vm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl RoundVM {
216216
/// # Returns
217217
///
218218
/// A vector of aligned neighbor identifiers.
219-
pub fn aligned_neighbours(&self) -> Vec<i32> {
219+
pub fn aligned_neighbours<A: 'static>(&self) -> Vec<i32> {
220220
let mut tmp: Vec<i32> = Vec::new();
221221
if !self.isolated {
222222
tmp = self
@@ -226,7 +226,7 @@ impl RoundVM {
226226
.filter(|(id, _)| id.clone() != &self.self_id())
227227
.filter(|(_, export)| {
228228
self.status.path.is_root()
229-
|| export.get::<Box<dyn Any>>(&self.status.path).is_some()
229+
|| export.get::<A>(&self.status.path).is_some()
230230
})
231231
.map(|(id, _)| id.clone())
232232
.collect();
@@ -398,7 +398,7 @@ mod tests {
398398
#[test]
399399
fn test_aligned_neighbours() {
400400
let vm = round_vm_builder();
401-
assert_eq!(vm.aligned_neighbours(), vec![7, 0])
401+
assert_eq!(vm.aligned_neighbours::<i32>(), vec![7, 0])
402402
}
403403

404404
#[test]

0 commit comments

Comments
 (0)