diff --git a/src/prolog/heap_iter.rs b/src/prolog/heap_iter.rs index ca0c25a1..e3780b20 100644 --- a/src/prolog/heap_iter.rs +++ b/src/prolog/heap_iter.rs @@ -84,7 +84,7 @@ impl<'a> HCPreOrderIterator<'a> { Addr::PStrLocation(h, n) => { if let HeapCellValue::PartialString(ref pstr) = &self.machine_st.heap[h] { let s = pstr.block_as_str(); - + if let Some(c) = s[n ..].chars().next() { if pstr.len() > n + c.len_utf8() { self.state_stack.push(Addr::PStrLocation(h, n + c.len_utf8())); diff --git a/src/prolog/machine/copier.rs b/src/prolog/machine/copier.rs index c9520848..1dda5d66 100644 --- a/src/prolog/machine/copier.rs +++ b/src/prolog/machine/copier.rs @@ -191,7 +191,7 @@ impl CopyTermState { let threshold = self.target.threshold(); self.target[self.scan] = - HeapCellValue::Addr(Addr::PStrLocation(threshold, n)); + HeapCellValue::Addr(Addr::PStrLocation(threshold, 0)); self.scan += 1;