diff --git a/Cargo.lock b/Cargo.lock index 65730fc1f..33e3bc67d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,7 +239,7 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http 0.2.12", + "http", "http-body", "hyper", "itoa", @@ -269,7 +269,7 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 0.2.12", + "http", "http-body", "mime", "rustversion", @@ -442,7 +442,7 @@ version = "0.1.0" dependencies = [ "cargo-platform", "cargo_metadata 0.15.4", - "home", + "env_home", ] [[package]] @@ -658,11 +658,10 @@ dependencies = [ [[package]] name = "colored" -version = "2.2.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" +checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" dependencies = [ - "lazy_static", "windows-sys 0.59.0", ] @@ -1179,27 +1178,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - [[package]] name = "displaydoc" version = "0.2.5" @@ -1648,17 +1626,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http-body" version = "0.4.6" @@ -1666,7 +1633,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http 0.2.12", + "http", "pin-project-lite", ] @@ -1698,7 +1665,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "http 0.2.12", + "http", "http-body", "httparse", "httpdate", @@ -1970,7 +1937,7 @@ dependencies = [ "encoding_rs", "event-listener 2.5.3", "futures-lite", - "http 0.2.12", + "http", "log", "mime", "once_cell", @@ -2141,16 +2108,6 @@ dependencies = [ "libc", ] -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.8.0", - "libc", -] - [[package]] name = "libsqlite3-sys" version = "0.30.1" @@ -2350,20 +2307,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - [[package]] name = "num-bigint" version = "0.4.6" @@ -2375,16 +2318,6 @@ dependencies = [ "serde", ] -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", - "serde", -] - [[package]] name = "num-conv" version = "0.1.0" @@ -2400,17 +2333,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.2" @@ -2420,7 +2342,6 @@ dependencies = [ "num-bigint", "num-integer", "num-traits", - "serde", ] [[package]] @@ -2512,12 +2433,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "os_str_bytes" version = "6.6.1" @@ -2960,17 +2875,6 @@ dependencies = [ "bitflags 2.8.0", ] -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom 0.2.15", - "libredox", - "thiserror 1.0.69", -] - [[package]] name = "regalloc2" version = "0.1.3" @@ -3221,6 +3125,7 @@ dependencies = [ "memchr", "nix 0.28.0", "radix_trie", + "rustyline-derive", "unicode-segmentation", "unicode-width", "utf8parse", @@ -3229,13 +3134,13 @@ dependencies = [ [[package]] name = "rustyline-derive" -version = "0.7.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "107c3d5d7f370ac09efa62a78375f94d94b8a33c61d8c278b96683fb4dbf2d8d" +checksum = "e5af959c8bf6af1aff6d2b463a57f71aae53d1332da58419e30ad8dc7011d951" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.98", ] [[package]] @@ -3520,7 +3425,7 @@ version = "0.6.0" dependencies = [ "abi_stable", "base64 0.22.1", - "http 0.2.12", + "http", "isahc", "steel-core", "urlencoding", @@ -3544,34 +3449,33 @@ dependencies = [ "cranelift-jit", "cranelift-module", "criterion", - "crossbeam", - "dirs", - "env_logger", + "crossbeam-channel", + "crossbeam-utils", + "env_home", "futures-executor", "futures-task", "futures-util", "fxhash", "getrandom 0.3.1", "git2", - "home", - "http 1.2.0", "httparse", "im", "im-lists", "im-rc", "lasso", "log", - "num", + "num-bigint", + "num-integer", + "num-rational", + "num-traits", "once_cell", "parking_lot", "polling 3.7.4", - "pretty", "proptest", "quickscope", "radix_fmt", "rand 0.9.0", "serde", - "serde_derive", "serde_json", "smallvec", "stacker", @@ -3606,7 +3510,6 @@ version = "0.2.0" dependencies = [ "codegen", "serde", - "serde_derive", ] [[package]] @@ -3619,7 +3522,6 @@ dependencies = [ "log", "mimalloc", "once_cell", - "serde", "steel-core", "steel-derive", "steel-doc", @@ -3660,12 +3562,13 @@ dependencies = [ "compact_str", "fxhash", "lasso", - "num", + "num-bigint", + "num-rational", + "num-traits", "once_cell", "pretty", "pretty_assertions", "serde", - "serde_derive", "smallvec", ] @@ -3683,11 +3586,10 @@ name = "steel-repl" version = "0.6.0" dependencies = [ "colored", - "crossbeam", + "crossbeam-utils", "ctrlc", - "dirs", + "env_home", "rustyline", - "rustyline-derive", "steel-core", "steel-parser", ] @@ -3750,7 +3652,7 @@ version = "0.1.0" dependencies = [ "abi_stable", "axum", - "crossbeam", + "crossbeam-channel", "serde_json", "steel-core", "tokio", @@ -4214,7 +4116,7 @@ dependencies = [ "base64 0.13.1", "byteorder", "bytes", - "http 0.2.12", + "http", "httparse", "log", "rand 0.8.5", diff --git a/Cargo.toml b/Cargo.toml index 41d165d52..5ee0cd5a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,10 +46,6 @@ mimalloc = { version = "0.1.43", optional = true } [target.'cfg(not(target_os = "redox"))'.dependencies] cargo-steel-lib = { path = "./crates/cargo-steel-lib", version = "0.1.0" } - -[dev-dependencies] -serde = { version = "1.0.152", features = ["derive"] } - [workspace] members = [ ".", diff --git a/crates/cargo-steel-lib/Cargo.toml b/crates/cargo-steel-lib/Cargo.toml index 51b830f5a..4659caf57 100644 --- a/crates/cargo-steel-lib/Cargo.toml +++ b/crates/cargo-steel-lib/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] cargo_metadata = "0.15.3" -home = "0.5.9" +env_home = "0.1.0" # Keeps the MSRV at v1.70.0 cargo-platform = "=0.1.7" diff --git a/crates/cargo-steel-lib/src/lib.rs b/crates/cargo-steel-lib/src/lib.rs index 20cb732a8..219855c4c 100644 --- a/crates/cargo-steel-lib/src/lib.rs +++ b/crates/cargo-steel-lib/src/lib.rs @@ -18,7 +18,7 @@ pub fn steel_home() -> Option { .ok() .map(PathBuf::from) .or_else(|| { - let home = home::home_dir(); + let home = env_home::env_home_dir(); home.map(|mut x: PathBuf| { x.push(".steel"); diff --git a/crates/steel-core/Cargo.toml b/crates/steel-core/Cargo.toml index 99797426d..08f34a1f3 100644 --- a/crates/steel-core/Cargo.toml +++ b/crates/steel-core/Cargo.toml @@ -24,9 +24,7 @@ futures-task = "0.3.28" serde_json = "1.0.108" serde = { version = "1.0.193", features = ["derive", "rc"] } -serde_derive = "1.0.193" bincode = "1.3.3" -pretty = "0.12.1" im-lists = "0.9.0" strsim = "0.11.0" @@ -44,16 +42,15 @@ steel-gen = { path = "../steel-gen", version = "0.2.0" } steel-parser = { path = "../steel-parser", version = "0.6.0" } steel-derive = { path = "../steel-derive", version = "0.5.0" } cargo-steel-lib = { path = "../cargo-steel-lib", version = "0.1.0", optional = true } -chrono = { version = "0.4.23", default-features = false, features = [ - "std", - "clock", -] } -dirs = "5.0.1" +chrono = { version = "0.4.23", default-features = false, features = ["std", "clock"] } +env_home = "0.1.0" weak-table = "0.3.2" # TODO: Consider whether rand needs to be here rand = "0.9.0" -# TODO: Consider only depending on the sub crate -num = "0.4.0" +num-bigint = "0.4.6" +num-rational = "0.4.2" +num-traits = "0.2.19" +num-integer = "0.1.46" radix_fmt = "1.0.0" # For structs @@ -82,10 +79,10 @@ parking_lot = { version = "0.12", features = ["arc_lock", "send_guard"] } bigdecimal = "0.4.5" # Also for sync stuff -crossbeam = "0.8.4" +crossbeam-channel = "0.5.14" +crossbeam-utils = "0.8.21" httparse = "1.9.4" -http = "1.1.0" compact_str = { version = "0.8.0", features = ["serde"] } @@ -99,13 +96,11 @@ getrandom = { version = "0.3.1", features = ["wasm_js"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] which = "7.0.0" -home = "0.5.9" polling = "3.7.3" [dev-dependencies] proptest = "1.1.0" criterion = "0.5.1" -env_logger = "0.10.0" [build-dependencies] steel-gen = { path = "../steel-gen", version = "0.2.0" } diff --git a/crates/steel-core/src/compiler/modules.rs b/crates/steel-core/src/compiler/modules.rs index a35c892d1..5a4495c27 100644 --- a/crates/steel-core/src/compiler/modules.rs +++ b/crates/steel-core/src/compiler/modules.rs @@ -130,7 +130,7 @@ create_prelude!( #[cfg(not(target_arch = "wasm32"))] pub static STEEL_HOME: Lazy> = Lazy::new(|| { std::env::var("STEEL_HOME").ok().or_else(|| { - let home = home::home_dir(); + let home = env_home::env_home_dir(); home.map(|mut x: PathBuf| { x.push(".steel"); diff --git a/crates/steel-core/src/compiler/program.rs b/crates/steel-core/src/compiler/program.rs index 731dac3ef..9b94d8c9f 100644 --- a/crates/steel-core/src/compiler/program.rs +++ b/crates/steel-core/src/compiler/program.rs @@ -20,7 +20,8 @@ use crate::{ rvals::IntoSteelVal, }; -use num::{BigInt, BigRational, Rational32}; +use num_bigint::BigInt; +use num_rational::{BigRational, Rational32}; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, convert::TryInto, time::SystemTime}; use steel_parser::tokens::{IntLiteral, NumberLiteral, RealLiteral}; diff --git a/crates/steel-core/src/parser/parser.rs b/crates/steel-core/src/parser/parser.rs index ff447c98b..07c199991 100644 --- a/crates/steel-core/src/parser/parser.rs +++ b/crates/steel-core/src/parser/parser.rs @@ -2,7 +2,7 @@ use crate::primitives::numbers::make_polar; use crate::rvals::{IntoSteelVal, SteelComplex, SteelString}; use crate::{parser::tokens::TokenType::*, rvals::FromSteelVal}; -use num::BigRational; +use num_rational::BigRational; use std::borrow::Cow; use std::str; use std::sync::{Arc, Mutex}; diff --git a/crates/steel-core/src/primitives.rs b/crates/steel-core/src/primitives.rs index 4dcf95f63..bbc1f771c 100644 --- a/crates/steel-core/src/primitives.rs +++ b/crates/steel-core/src/primitives.rs @@ -51,7 +51,9 @@ pub use fs::{fs_module, fs_module_sandbox}; pub use io::IoFunctions; pub use lists::UnRecoverableResult; pub use meta_ops::MetaOperations; -use num::{BigInt, BigRational, Rational32, ToPrimitive}; +use num_bigint::BigInt; +use num_rational::{BigRational, Rational32}; +use num_traits::ToPrimitive; pub use numbers::{add_primitive, divide_primitive, multiply_primitive, subtract_primitive}; pub use ports::port_module; use std::convert::TryFrom; diff --git a/crates/steel-core/src/primitives/fs.rs b/crates/steel-core/src/primitives/fs.rs index 499c4fffe..301067edc 100644 --- a/crates/steel-core/src/primitives/fs.rs +++ b/crates/steel-core/src/primitives/fs.rs @@ -1,7 +1,6 @@ use crate::rvals::{Custom, Result, SteelString, SteelVal}; use crate::steel_vm::builtin::BuiltInModule; use crate::{steelerr, stop, throw}; -use dirs; use std::env::{current_dir, set_current_dir}; use std::path::{Path, PathBuf}; @@ -248,7 +247,7 @@ pub fn canonicalize_path(path: &SteelString) -> Result { if path.len() > 1 && !path.starts_with("~/") { steelerr!(Generic => "references to other users home directories are not supported")? } else { - let mut expanded = dirs::home_dir() + let mut expanded = env_home::env_home_dir() .ok_or_else(throw!(Generic => "could not determine user home directory"))?; if path.len() > 2 { expanded.push(&path[2..]); diff --git a/crates/steel-core/src/primitives/numbers.rs b/crates/steel-core/src/primitives/numbers.rs index 79a5a8240..13a553292 100644 --- a/crates/steel-core/src/primitives/numbers.rs +++ b/crates/steel-core/src/primitives/numbers.rs @@ -1,9 +1,9 @@ use crate::rvals::{IntoSteelVal, Result, SteelComplex, SteelVal}; use crate::{steelerr, stop}; -use num::Zero; -use num::{ - pow::Pow, BigInt, BigRational, CheckedAdd, CheckedMul, Integer, Rational32, Signed, ToPrimitive, -}; +use num_bigint::BigInt; +use num_integer::Integer; +use num_rational::{BigRational, Rational32}; +use num_traits::{pow::Pow, CheckedAdd, CheckedMul, Signed, ToPrimitive, Zero}; use std::ops::Neg; /// Checks if the given value is a number @@ -957,8 +957,8 @@ fn expt(left: &SteelVal, right: &SteelVal) -> Result { let expt = BigInt::from(*l).pow(r.magnitude()); match r.sign() { - num::bigint::Sign::Plus | num::bigint::Sign::NoSign => expt.into_steelval(), - num::bigint::Sign::Minus => { + num_bigint::Sign::Plus | num_bigint::Sign::NoSign => expt.into_steelval(), + num_bigint::Sign::Minus => { BigRational::new_raw(BigInt::from(1), expt).into_steelval() } } @@ -1003,8 +1003,8 @@ fn expt(left: &SteelVal, right: &SteelVal) -> Result { (SteelVal::BigNum(l), SteelVal::BigNum(r)) => { let expt = l.as_ref().clone().pow(r.magnitude()); match r.sign() { - num::bigint::Sign::NoSign | num::bigint::Sign::Plus => expt.into_steelval(), - num::bigint::Sign::Minus => { + num_bigint::Sign::NoSign | num_bigint::Sign::Plus => expt.into_steelval(), + num_bigint::Sign::Minus => { BigRational::new_raw(BigInt::from(1), expt).into_steelval() } } @@ -1494,7 +1494,7 @@ fn exact_integer_sqrt(number: &SteelVal) -> Result { fn exact_integer_impl<'a, N>(target: &'a N) -> (N, N) where - N: num::integer::Roots + Clone, + N: num_integer::Roots + Clone, &'a N: std::ops::Mul<&'a N, Output = N>, N: std::ops::Sub, { @@ -1944,7 +1944,7 @@ mod num_op_tests { ) .unwrap() .to_string(), - BigRational(Gc::new(num::BigRational::new( + BigRational(Gc::new(num_rational::BigRational::new( BigInt::from(1), BigInt::from_str("18446744073709551616").unwrap() ))) @@ -2096,7 +2096,7 @@ mod num_op_tests { ) .is_err()); assert!(exact_integer_sqrt( - &num::BigRational::new( + &num_rational::BigRational::new( BigInt::from_str("-10000000000000000000000000000000000001").unwrap(), BigInt::from_str("2").unwrap() ) diff --git a/crates/steel-core/src/primitives/time.rs b/crates/steel-core/src/primitives/time.rs index 01aae421a..69f9d9643 100644 --- a/crates/steel-core/src/primitives/time.rs +++ b/crates/steel-core/src/primitives/time.rs @@ -109,7 +109,7 @@ fn current_milliseconds() -> SteelVal { let ms = n.as_millis(); match isize::try_from(ms) { Ok(inner) => SteelVal::IntV(inner), - _ => SteelVal::BigNum(Gc::new(num::BigInt::from(ms))), + _ => SteelVal::BigNum(Gc::new(num_bigint::BigInt::from(ms))), } } Err(_) => panic!("SystemTime before UNIX EPOCH!"), @@ -128,7 +128,7 @@ fn current_seconds() -> SteelVal { let ms = n.as_secs(); match isize::try_from(ms) { Ok(inner) => SteelVal::IntV(inner), - _ => SteelVal::BigNum(Gc::new(num::BigInt::from(ms))), + _ => SteelVal::BigNum(Gc::new(num_bigint::BigInt::from(ms))), } } Err(_) => panic!("SystemTime before UNIX EPOCH!"), diff --git a/crates/steel-core/src/rvals.rs b/crates/steel-core/src/rvals.rs index 6a1d31a96..766a8178b 100644 --- a/crates/steel-core/src/rvals.rs +++ b/crates/steel-core/src/rvals.rs @@ -77,9 +77,9 @@ use futures_util::future::Shared; use futures_util::FutureExt; use crate::values::lists::List; -use num::{ - bigint::ToBigInt, BigInt, BigRational, FromPrimitive, Rational32, Signed, ToPrimitive, Zero, -}; +use num_bigint::{BigInt, ToBigInt}; +use num_rational::{BigRational, Rational32}; +use num_traits::{FromPrimitive, Signed, ToPrimitive, Zero}; use steel_parser::tokens::{IntLiteral, RealLiteral}; use self::cycles::{CycleDetector, IterativeDropHandler}; @@ -2117,7 +2117,7 @@ fn integer_float_equality(int: isize, float: f64) -> bool { } } -fn bignum_float_equality(bigint: &Gc, float: f64) -> bool { +fn bignum_float_equality(bigint: &Gc, float: f64) -> bool { if float.fract() == 0.0 { if let Some(promoted) = bigint.to_f64() { promoted == float @@ -2188,13 +2188,13 @@ impl PartialOrd for SteelVal { // the common ground #[cfg(target_pointer_width = "32")] { - let x_rational = num::Rational32::new_raw(*x as i32, 1); + let x_rational = num_rational::Rational32::new_raw(*x as i32, 1); x_rational.partial_cmp(y) } #[cfg(target_pointer_width = "64")] { - let x_rational = num::Rational64::new_raw(*x as i64, 1); - x_rational.partial_cmp(&num::Rational64::new_raw( + let x_rational = num_rational::Rational64::new_raw(*x as i64, 1); + x_rational.partial_cmp(&num_rational::Rational64::new_raw( *y.numer() as i64, *y.denom() as i64, )) @@ -2240,13 +2240,13 @@ impl PartialOrd for SteelVal { // Same as before, but opposite direction #[cfg(target_pointer_width = "32")] { - let y_rational = num::Rational32::new_raw(*y as i32, 1); + let y_rational = num_rational::Rational32::new_raw(*y as i32, 1); x.partial_cmp(&y_rational) } #[cfg(target_pointer_width = "64")] { - let y_rational = num::Rational64::new_raw(*y as i64, 1); - num::Rational64::new_raw(*x.numer() as i64, *x.denom() as i64) + let y_rational = num_rational::Rational64::new_raw(*y as i64, 1); + num_rational::Rational64::new_raw(*x.numer() as i64, *x.denom() as i64) .partial_cmp(&y_rational) } } diff --git a/crates/steel-core/src/rvals/cycles.rs b/crates/steel-core/src/rvals/cycles.rs index 32f920978..900b0ecb3 100644 --- a/crates/steel-core/src/rvals/cycles.rs +++ b/crates/steel-core/src/rvals/cycles.rs @@ -1,7 +1,7 @@ use crate::gc::shared::{MutableContainer, ShareableMut}; use crate::steel_vm::{builtin::get_function_name, vm::Continuation, vm::ContinuationMark}; use crate::values::lists::Pair; -use num::BigInt; +use num_bigint::BigInt; use std::{cell::Cell, collections::VecDeque}; use super::*; @@ -1068,13 +1068,13 @@ impl<'a> BreadthFirstSearchSteelValVisitor for IterativeDropHandler<'a> { self.moved_threads = true; static DROP_THREAD: once_cell::sync::Lazy< - crossbeam::channel::Sender, + crossbeam_channel::Sender, > = once_cell::sync::Lazy::new(start_background_drop_thread); fn start_background_drop_thread( - ) -> crossbeam::channel::Sender { + ) -> crossbeam_channel::Sender { let (sender, receiver) = - crossbeam::channel::unbounded::(); + crossbeam_channel::unbounded::(); std::thread::spawn(move || { while let Ok(mut value) = receiver.recv() { diff --git a/crates/steel-core/src/steel_vm/vm.rs b/crates/steel-core/src/steel_vm/vm.rs index e0510c460..2fad385d4 100644 --- a/crates/steel-core/src/steel_vm/vm.rs +++ b/crates/steel-core/src/steel_vm/vm.rs @@ -59,11 +59,11 @@ use std::{cell::RefCell, collections::HashMap, iter::Iterator, rc::Rc}; use super::engine::EngineId; -use crossbeam::atomic::AtomicCell; +use crossbeam_utils::atomic::AtomicCell; #[cfg(feature = "profiling")] use log::{debug, log_enabled}; -use num::BigInt; -use num::CheckedSub; +use num_bigint::BigInt; +use num_traits::CheckedSub; use parking_lot::RwLock; use smallvec::SmallVec; #[cfg(feature = "profiling")] @@ -6901,7 +6901,7 @@ mod handlers { if let Some(res) = l.checked_mul(n) { Ok(SteelVal::IntV(res)) } else { - let mut res = num::BigInt::from(l); + let mut res = BigInt::from(l); res *= n; Ok(SteelVal::BigNum(Gc::new(res))) } diff --git a/crates/steel-core/src/steel_vm/vm/threads.rs b/crates/steel-core/src/steel_vm/vm/threads.rs index 1fe3a1893..7a3779d29 100644 --- a/crates/steel-core/src/steel_vm/vm/threads.rs +++ b/crates/steel-core/src/steel_vm/vm/threads.rs @@ -548,11 +548,11 @@ fn spawn_thread_result(ctx: &mut VmCore, args: &[SteelVal]) -> Result } pub struct SteelReceiver { - receiver: crossbeam::channel::Receiver, + receiver: crossbeam_channel::Receiver, } pub struct SteelSender { - sender: crossbeam::channel::Sender, + sender: crossbeam_channel::Sender, } pub struct Channels { @@ -566,7 +566,7 @@ impl Custom for Channels {} impl Channels { pub fn new() -> Self { - let (sender, receiver) = crossbeam::channel::unbounded(); + let (sender, receiver) = crossbeam_channel::unbounded(); Self { sender: SteelSender { sender }.into_steelval().unwrap(), @@ -589,7 +589,7 @@ impl Channels { /// Using this directly is not recommended. #[steel_derive::native(name = "receivers-select", arity = "AtLeast(0)")] pub fn select(values: &[SteelVal]) -> Result { - let mut selector = crossbeam::channel::Select::new(); + let mut selector = crossbeam_channel::Select::new(); let borrows = values .iter() @@ -650,8 +650,8 @@ pub fn channel_try_recv(receiver: &SteelVal) -> Result { match value { Ok(v) => Ok(v), - Err(crossbeam::channel::TryRecvError::Empty) => Ok(empty_channel()), - Err(crossbeam::channel::TryRecvError::Disconnected) => Ok(disconnected_channel()), + Err(crossbeam_channel::TryRecvError::Empty) => Ok(empty_channel()), + Err(crossbeam_channel::TryRecvError::Disconnected) => Ok(disconnected_channel()), } } diff --git a/crates/steel-core/src/values/closed.rs b/crates/steel-core/src/values/closed.rs index f254834c2..731b77365 100644 --- a/crates/steel-core/src/values/closed.rs +++ b/crates/steel-core/src/values/closed.rs @@ -13,7 +13,8 @@ use crate::{ steel_vm::vm::{Continuation, ContinuationMark, Synchronizer}, values::lists::List, }; -use num::{BigInt, BigRational, Rational32}; +use num_bigint::BigInt; +use num_rational::{BigRational, Rational32}; #[cfg(feature = "sync")] use once_cell::sync::Lazy; diff --git a/crates/steel-gen/Cargo.toml b/crates/steel-gen/Cargo.toml index 47d8dd5c1..4d17f0b7f 100644 --- a/crates/steel-gen/Cargo.toml +++ b/crates/steel-gen/Cargo.toml @@ -12,4 +12,3 @@ description = "Code generation crates for use within steel" [dependencies] codegen = "0.2.0" serde = { version = "1.0.152", features = ["derive"] } -serde_derive = "1.0.152" diff --git a/crates/steel-parser/Cargo.toml b/crates/steel-parser/Cargo.toml index 6f16d352f..9b69916b1 100644 --- a/crates/steel-parser/Cargo.toml +++ b/crates/steel-parser/Cargo.toml @@ -12,11 +12,12 @@ description = "Parser for use within steel" [dependencies] fxhash = "0.2.1" lasso = { version = "0.7.3", features = ["multi-threaded", "ahash", "serialize"] } -num = { version = "0.4.0", features = ["serde"] } +num-rational = "0.4.2" +num-traits = "0.2.19" +num-bigint = { version = "0.4.6", features = ["serde"] } once_cell = "1.18.0" pretty = "0.12.1" serde = { version = "1.0.152", features = ["derive", "rc"] } -serde_derive = "1.0.152" smallvec = "1.13" compact_str = "0.8.0" diff --git a/crates/steel-parser/src/tokens.rs b/crates/steel-parser/src/tokens.rs index f3d4a6ac9..e5c7af967 100644 --- a/crates/steel-parser/src/tokens.rs +++ b/crates/steel-parser/src/tokens.rs @@ -2,8 +2,9 @@ use crate::lexer; use crate::parser::SourceId; use crate::span::Span; use core::ops; -use num::bigint::ParseBigIntError; -use num::{BigInt, Num, Rational32, Signed}; +use num_bigint::{BigInt, ParseBigIntError}; +use num_rational::Rational32; +use num_traits::{Num, Signed}; use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::fmt::{self, Display}; @@ -243,11 +244,11 @@ impl IntLiteral { } impl FromStr for IntLiteral { - type Err = ::Err; + type Err = ::Err; fn from_str(s: &str) -> Result { s.parse::().map(IntLiteral::Small).or_else(|_| { - s.parse::() + s.parse::() .map(|b| IntLiteral::Big(Box::new(b))) }) } diff --git a/crates/steel-repl/Cargo.toml b/crates/steel-repl/Cargo.toml index 8acade71d..6e75c6d91 100644 --- a/crates/steel-repl/Cargo.toml +++ b/crates/steel-repl/Cargo.toml @@ -10,14 +10,13 @@ description = "REPL library for steel" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rustyline = "14.0.0" -rustyline-derive = "0.7.0" -colored = "2.0.0" +rustyline = { version = "14.0.0", features = ["derive"] } +colored = "3.0.0" steel-core = { workspace = true } steel-parser = { path = "../steel-parser", version = "0.6.0"} -dirs = "5.0.1" +env_home = "0.1.0" ctrlc = "3.4.4" -crossbeam = "0.8.4" +crossbeam-utils = "0.8.21" [features] interrupt = ["steel-core/interrupt"] diff --git a/crates/steel-repl/src/highlight.rs b/crates/steel-repl/src/highlight.rs index 86d9e8199..71f937a05 100644 --- a/crates/steel-repl/src/highlight.rs +++ b/crates/steel-repl/src/highlight.rs @@ -1,5 +1,5 @@ extern crate rustyline; -use colored::*; +use colored::Colorize; use steel_parser::interner::InternedString; use steel_parser::parser::SourceId; use steel_parser::tokens::TokenType; @@ -10,8 +10,8 @@ use std::sync::{Arc, Mutex}; use rustyline::highlight::Highlighter; use rustyline::validate::{ValidationContext, ValidationResult, Validator}; +use rustyline::Helper; use rustyline::{hint::Hinter, Context}; -use rustyline_derive::Helper; use steel_parser::lexer::TokenStream; @@ -23,14 +23,14 @@ use std::borrow::Cow; #[derive(Helper)] pub struct RustylineHelper { globals: Arc>>, - bracket: crossbeam::atomic::AtomicCell>, // keywords: HashSet<&'static str>, + bracket: crossbeam_utils::atomic::AtomicCell>, // keywords: HashSet<&'static str>, } impl RustylineHelper { pub fn new(globals: Arc>>) -> Self { Self { globals, - bracket: crossbeam::atomic::AtomicCell::new(None), + bracket: crossbeam_utils::atomic::AtomicCell::new(None), } } } diff --git a/crates/steel-repl/src/repl.rs b/crates/steel-repl/src/repl.rs index 04be04e2d..3f2e0e403 100644 --- a/crates/steel-repl/src/repl.rs +++ b/crates/steel-repl/src/repl.rs @@ -1,5 +1,5 @@ extern crate rustyline; -use colored::*; +use colored::Colorize; use rustyline::history::FileHistory; use rustyline::{ Cmd, ConditionalEventHandler, Event, EventContext, EventHandler, KeyEvent, RepeatCount, @@ -29,8 +29,6 @@ use std::env; use std::fs::File; -use dirs; - use crate::highlight::RustylineHelper; fn display_help() { @@ -73,7 +71,7 @@ fn get_repl_history_path() -> String { parsed_path.to_string_lossy().into_owned() } None => { - let mut default_path = dirs::home_dir().unwrap_or_default(); + let mut default_path = env_home::env_home_dir().unwrap_or_default(); default_path.push(".steel/history"); default_path.to_string_lossy().into_owned() } diff --git a/libs/steel-webserver/Cargo.toml b/libs/steel-webserver/Cargo.toml index 9b687911a..e1d75a17a 100644 --- a/libs/steel-webserver/Cargo.toml +++ b/libs/steel-webserver/Cargo.toml @@ -13,6 +13,6 @@ crate-type = ["cdylib"] steel-core = { workspace = true } axum = { version = "0.6.2", features = ["query"] } tokio = { version = "1.0", features = ["full"] } -crossbeam = "0.8.2" +crossbeam-channel = "0.5.14" serde_json = "1.0.92" abi_stable = "0.11.1" diff --git a/libs/steel-webserver/src/lib.rs b/libs/steel-webserver/src/lib.rs index 5fb4e976b..e97877216 100644 --- a/libs/steel-webserver/src/lib.rs +++ b/libs/steel-webserver/src/lib.rs @@ -8,7 +8,7 @@ use steel::{ }, }; -use crossbeam::channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{unbounded, Receiver, Sender}; use axum::extract::Path;