chiark / gitweb /
jstest: Pass lastg to ZUpdateSpec::next
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 18 Jul 2021 20:57:40 +0000 (21:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 18 Jul 2021 20:57:40 +0000 (21:57 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
jstest/jst-lower.rs

index 553039fb15051b60ee2ca6f4061aa96978561cb3..26500ab690068dc8c3b8370edf347a6b7ce6c994 100644 (file)
@@ -67,11 +67,12 @@ pub enum ZUpdateSpec {
 use ZUpdateSpec as ZUS;
 
 impl ZUpdateSpec {
-  pub fn next(&self, last: &mut zcoord::Mutable) -> ZLevel {
+  pub fn next(&self, last: &mut zcoord::Mutable, lastg: &mut Generation)
+              -> ZLevel {
     match self {
       ZUS::Auto => ZLevel {
         z: last.increment().unwrap(),
-        zg: Generation(1000),
+        zg: { lastg.increment(); *lastg },
       },
     }
   }
@@ -295,11 +296,12 @@ impl TestsAccumulator {
       if name != only { return; }
     }
     let mut zlast = ZCoord::default().clone_mut();
+    let mut zlastg = Generation(1000);
 
     let pieces: IndexMap<Vpid,StartPiece> = pieces.into_iter().map(
       |StartPieceSpec { id, pinned, moveable }| {
         let id = id.try_into().unwrap();
-        let zlevel = zupd.next(&mut zlast);
+        let zlevel = zupd.next(&mut zlast, &mut zlastg);
         (id, StartPiece { pinned, moveable, zlevel })
       }
     ).collect();