Merge pull request #3364 from Skgland/finish-msrv-bump-cleanup

finish msrv bump cleanup
This commit is contained in:
Mark Thom
2026-06-05 13:54:49 -07:00
committed by GitHub
6 changed files with 23 additions and 103 deletions

1
Cargo.lock generated
View File

@@ -2841,7 +2841,6 @@ dependencies = [
"to-syn-value_derive", "to-syn-value_derive",
"tokio", "tokio",
"trycmd", "trycmd",
"version_check",
"walkdir", "walkdir",
"warp", "warp",
"wasm-bindgen", "wasm-bindgen",

View File

@@ -40,9 +40,7 @@ crypto-full = ["dep:ring"]
collapsible_match = "allow" collapsible_match = "allow"
[lints.rust] [lints.rust]
unexpected_cfgs = { level = "deny", check-cfg = [ unexpected_cfgs = "deny"
'cfg(rust_version, values("1.87.0"))',
] }
function_casts_as_integer = "deny" function_casts_as_integer = "deny"
[build-dependencies] [build-dependencies]
@@ -53,7 +51,6 @@ strum_macros = "0.26"
syn = { version = "2.0.72", features = ['full', 'visit', 'extra-traits'] } syn = { version = "2.0.72", features = ['full', 'visit', 'extra-traits'] }
to-syn-value = "0.1.1" to-syn-value = "0.1.1"
to-syn-value_derive = "0.1.1" to-syn-value_derive = "0.1.1"
version_check = "0.9.5"
walkdir = "2" walkdir = "2"
[dependencies] [dependencies]

View File

@@ -45,10 +45,6 @@ fn find_prolog_files(path_prefix: &str, current_dir: &Path) -> Vec<(String, Path
} }
fn main() { fn main() {
if version_check::is_min_version("1.87.0").unwrap_or(false) {
println!(r#"cargo:rustc-cfg=rust_version="1.87.0""#);
}
let has_rustfmt = Command::new("rustfmt") let has_rustfmt = Command::new("rustfmt")
.arg("--version") .arg("--version")
.stdin(Stdio::inherit()) .stdin(Stdio::inherit())

View File

@@ -62,9 +62,9 @@ use std::io::Read;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::ExitCode; use std::process::ExitCode;
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
use std::sync::{LazyLock, OnceLock}; use std::sync::OnceLock;
pub static INTERRUPT: LazyLock<AtomicBool> = LazyLock::new(|| AtomicBool::new(false)); pub static INTERRUPT: AtomicBool = AtomicBool::new(false);
/// An instance of Scryer Prolog. /// An instance of Scryer Prolog.
/// ///

View File

@@ -4685,7 +4685,7 @@ impl Machine {
let http_listener = HttpListener { let http_listener = HttpListener {
incoming: rx, incoming: rx,
warp_shutdown: warp_shutdown, warp_shutdown,
}; };
let http_listener: TypedArenaPtr<HttpListener> = let http_listener: TypedArenaPtr<HttpListener> =
arena_alloc!(http_listener, &mut self.machine_st.arena); arena_alloc!(http_listener, &mut self.machine_st.arena);
@@ -4750,7 +4750,7 @@ impl Machine {
Err(_) => unreachable!(), Err(_) => unreachable!(),
} }
return false; false
} }
#[cfg(feature = "http")] #[cfg(feature = "http")]
@@ -8850,13 +8850,7 @@ impl Machine {
.stderr(stderr); .stderr(stderr);
match command.spawn() { match command.spawn() {
#[cfg_attr(rust_version = "1.87.0", expect(unused_mut))] Ok(child) => {
Ok(mut child) => {
#[cfg(not(rust_version = "1.87.0"))]
{
self.anon_pipe_compat(&mut child, &stdin_args, &stdout_args, &stderr_args)?;
}
let child_process_alloc: TypedArenaPtr<Child> = let child_process_alloc: TypedArenaPtr<Child> =
arena_alloc!(child, &mut self.machine_st.arena); arena_alloc!(child, &mut self.machine_st.arena);
@@ -8879,67 +8873,11 @@ impl Machine {
} }
} }
#[cfg(not(rust_version = "1.87.0"))]
fn anon_pipe_compat(
&mut self,
child: &mut std::process::Child,
stdin_args: &[HeapCellValue],
stdout_args: &[HeapCellValue],
stderr_args: &[HeapCellValue],
) -> CallResult {
if let Some(atom!("pipe")) = stdin_args[0].to_atom() {
let writer = child.stdin.take().expect("Should have captured stdin");
let stream = Stream::from_pipe_writer(writer, &mut self.machine_st.arena);
self.indices
.add_stream(stream, atom!("process_create"), 3)
.map_err(|stub_gen| stub_gen(&mut self.machine_st))?;
unify!(self.machine_st, stdin_args[1], HeapCellValue::from(stream));
}
if let Some(atom!("pipe")) = stdout_args[0].to_atom() {
let writer = child.stdout.take().expect("Should have captured stdout");
let stream = Stream::from_pipe_reader(
PipeReader(PipeReaderInner::Stdout(writer)),
&mut self.machine_st.arena,
);
self.indices
.add_stream(stream, atom!("process_create"), 3)
.map_err(|stub_gen| stub_gen(&mut self.machine_st))?;
unify!(self.machine_st, stdout_args[1], HeapCellValue::from(stream));
}
if let Some(atom!("pipe")) = stderr_args[0].to_atom() {
let writer = child.stderr.take().expect("Should have captured stderr");
let stream = Stream::from_pipe_reader(
PipeReader(PipeReaderInner::Stderr(writer)),
&mut self.machine_st.arena,
);
self.indices
.add_stream(stream, atom!("process_create"), 3)
.map_err(|stub_gen| stub_gen(&mut self.machine_st))?;
unify!(self.machine_st, stderr_args[1], HeapCellValue::from(stream));
}
Ok(())
}
fn handle_output_stream(&mut self, args: &[HeapCellValue]) -> Result<Stdio, MachineStub> { fn handle_output_stream(&mut self, args: &[HeapCellValue]) -> Result<Stdio, MachineStub> {
Ok(match args[0].to_atom() { Ok(match args[0].to_atom() {
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(_) => {
@@ -8962,12 +8900,6 @@ impl Machine {
Stdio::from(writer) Stdio::from(writer)
} }
#[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();

View File

@@ -32,8 +32,6 @@ impl Expectable for &[u8] {
/// Tests whether the file can be successfully loaded /// Tests whether the file can be successfully loaded
/// and produces the expected output during it /// and produces the expected output during it
pub(crate) fn load_module_test<T: Expectable>(file: &str, expected: T) { pub(crate) fn load_module_test<T: Expectable>(file: &str, expected: T) {
use scryer_prolog::MachineBuilder;
let mut wam = MachineBuilder::default().build(); let mut wam = MachineBuilder::default().build();
expected.assert_eq(wam.test_load_file(file).as_slice()); expected.assert_eq(wam.test_load_file(file).as_slice());
} }
@@ -43,8 +41,6 @@ pub(crate) fn load_module_test_with_input<T: Expectable>(
input: impl Into<Cow<'static, str>>, input: impl Into<Cow<'static, str>>,
expected: T, expected: T,
) { ) {
use scryer_prolog::MachineBuilder;
let mut wam = MachineBuilder::default() let mut wam = MachineBuilder::default()
.with_streams(StreamConfig::in_memory().with_user_input(InputStreamConfig::string(input))) .with_streams(StreamConfig::in_memory().with_user_input(InputStreamConfig::string(input)))
.build(); .build();