Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up dependency tree #338

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
178 changes: 27 additions & 151 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
".",
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-steel-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion crates/cargo-steel-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn steel_home() -> Option<PathBuf> {
.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");
Expand Down
16 changes: 7 additions & 9 deletions crates/steel-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -41,12 +39,14 @@ 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"
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
Expand Down Expand Up @@ -75,10 +75,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"] }

Expand All @@ -92,13 +92,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" }
Expand Down
2 changes: 1 addition & 1 deletion crates/steel-core/src/compiler/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ create_prelude!(
#[cfg(not(target_arch = "wasm32"))]
pub static STEEL_HOME: Lazy<Option<String>> = 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");
Expand Down
3 changes: 2 additions & 1 deletion crates/steel-core/src/compiler/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,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};
Expand Down
2 changes: 1 addition & 1 deletion crates/steel-core/src/parser/parser.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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};
Expand Down
4 changes: 3 additions & 1 deletion crates/steel-core/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions crates/steel-core/src/primitives/fs.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -248,7 +247,7 @@ pub fn canonicalize_path(path: &SteelString) -> Result<SteelVal> {
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..]);
Expand Down
22 changes: 11 additions & 11 deletions crates/steel-core/src/primitives/numbers.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -957,8 +957,8 @@ fn expt(left: &SteelVal, right: &SteelVal) -> Result<SteelVal> {

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()
}
}
Expand Down Expand Up @@ -1003,8 +1003,8 @@ fn expt(left: &SteelVal, right: &SteelVal) -> Result<SteelVal> {
(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()
}
}
Expand Down Expand Up @@ -1412,7 +1412,7 @@ fn exact_integer_sqrt(number: &SteelVal) -> Result<SteelVal> {

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<N, Output = N>,
{
Expand Down Expand Up @@ -1862,7 +1862,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()
)))
Expand Down Expand Up @@ -2014,7 +2014,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()
)
Expand Down
3 changes: 2 additions & 1 deletion crates/steel-core/src/primitives/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use crate::rvals::{RestArgsIter, Result, SteelByteVector, SteelString, SteelVal}
use crate::steel_vm::builtin::BuiltInModule;
use crate::{stop, Vector};

use num::{BigInt, Num};
use num_bigint::BigInt;
use num_traits::Num;
use steel_derive::{function, native};

/// Strings in Steel are immutable, fixed length arrays of characters. They are heap allocated, and
Expand Down
4 changes: 2 additions & 2 deletions crates/steel-core/src/primitives/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!"),
Expand All @@ -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!"),
Expand Down
20 changes: 10 additions & 10 deletions crates/steel-core/src/rvals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -2117,7 +2117,7 @@ fn integer_float_equality(int: isize, float: f64) -> bool {
}
}

fn bignum_float_equality(bigint: &Gc<num::BigInt>, float: f64) -> bool {
fn bignum_float_equality(bigint: &Gc<BigInt>, float: f64) -> bool {
if float.fract() == 0.0 {
if let Some(promoted) = bigint.to_f64() {
promoted == float
Expand Down Expand Up @@ -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,
))
Expand Down Expand Up @@ -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)
}
}
Expand Down
8 changes: 4 additions & 4 deletions crates/steel-core/src/rvals/cycles.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand Down Expand Up @@ -1068,13 +1068,13 @@ impl<'a> BreadthFirstSearchSteelValVisitor for IterativeDropHandler<'a> {
self.moved_threads = true;

static DROP_THREAD: once_cell::sync::Lazy<
crossbeam::channel::Sender<OwnedIterativeDropHandler>,
crossbeam_channel::Sender<OwnedIterativeDropHandler>,
> = once_cell::sync::Lazy::new(start_background_drop_thread);

fn start_background_drop_thread(
) -> crossbeam::channel::Sender<OwnedIterativeDropHandler> {
) -> crossbeam_channel::Sender<OwnedIterativeDropHandler> {
let (sender, receiver) =
crossbeam::channel::unbounded::<OwnedIterativeDropHandler>();
crossbeam_channel::unbounded::<OwnedIterativeDropHandler>();

std::thread::spawn(move || {
while let Ok(mut value) = receiver.recv() {
Expand Down
8 changes: 4 additions & 4 deletions crates/steel-core/src/steel_vm/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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)))
}
Expand Down
12 changes: 6 additions & 6 deletions crates/steel-core/src/steel_vm/vm/threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,11 @@ fn spawn_thread_result(ctx: &mut VmCore, args: &[SteelVal]) -> Result<SteelVal>
}

pub struct SteelReceiver {
receiver: crossbeam::channel::Receiver<SteelVal>,
receiver: crossbeam_channel::Receiver<SteelVal>,
}

pub struct SteelSender {
sender: crossbeam::channel::Sender<SteelVal>,
sender: crossbeam_channel::Sender<SteelVal>,
}

pub struct Channels {
Expand All @@ -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(),
Expand All @@ -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<SteelVal> {
let mut selector = crossbeam::channel::Select::new();
let mut selector = crossbeam_channel::Select::new();

let borrows = values
.iter()
Expand Down Expand Up @@ -650,8 +650,8 @@ pub fn channel_try_recv(receiver: &SteelVal) -> Result<SteelVal> {

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()),
}
}

Expand Down
3 changes: 2 additions & 1 deletion crates/steel-core/src/values/closed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion crates/steel-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading
Loading