cleanup
- fix some warnings and mark others as expected - make use of the msrv bump to 1.93.1 and cleanup compat and workarounds
This commit is contained in:
2
.github/actions/setup-rust/cleanup.sh
vendored
2
.github/actions/setup-rust/cleanup.sh
vendored
@@ -4,7 +4,7 @@ set -e
|
|||||||
echo Cleanup workspace build artifacts and extra target output
|
echo Cleanup workspace build artifacts and extra target output
|
||||||
|
|
||||||
# clean just the direct members of the current workspace, use cargo metadata to generalize to all rust projects
|
# clean just the direct members of the current workspace, use cargo metadata to generalize to all rust projects
|
||||||
cargo clean -p `cargo metadata --no-deps --offline --format-version 1 | jq -r '[.workspace_members[]|split(" ")|.[0]]|join(" ")'`
|
cargo clean --workspace
|
||||||
|
|
||||||
# remove directories in /target/ that are not named `debug` or `release`
|
# remove directories in /target/ that are not named `debug` or `release`
|
||||||
before=`du -s target | awk '{print $1}'`
|
before=`du -s target | awk '{print $1}'`
|
||||||
|
|||||||
@@ -37,13 +37,15 @@ http = ["dep:warp", "dep:reqwest"]
|
|||||||
crypto-inpure = ["dep:ring"]
|
crypto-inpure = ["dep:ring"]
|
||||||
crypto-full = ["crypto-inpure"]
|
crypto-full = ["crypto-inpure"]
|
||||||
|
|
||||||
|
[lints.clippy]
|
||||||
|
collapsible_match = "allow"
|
||||||
|
|
||||||
[lints.rust]
|
[lints.rust]
|
||||||
unexpected_cfgs = { level = "deny", check-cfg = [
|
unexpected_cfgs = { level = "deny", check-cfg = [
|
||||||
'cfg(rust_version, values("1.87.0"))',
|
'cfg(rust_version, values("1.87.0"))',
|
||||||
] }
|
] }
|
||||||
function_casts_as_integer = "deny"
|
function_casts_as_integer = "deny"
|
||||||
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
proc-macro2 = "1.0.86"
|
proc-macro2 = "1.0.86"
|
||||||
quote = "1.0.36"
|
quote = "1.0.36"
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ use ordered_float::OrderedFloat;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
use std::io::PipeReader;
|
||||||
|
use std::io::PipeWriter;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::mem::ManuallyDrop;
|
use std::mem::ManuallyDrop;
|
||||||
use std::net::TcpListener;
|
use std::net::TcpListener;
|
||||||
@@ -22,8 +24,6 @@ use std::ptr;
|
|||||||
use std::ptr::addr_of_mut;
|
use std::ptr::addr_of_mut;
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
use crate::machine::streams::{PipeReader, PipeWriter};
|
|
||||||
|
|
||||||
macro_rules! arena_alloc {
|
macro_rules! arena_alloc {
|
||||||
($e:expr, $arena:expr) => {{
|
($e:expr, $arena:expr) => {{
|
||||||
let result = $e;
|
let result = $e;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ impl BranchCodeStack {
|
|||||||
settings.trust_me()
|
settings.trust_me()
|
||||||
});
|
});
|
||||||
|
|
||||||
combined_code.extend(code.into_iter());
|
combined_code.extend(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1236,7 +1236,7 @@ impl CodeGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.skeleton.clauses.push_back(clause_index_info);
|
self.skeleton.clauses.push_back(clause_index_info);
|
||||||
code.extend(clause_code.into_iter());
|
code.extend(clause_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
let index_code = if clauses_len > 1 || self.settings.is_extensible {
|
let index_code = if clauses_len > 1 || self.settings.is_extensible {
|
||||||
@@ -1313,7 +1313,7 @@ impl CodeGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code.extend(code_segment.into_iter());
|
code.extend(code_segment);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(code)
|
Ok(code)
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ pub mod wasm;
|
|||||||
/// The entry point for the Scryer Prolog CLI.
|
/// The entry point for the Scryer Prolog CLI.
|
||||||
pub fn run_binary() -> std::process::ExitCode {
|
pub fn run_binary() -> std::process::ExitCode {
|
||||||
use crate::atom_table::Atom;
|
use crate::atom_table::Atom;
|
||||||
|
|
||||||
|
#[cfg(feature = "repl")]
|
||||||
use crate::machine::INTERRUPT;
|
use crate::machine::INTERRUPT;
|
||||||
|
|
||||||
#[cfg(feature = "repl")]
|
#[cfg(feature = "repl")]
|
||||||
|
|||||||
@@ -247,7 +247,8 @@ impl<T: CopierTarget> CopyTermState<T> {
|
|||||||
self.trail
|
self.trail
|
||||||
.push((TrailRef::pstr_loc(pstr_loc_idx), old_cell));
|
.push((TrailRef::pstr_loc(pstr_loc_idx), old_cell));
|
||||||
|
|
||||||
let old_tail_idx = if (pstr_loc + offset + 1) % Heap::heap_cell_alignment() == 0 {
|
let old_tail_idx =
|
||||||
|
if (pstr_loc + offset + 1).is_multiple_of(Heap::heap_cell_alignment()) {
|
||||||
cell_index!(pstr_loc + offset) + 2
|
cell_index!(pstr_loc + offset) + 2
|
||||||
} else {
|
} else {
|
||||||
cell_index!(pstr_loc + offset) + 1
|
cell_index!(pstr_loc + offset) + 1
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ impl VariableClassifier {
|
|||||||
|
|
||||||
let first_branch_num = Arc::new(self.current_branch_num.split());
|
let first_branch_num = Arc::new(self.current_branch_num.split());
|
||||||
let branches: Vec<_> = std::iter::once(head)
|
let branches: Vec<_> = std::iter::once(head)
|
||||||
.chain(unfold_by_str(tail, atom!(";")).into_iter())
|
.chain(unfold_by_str(tail, atom!(";")))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut branch_numbers = vec![first_branch_num];
|
let mut branch_numbers = vec![first_branch_num];
|
||||||
@@ -571,7 +571,7 @@ impl VariableClassifier {
|
|||||||
self.current_branch_num.halve_delta(),
|
self.current_branch_num.halve_delta(),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
let iter = branches.into_iter().zip(branch_numbers.into_iter());
|
let iter = branches.into_iter().zip(branch_numbers);
|
||||||
let final_disjunct_loc = state_stack.len();
|
let final_disjunct_loc = state_stack.len();
|
||||||
|
|
||||||
for (term, branch_num) in iter.rev() {
|
for (term, branch_num) in iter.rev() {
|
||||||
|
|||||||
@@ -577,7 +577,7 @@ impl Heap {
|
|||||||
// takes a heap index, returns a cell index
|
// takes a heap index, returns a cell index
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn pstr_tail_idx(pstr_zero_byte_loc: usize) -> usize {
|
pub const fn pstr_tail_idx(pstr_zero_byte_loc: usize) -> usize {
|
||||||
if (pstr_zero_byte_loc + 1) % Heap::heap_cell_alignment() == 0 {
|
if (pstr_zero_byte_loc + 1).is_multiple_of(Heap::heap_cell_alignment()) {
|
||||||
cell_index!(pstr_zero_byte_loc) + 2
|
cell_index!(pstr_zero_byte_loc) + 2
|
||||||
} else {
|
} else {
|
||||||
cell_index!(pstr_zero_byte_loc) + 1
|
cell_index!(pstr_zero_byte_loc) + 1
|
||||||
|
|||||||
@@ -937,6 +937,7 @@ impl Permission {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
#[cfg_attr(not(feature = "ffi"), expect(dead_code))]
|
||||||
pub(crate) enum DomainErrorType {
|
pub(crate) enum DomainErrorType {
|
||||||
IOMode,
|
IOMode,
|
||||||
NotLessThanZero,
|
NotLessThanZero,
|
||||||
@@ -987,6 +988,7 @@ impl DomainErrorType {
|
|||||||
|
|
||||||
// from 7.12.2 f) of 13211-1:1995
|
// from 7.12.2 f) of 13211-1:1995
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
#[cfg_attr(not(feature = "ffi"), expect(dead_code))]
|
||||||
pub(crate) enum RepFlag {
|
pub(crate) enum RepFlag {
|
||||||
Character,
|
Character,
|
||||||
CharacterCode,
|
CharacterCode,
|
||||||
@@ -1178,6 +1180,7 @@ impl MachineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(not(feature = "ffi"), expect(dead_code))]
|
||||||
pub enum ExistenceError {
|
pub enum ExistenceError {
|
||||||
Module(Atom),
|
Module(Atom),
|
||||||
ModuleSource(ModuleSource),
|
ModuleSource(ModuleSource),
|
||||||
|
|||||||
@@ -548,8 +548,7 @@ impl MachineState {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use strict_add once msrv is >= 1.91.0
|
self.cwil.global_count = self.cwil.global_count.strict_add(1);
|
||||||
self.cwil.global_count = self.cwil.global_count.checked_add(1).unwrap();
|
|
||||||
|
|
||||||
if let Some(&(ref limit, block)) = self.cwil.limits.last() {
|
if let Some(&(ref limit, block)) = self.cwil.limits.last() {
|
||||||
if self.cwil.local_count == *limit {
|
if self.cwil.local_count == *limit {
|
||||||
@@ -651,7 +650,7 @@ impl MachineState {
|
|||||||
mut var_list: Vec<(VarKey, HeapCellValue, usize)>,
|
mut var_list: Vec<(VarKey, HeapCellValue, usize)>,
|
||||||
singleton_heap_list: HeapCellValue,
|
singleton_heap_list: HeapCellValue,
|
||||||
) -> CallResult {
|
) -> CallResult {
|
||||||
var_list.sort_by(|(_, _, idx_1), (_, _, idx_2)| idx_1.cmp(idx_2));
|
var_list.sort_by_key(|(_, _, idx_1)| *idx_1);
|
||||||
|
|
||||||
let singleton_addr = self.registers[3];
|
let singleton_addr = self.registers[3];
|
||||||
unify_fn!(*self, singleton_heap_list, singleton_addr);
|
unify_fn!(*self, singleton_heap_list, singleton_addr);
|
||||||
@@ -1128,8 +1127,7 @@ impl CWIL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn add_limit(&mut self, mut limit: u128, block: usize) -> u128 {
|
pub(crate) fn add_limit(&mut self, mut limit: u128, block: usize) -> u128 {
|
||||||
// use strict_add once msrv is >= 1.91.0
|
limit = limit.strict_add(self.local_count);
|
||||||
limit = limit.checked_add(self.local_count).unwrap();
|
|
||||||
|
|
||||||
match self.limits.last() {
|
match self.limits.last() {
|
||||||
Some((ref inner_limit, _)) if *inner_limit <= limit => {}
|
Some((ref inner_limit, _)) if *inner_limit <= limit => {}
|
||||||
|
|||||||
@@ -195,8 +195,7 @@ impl Stack {
|
|||||||
// exposed provenance, we need to expose the provenance here, even though we don't
|
// exposed provenance, we need to expose the provenance here, even though we don't
|
||||||
// actually use the value for anything. This is a reminder that `expose_provenance`
|
// actually use the value for anything. This is a reminder that `expose_provenance`
|
||||||
// isn't just a cast from a pointer to an integer but has actual side effects.
|
// isn't just a cast from a pointer to an integer but has actual side effects.
|
||||||
// FIXME(msrv) remove the as_ptr() call once MSRV reaches 1.89.0
|
cell_ptr.expose_provenance();
|
||||||
cell_ptr.as_ptr().expose_provenance();
|
|
||||||
|
|
||||||
offset += mem::size_of::<HeapCellValue>();
|
offset += mem::size_of::<HeapCellValue>();
|
||||||
}
|
}
|
||||||
@@ -228,8 +227,7 @@ impl Stack {
|
|||||||
// exposed provenance, we need to expose the provenance here, even though we don't
|
// exposed provenance, we need to expose the provenance here, even though we don't
|
||||||
// actually use the value for anything. This is a reminder that `expose_provenance`
|
// actually use the value for anything. This is a reminder that `expose_provenance`
|
||||||
// isn't just a cast from a pointer to an integer but has actual side effects.
|
// isn't just a cast from a pointer to an integer but has actual side effects.
|
||||||
// FIXME(msrv) remove as_ptr() call once msrv reaches 1.89.0
|
cell_ptr.expose_provenance();
|
||||||
cell_ptr.as_ptr().expose_provenance();
|
|
||||||
|
|
||||||
offset += mem::size_of::<HeapCellValue>();
|
offset += mem::size_of::<HeapCellValue>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ use std::fmt::Debug;
|
|||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
use std::io::PipeReader;
|
||||||
|
use std::io::PipeWriter;
|
||||||
use std::io::{Cursor, ErrorKind, Read, Seek, SeekFrom, Write};
|
use std::io::{Cursor, ErrorKind, Read, Seek, SeekFrom, Write};
|
||||||
use std::mem::ManuallyDrop;
|
use std::mem::ManuallyDrop;
|
||||||
use std::net::{Shutdown, TcpStream};
|
use std::net::{Shutdown, TcpStream};
|
||||||
@@ -38,9 +40,6 @@ use native_tls::TlsStream;
|
|||||||
#[cfg(feature = "http")]
|
#[cfg(feature = "http")]
|
||||||
use warp::hyper;
|
use warp::hyper;
|
||||||
|
|
||||||
mod compat;
|
|
||||||
pub use compat::*;
|
|
||||||
|
|
||||||
#[derive(Debug, Specifier, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Specifier, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[bits = 1]
|
#[bits = 1]
|
||||||
pub enum StreamType {
|
pub enum StreamType {
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
#[cfg(rust_version = "1.87.0")]
|
|
||||||
pub use ge_1_87_0::{PipeReader, PipeWriter};
|
|
||||||
|
|
||||||
#[cfg(not(rust_version = "1.87.0"))]
|
|
||||||
pub use lt_1_87_0::{PipeReader, PipeWriter};
|
|
||||||
|
|
||||||
#[cfg(not(rust_version = "1.87.0"))]
|
|
||||||
pub(crate) use lt_1_87_0::PipeReaderInner;
|
|
||||||
|
|
||||||
#[cfg(not(rust_version = "1.87.0"))]
|
|
||||||
mod lt_1_87_0 {
|
|
||||||
use std::process::{ChildStderr, ChildStdout};
|
|
||||||
|
|
||||||
pub type PipeWriter = std::process::ChildStdin;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct PipeReader(pub(crate) PipeReaderInner);
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub(crate) enum PipeReaderInner {
|
|
||||||
Stdout(ChildStdout),
|
|
||||||
Stderr(ChildStderr),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::io::Read for PipeReader {
|
|
||||||
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
|
||||||
match &mut self.0 {
|
|
||||||
PipeReaderInner::Stdout(child_stdout) => child_stdout.read(buf),
|
|
||||||
PipeReaderInner::Stderr(child_stderr) => child_stderr.read(buf),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_vectored(
|
|
||||||
&mut self,
|
|
||||||
bufs: &mut [std::io::IoSliceMut<'_>],
|
|
||||||
) -> std::io::Result<usize> {
|
|
||||||
match &mut self.0 {
|
|
||||||
PipeReaderInner::Stdout(child_stdout) => child_stdout.read_vectored(bufs),
|
|
||||||
PipeReaderInner::Stderr(child_stderr) => child_stderr.read_vectored(bufs),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> std::io::Result<usize> {
|
|
||||||
match &mut self.0 {
|
|
||||||
PipeReaderInner::Stdout(child_stdout) => child_stdout.read_to_end(buf),
|
|
||||||
PipeReaderInner::Stderr(child_stderr) => child_stderr.read_to_end(buf),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_to_string(&mut self, buf: &mut String) -> std::io::Result<usize> {
|
|
||||||
match &mut self.0 {
|
|
||||||
PipeReaderInner::Stdout(child_stdout) => child_stdout.read_to_string(buf),
|
|
||||||
PipeReaderInner::Stderr(child_stderr) => child_stderr.read_to_string(buf),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_exact(&mut self, buf: &mut [u8]) -> std::io::Result<()> {
|
|
||||||
match &mut self.0 {
|
|
||||||
PipeReaderInner::Stdout(child_stdout) => child_stdout.read_exact(buf),
|
|
||||||
PipeReaderInner::Stderr(child_stderr) => child_stderr.read_exact(buf),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(rust_version = "1.87.0")]
|
|
||||||
mod ge_1_87_0 {
|
|
||||||
#![allow(clippy::incompatible_msrv)]
|
|
||||||
|
|
||||||
pub type PipeReader = std::io::PipeReader;
|
|
||||||
pub type PipeWriter = std::io::PipeWriter;
|
|
||||||
}
|
|
||||||
@@ -8950,9 +8950,6 @@ impl Machine {
|
|||||||
Some(atom!("std")) => Stdio::inherit(),
|
Some(atom!("std")) => Stdio::inherit(),
|
||||||
Some(atom!("null")) => Stdio::null(),
|
Some(atom!("null")) => Stdio::null(),
|
||||||
Some(atom!("pipe")) => {
|
Some(atom!("pipe")) => {
|
||||||
#[cfg(rust_version = "1.87.0")]
|
|
||||||
#[allow(clippy::incompatible_msrv)]
|
|
||||||
{
|
|
||||||
let (reader, writer) = match std::io::pipe() {
|
let (reader, writer) = match std::io::pipe() {
|
||||||
Ok(pipe_pair) => pipe_pair,
|
Ok(pipe_pair) => pipe_pair,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
@@ -8975,12 +8972,6 @@ impl Machine {
|
|||||||
|
|
||||||
Stdio::from(reader)
|
Stdio::from(reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(rust_version = "1.87.0"))]
|
|
||||||
{
|
|
||||||
Stdio::piped()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some(atom!("file")) => {
|
Some(atom!("file")) => {
|
||||||
let path = self.machine_st.value_to_str_like(args[1]).unwrap();
|
let path = self.machine_st.value_to_str_like(args[1]).unwrap();
|
||||||
|
|
||||||
@@ -9613,7 +9604,6 @@ impl Machine {
|
|||||||
|
|
||||||
#[cfg(feature = "crypto-inpure")]
|
#[cfg(feature = "crypto-inpure")]
|
||||||
fn rng() -> &'static dyn SecureRandom {
|
fn rng() -> &'static dyn SecureRandom {
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
static RANDOM: LazyLock<SystemRandom> = LazyLock::new(SystemRandom::new);
|
static RANDOM: LazyLock<SystemRandom> = LazyLock::new(SystemRandom::new);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::helper::load_module_test;
|
use crate::helper::load_module_test;
|
||||||
use crate::helper::load_module_test_with_input;
|
use crate::helper::load_module_test_with_input;
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(all(feature = "http", not(target_arch = "wasm32")))]
|
||||||
use crate::helper::load_module_test_with_tokio_runtime_and_input;
|
use crate::helper::load_module_test_with_tokio_runtime_and_input;
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
|
|
||||||
@@ -164,8 +164,7 @@ fn issue3262_read_from_stdin_no_newline() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "http")]
|
#[cfg(all(feature = "http", not(target_arch = "wasm32")))]
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
#[cfg_attr(miri, ignore = "it takes too long to run")]
|
#[cfg_attr(miri, ignore = "it takes too long to run")]
|
||||||
fn http_open_hanging() {
|
fn http_open_hanging() {
|
||||||
load_module_test_with_tokio_runtime_and_input(
|
load_module_test_with_tokio_runtime_and_input(
|
||||||
|
|||||||
Reference in New Issue
Block a user