From f4d2839dc780023952809b8d7dcccb71df8ce239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Arroyo=20Calle?= Date: Mon, 27 May 2024 19:52:02 +0200 Subject: [PATCH 1/4] Fix warnings of dead code --- src/machine/machine_indices.rs | 2 -- src/machine/unify.rs | 24 ------------------------ 2 files changed, 26 deletions(-) diff --git a/src/machine/machine_indices.rs b/src/machine/machine_indices.rs index 830cc91f2..856c7766b 100644 --- a/src/machine/machine_indices.rs +++ b/src/machine/machine_indices.rs @@ -18,8 +18,6 @@ use std::collections::BTreeSet; use std::ops::{Deref, DerefMut}; use crate::types::*; -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub(crate) struct OrderedOpDirKey(pub(crate) Atom, pub(crate) Fixity); // 7.2 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] diff --git a/src/machine/unify.rs b/src/machine/unify.rs index b045552b8..7cd3df06f 100644 --- a/src/machine/unify.rs +++ b/src/machine/unify.rs @@ -453,30 +453,6 @@ pub(crate) trait Unifier: DerefMut { } } - fn unify_big_num(&mut self, n1: TypedArenaPtr, value: HeapCellValue) - where - N: PartialEq + PartialEq + PartialEq + ArenaAllocated, - { - if let Some(r) = value.as_var() { - Self::bind(self, r, typed_arena_ptr_as_cell!(n1)); - return; - } - - match Number::try_from(value) { - Ok(n2) => match n2 { - Number::Fixnum(n2) if *n1 == n2.get_num() => {} - Number::Integer(n2) if *n1 == *n2 => {} - Number::Rational(n2) if *n1 == *n2 => {} - _ => { - self.fail = true; - } - }, - Err(_) => { - self.fail = true; - } - } - } - fn unify_big_integer(&mut self, n1: TypedArenaPtr, value: HeapCellValue) { if let Some(r) = value.as_var() { Self::bind(self, r, typed_arena_ptr_as_cell!(n1)); From 80a0cab6ab5454a287e2669257e40d1ee0341b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Tue, 28 May 2024 19:34:26 +0200 Subject: [PATCH 2/4] re-add CI job to test Cargo.toml rust-version was removed in #2393 instead of being updated, see - https://github.com/mthom/scryer-prolog/pull/2393#discussion_r1585963855 and - https://github.com/mthom/scryer-prolog/commit/79bc2d9c68da2257a94eb22ef8717a304173e344#commitcomment-141790142 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bbf50b6f..9a9b09228 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,8 @@ jobs: - { os: ubuntu-22.04, rust-version: stable, target: 'i686-unknown-linux-gnu', publish: true } # FIXME(issue #2138): run wasm tests, failing to run since https://github.com/mthom/scryer-prolog/pull/2137 removed wasm-pack - { os: ubuntu-22.04, rust-version: nightly, target: 'wasm32-unknown-unknown', publish: true, args: '--no-default-features' , test-args: '--no-run --no-default-features' } + # Cargo.toml rust-version + - { os: ubuntu-22.04, rust-version: "1.77", target: 'x86_64-unknown-linux-gnu'} # rust versions - { os: ubuntu-22.04, rust-version: beta, target: 'x86_64-unknown-linux-gnu'} - { os: ubuntu-22.04, rust-version: nightly, target: 'x86_64-unknown-linux-gnu'} From 1a9d10d298a998e97b1714d40bdad09e9ca3b925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Tue, 28 May 2024 19:59:32 +0200 Subject: [PATCH 3/4] fix two clippy lints --- src/machine/streams.rs | 13 ++++++------- src/parser/parser.rs | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/machine/streams.rs b/src/machine/streams.rs index c2adb47e3..be5591cf1 100644 --- a/src/machine/streams.rs +++ b/src/machine/streams.rs @@ -24,7 +24,6 @@ use std::io; #[cfg(feature = "http")] use std::io::BufRead; use std::io::{Cursor, ErrorKind, Read, Seek, SeekFrom, Write}; -use std::mem; use std::net::{Shutdown, TcpStream}; use std::ops::{Deref, DerefMut}; use std::path::PathBuf; @@ -296,9 +295,9 @@ impl Read for HttpReadStream { #[cfg(feature = "http")] pub struct HttpWriteStream { status_code: u16, - headers: mem::ManuallyDrop, + headers: std::mem::ManuallyDrop, response: TypedArenaPtr, - buffer: mem::ManuallyDrop>, + buffer: std::mem::ManuallyDrop>, } #[cfg(feature = "http")] @@ -325,8 +324,8 @@ impl Write for HttpWriteStream { #[cfg(feature = "http")] impl HttpWriteStream { fn drop(&mut self) { - let headers = unsafe { mem::ManuallyDrop::take(&mut self.headers) }; - let buffer = unsafe { mem::ManuallyDrop::take(&mut self.buffer) }; + let headers = unsafe { std::mem::ManuallyDrop::take(&mut self.headers) }; + let buffer = unsafe { std::mem::ManuallyDrop::take(&mut self.buffer) }; let (ready, response, cvar) = &**self.response; @@ -1228,8 +1227,8 @@ impl Stream { StreamLayout::new(CharReader::new(HttpWriteStream { response, status_code, - headers: mem::ManuallyDrop::new(headers), - buffer: mem::ManuallyDrop::new(Vec::new()), + headers: std::mem::ManuallyDrop::new(headers), + buffer: std::mem::ManuallyDrop::new(Vec::new()), })), arena )) diff --git a/src/parser/parser.rs b/src/parser/parser.rs index 47e829219..c4d509b4e 100644 --- a/src/parser/parser.rs +++ b/src/parser/parser.rs @@ -109,7 +109,7 @@ pub(crate) fn as_partial_string( tail_ref = succ; } Term::PartialString(_, pstr, tail) => { - string += &pstr; + string += pstr; tail_ref = tail; } Term::CompleteString(_, cstr) => { From 45a8a7bb318e3a3bea4b7c977eda56013913f5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Wed, 29 May 2024 19:50:27 +0200 Subject: [PATCH 4/4] create swap file for wasm32 build --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a9b09228..0d0ce4ad7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: - { os: ubuntu-22.04, rust-version: stable, target: 'x86_64-unknown-linux-gnu', publish: true } - { os: ubuntu-22.04, rust-version: stable, target: 'i686-unknown-linux-gnu', publish: true } # FIXME(issue #2138): run wasm tests, failing to run since https://github.com/mthom/scryer-prolog/pull/2137 removed wasm-pack - - { os: ubuntu-22.04, rust-version: nightly, target: 'wasm32-unknown-unknown', publish: true, args: '--no-default-features' , test-args: '--no-run --no-default-features' } + - { os: ubuntu-22.04, rust-version: nightly, target: 'wasm32-unknown-unknown', publish: true, args: '--no-default-features' , test-args: '--no-run --no-default-features', use_swap: true } # Cargo.toml rust-version - { os: ubuntu-22.04, rust-version: "1.77", target: 'x86_64-unknown-linux-gnu'} # rust versions @@ -56,6 +56,10 @@ jobs: shell: bash steps: - uses: actions/checkout@v3 + - uses: actionhippie/swap-space@v1 + if: matrix.use_swap + with: + size: 10G - name: Setup Rust uses: ./.github/actions/setup-rust with: