guix_mirror_bot pushed a commit to branch rust-team
in repository guix.

commit 5ff1363e408fda047aceb54e00fc7f1d56f2f132
Author: Efraim Flashner <[email protected]>
AuthorDate: Wed Oct 28 13:26:03 2026 +0200

    gnu: scryer-prolog: Fix build with newer rust.
    
    * gnu/packages/prolog.scm (scryer-prolog)[patches]: Add patch.
    * gnu/packages/patches/scryer-prolog-compat-newer-rust.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                       |   1 +
 .../patches/scryer-prolog-compat-newer-rust.patch  | 112 +++++++++++++++++++++
 gnu/packages/prolog.scm                            |   4 +-
 3 files changed, 116 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index a10db257223..d785109e0c5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2549,6 +2549,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/seq24-rename-mutex.patch                        \
   %D%/packages/patches/libsequoia-fix-ffi-Makefile.patch       \
   %D%/packages/patches/libsequoia-remove-store.patch           \
+  %D%/packages/patches/scryer-prolog-compat-newer-rust.patch   \
   %D%/packages/patches/shared-mime-info-xdgmime-path.patch     \
   %D%/packages/patches/sharutils-CVE-2018-1000097.patch                \
   %D%/packages/patches/showtime-python-3.11-compat.patch        \
diff --git a/gnu/packages/patches/scryer-prolog-compat-newer-rust.patch 
b/gnu/packages/patches/scryer-prolog-compat-newer-rust.patch
new file mode 100644
index 00000000000..0c4b88104a8
--- /dev/null
+++ b/gnu/packages/patches/scryer-prolog-compat-newer-rust.patch
@@ -0,0 +1,112 @@
+Added as suggested by upstream
+https://github.com/mthom/scryer-prolog/issues/3402
+
+From 6ec8c9064f53fb6c308cdcb547c83057ee0bf65e Mon Sep 17 00:00:00 2001
+From: Skgland <[email protected]>
+Date: Thu, 20 Nov 2025 23:08:46 +0100
+Subject: [PATCH] fix pstr_iter_tests test
+
+---
+ src/machine/heap.rs           | 11 +----------
+ src/machine/partial_string.rs | 18 ++++++++++--------
+ 2 files changed, 11 insertions(+), 18 deletions(-)
+
+diff --git a/src/machine/heap.rs b/src/machine/heap.rs
+index c812b30bf..d9f1aa88c 100644
+--- a/src/machine/heap.rs
++++ b/src/machine/heap.rs
+@@ -687,16 +687,7 @@ impl Heap {
+     }
+ 
+     pub(crate) fn clear(&mut self) {
+-        unsafe {
+-            let layout =
+-                alloc::Layout::from_size_align(self.inner.byte_cap, 
size_of::<HeapCellValue>())
+-                    .unwrap();
+-            alloc::dealloc(self.inner.ptr, layout);
+-        }
+-
+-        self.inner.ptr = ptr::null_mut();
+-        self.inner.byte_len = 0;
+-        self.inner.byte_cap = 0;
++        *self = Heap::new();
+     }
+ 
+     pub(crate) fn store_resource_error(&mut self) {
+diff --git a/src/machine/partial_string.rs b/src/machine/partial_string.rs
+index 977c421c5..80c3c9af8 100644
+--- a/src/machine/partial_string.rs
++++ b/src/machine/partial_string.rs
+@@ -217,6 +217,8 @@ mod test {
+     fn pstr_iter_tests() {
+         let mut wam = MockWAM::new();
+ 
++        let init_len = wam.machine_st.heap.cell_len();
++
+         let pstr_cell = wam.machine_st.heap.allocate_pstr("abc ").unwrap();
+         wam.machine_st
+             .heap
+@@ -233,7 +235,7 @@ mod test {
+             assert_eq!(
+                 iter.next(),
+                 Some(PStrIteratee::PStrSlice {
+-                    slice_loc: heap_index!(1),
++                    slice_loc: heap_index!(init_len),
+                     slice_len: "abc ".len()
+                 }),
+             );
+@@ -241,9 +243,9 @@ mod test {
+             assert!(!iter.is_cyclic());
+         }
+ 
+-        assert_eq!(wam.machine_st.heap[2], empty_list_as_cell!());
++        assert_eq!(wam.machine_st.heap[init_len + 1], empty_list_as_cell!());
+ 
+-        wam.machine_st.heap[2] = pstr_loc_as_cell!(heap_index!(3));
++        wam.machine_st.heap[init_len + 1] = 
pstr_loc_as_cell!(heap_index!(init_len + 2));
+ 
+         wam.machine_st.heap.allocate_pstr("def").unwrap();
+         let h = wam.machine_st.heap.cell_len();
+@@ -256,14 +258,14 @@ mod test {
+             assert_eq!(
+                 iter.next(),
+                 Some(PStrIteratee::PStrSlice {
+-                    slice_loc: heap_index!(1),
++                    slice_loc: heap_index!(init_len),
+                     slice_len: "abc ".len()
+                 })
+             );
+             assert_eq!(
+                 iter.next(),
+                 Some(PStrIteratee::PStrSlice {
+-                    slice_loc: heap_index!(3),
++                    slice_loc: heap_index!(init_len + 2),
+                     slice_len: "def".len(),
+                 })
+             );
+@@ -282,14 +284,14 @@ mod test {
+             assert_eq!(
+                 iter.next(),
+                 Some(PStrIteratee::PStrSlice {
+-                    slice_loc: heap_index!(1),
++                    slice_loc: heap_index!(init_len),
+                     slice_len: "abc ".len()
+                 })
+             );
+             assert_eq!(
+                 iter.next(),
+                 Some(PStrIteratee::PStrSlice {
+-                    slice_loc: heap_index!(3),
++                    slice_loc: heap_index!(init_len + 2),
+                     slice_len: "def".len(),
+                 })
+             );
+@@ -298,7 +300,7 @@ mod test {
+             assert!(!iter.is_cyclic());
+         }
+ 
+-        wam.machine_st.heap[h] = pstr_loc_as_cell!(heap_index!(3));
++        wam.machine_st.heap[h] = pstr_loc_as_cell!(heap_index!(init_len + 2));
+ 
+         {
+             let mut iter = HeapPStrIter::new(&wam.machine_st.heap, 0);
diff --git a/gnu/packages/prolog.scm b/gnu/packages/prolog.scm
index 1ca7f240007..7c666fdb4ab 100644
--- a/gnu/packages/prolog.scm
+++ b/gnu/packages/prolog.scm
@@ -31,6 +31,7 @@
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix utils)
+  #:use-module (gnu packages)
   #:use-module (gnu packages backup)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
@@ -106,7 +107,8 @@ manner.  It also features an interactive interpreter.")
        (uri (crate-uri "scryer-prolog" version))
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "08sn216bcwjx8y62pl3idfjpc1kxw0p0kq5zj3ydpjnnm0gmn03i"))))
+        (base32 "08sn216bcwjx8y62pl3idfjpc1kxw0p0kq5zj3ydpjnnm0gmn03i"))
+       (patches (search-patches "scryer-prolog-compat-newer-rust.patch"))))
     (build-system cargo-build-system)
     (arguments
      (list #:install-source? #f

Reply via email to