Skip to content
14 changes: 3 additions & 11 deletions crates/cargo-steel-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ pub fn steel_home() -> Option<PathBuf> {
// this is probably not the best place to do this. This almost
// assuredly could be lifted out of this check since failing here
// could cause some annoyance.
if !x.exists() {
if let Err(_) = std::fs::create_dir(&x) {
eprintln!("Unable to create steel home directory {:?}", x)
}
if !x.exists() && std::fs::create_dir(&x).is_err() {
eprintln!("Unable to create steel home directory {:?}", x)
}

x
Expand Down Expand Up @@ -94,13 +92,7 @@ pub fn run(args: Vec<String>, env_vars: Vec<(String, String)>) -> Result<(), Box
});

for last in artifacts {
if last
.target
.kind
.iter()
.find(|x| x.as_str() == "cdylib")
.is_some()
{
if last.target.kind.iter().any(|x| x.as_str() == "cdylib") {
for file in last.filenames {
if matches!(file.extension(), Some("so") | Some("dylib") | Some("lib")) {
println!("Found a cdylib!");
Expand Down
2 changes: 0 additions & 2 deletions crates/steel-core/benches/my_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(unused)]

use criterion::{black_box, criterion_group, criterion_main, Criterion};

use steel::stdlib::PRELUDE;
Expand Down
4 changes: 0 additions & 4 deletions crates/steel-core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ fn main() {
use std::path::Path;

let out_dir = env::var_os("OUT_DIR").unwrap();
// let dest_path = Path::new(&out_dir).join("generated.rs");

// fs::write(dest_path, steel_gen::permutations::code_gen()).unwrap();

let dest_path = Path::new(&out_dir).join("dynamic.rs");

fs::write(dest_path, steel_gen::generate_opcode_map()).unwrap();
Expand Down
1 change: 0 additions & 1 deletion crates/steel-core/src/compiler/code_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ impl<'a> CodeGenerator<'a> {
Some(())
}

#[allow(unused)]
fn specialize_call(&mut self, l: &List, op: OpCode) -> Option<()> {
if l.args.len() != 3 {
return None;
Expand Down
2 changes: 0 additions & 2 deletions crates/steel-core/src/compiler/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ pub struct SerializableCompiler {
}

impl SerializableCompiler {
#[allow(unused)]
pub(crate) fn into_compiler(self) -> Compiler {
let mut compiler = Compiler::default();

Expand All @@ -364,7 +363,6 @@ impl SerializableCompiler {
}

impl Compiler {
#[allow(unused)]
pub(crate) fn into_serializable_compiler(self) -> Result<SerializableCompiler> {
Ok(SerializableCompiler {
symbol_map: self.symbol_map,
Expand Down
4 changes: 2 additions & 2 deletions crates/steel-core/src/compiler/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl ModuleManager {
Ok(())
}

// #[allow(unused)]
//
pub(crate) fn compile_main(
&mut self,
global_macro_map: &mut FxHashMap<InternedString, SteelMacro>,
Expand Down Expand Up @@ -1678,7 +1678,7 @@ struct ModuleBuilder<'a> {

impl<'a> ModuleBuilder<'a> {
#[allow(clippy::too_many_arguments)]
#[allow(unused)]

fn main(
name: Option<PathBuf>,
source_ast: Vec<ExprKind>,
Expand Down
3 changes: 1 addition & 2 deletions crates/steel-core/src/compiler/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,6 @@ pub const fn sequence_to_opcode(pattern: &[(OpCode, usize)]) -> &'static [steel_
}
}

#[allow(unused)]
pub fn tile_super_instructions(instructions: &mut [Instruction]) {
#[cfg(feature = "dynamic")]
{
Expand Down Expand Up @@ -1189,7 +1188,7 @@ fn extract_spans(

// A program stripped of its debug symbols, but only constructable by running a pass
// over it with the symbol map to intern all of the symbols in the order they occurred
#[allow(unused)]

#[derive(Clone)]
pub struct Executable {
pub(crate) name: Shared<String>,
Expand Down
1 change: 0 additions & 1 deletion crates/steel-core/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::sync::Arc;

use crate::rvals::{Result, SteelVal};

#[allow(unused)]
#[derive(Debug)]
pub struct Env {
#[cfg(not(feature = "sync"))]
Expand Down
10 changes: 3 additions & 7 deletions crates/steel-core/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,20 +627,16 @@ pub mod unsafe_roots {
}

// #[cfg(feature = "unsafe-internals")]
#[allow(unused)]

pub mod unsafe_erased_pointers {
/*
Warning - here be dragons. Definitely a lot of unsafe things here, and when used incorrectly
can lead to undefined behavior.
*/

use std::cell::Cell;
use std::rc::{Rc, Weak};
use std::{any::Any, cell::RefCell, marker::PhantomData};

use crate::steel_vm::engine::EngineId;
use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::rc::Rc;
use std::{any::Any, marker::PhantomData};

use crate::rvals::cycles::IterativeDropHandler;
use crate::rvals::{AsRefSteelValFromRef, MaybeSendSyncStatic};
Expand Down
2 changes: 1 addition & 1 deletion crates/steel-core/src/jit/code_gen.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused)]


use crate::gc::Gc;
use crate::jit::ir::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/steel-core/src/jit/lower.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused)]


use crate::parser::ast::ExprKind;
use crate::parser::tokens::TokenType;
Expand Down
2 changes: 1 addition & 1 deletion crates/steel-core/src/jit/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused)]


pub mod code_gen;
pub mod ir;
Expand Down
2 changes: 1 addition & 1 deletion crates/steel-core/src/steel_vm/contract_checker.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*

#![allow(unused)]

use std::collections::{BTreeSet, HashMap};

use quickscope::ScopeMap;
Expand Down
43 changes: 15 additions & 28 deletions crates/steel-core/src/steel_vm/engine.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![allow(unused)]

use super::{
builtin::{BuiltInModule, FunctionSignatureMetadata},
primitives::{register_builtin_modules, CONSTANTS},
primitives::register_builtin_modules,
vm::{SteelThread, ThreadStateController},
};

Expand All @@ -26,61 +24,48 @@ use crate::{
},
},
containers::RegisterValue,
core::{
instructions::{pretty_print_dense_instructions, DenseInstruction, Instruction},
labels::Expr,
},
gc::{
unsafe_erased_pointers::{
BorrowedObject, CustomReference, OpaqueReferenceNursery, ReadOnlyBorrowedObject,
ReferenceMarker,
},
unsafe_erased_pointers::{CustomReference, ReferenceMarker},
Gc, Shared,
},
parser::{
ast::ExprKind,
expander::SteelMacro,
interner::{get_interner, take_interner, InternedString},
interner::{get_interner, InternedString},
kernel::{fresh_kernel_image, Kernel},
parser::{ParseError, Parser, Sources, SYNTAX_OBJECT_ID},
parser::{ParseError, Parser, Sources},
},
rerrs::{back_trace, back_trace_to_string},
rvals::{
AsRefMutSteelVal, AsRefSteelVal as _, FromSteelVal, IntoSteelVal, MaybeSendSyncStatic,
Result, SteelString, SteelVal,
Result, SteelVal,
},
steel_vm::register_fn::RegisterFn,
stop, throw,
values::{
closed::GlobalSlotRecycler,
functions::{BoxedDynFunction, ByteCodeLambda},
},
values::{closed::GlobalSlotRecycler, functions::BoxedDynFunction},
SteelErr,
};
use std::{
borrow::Cow,
cell::{Cell, RefCell},
collections::{HashMap, HashSet},
path::PathBuf,
rc::Rc,
sync::{
atomic::{AtomicBool, AtomicUsize, Ordering},
Arc, Mutex,
},
};

use crate::values::HashMap as ImmutableHashMap;
use fxhash::{FxBuildHasher, FxHashMap};
use lasso::ThreadedRodeo;
use once_cell::sync::{Lazy, OnceCell};
use once_cell::sync::OnceCell;
use parking_lot::{
MappedRwLockReadGuard, MappedRwLockWriteGuard, RwLock, RwLockReadGuard, RwLockWriteGuard,
};
use serde::{Deserialize, Serialize};
use steel_gen::OpCode;
use steel_parser::{
parser::{SourceId, SyntaxObject},
tokens::{IntLiteral, TokenType},
tokens::TokenType,
};

use crate::parser::ast::IteratorExtensions;
Expand Down Expand Up @@ -219,7 +204,7 @@ pub struct Engine {

impl Clone for Engine {
fn clone(&self) -> Self {
let mut virtual_machine = self.virtual_machine.clone();
let virtual_machine = self.virtual_machine.clone();
let compiler = Arc::new(RwLock::new(self.virtual_machine.compiler.write().clone()));

// virtual_machine.compiler = Some(Arc::downgrade(&compiler));
Expand Down Expand Up @@ -357,7 +342,7 @@ impl<'a> LifetimeGuard<'a> {
thunk(self.engine, values)
}

pub fn consume_once<T>(self, mut thunk: impl FnOnce(&mut Engine, Vec<SteelVal>) -> T) -> T {
pub fn consume_once<T>(self, thunk: impl FnOnce(&mut Engine, Vec<SteelVal>) -> T) -> T {
let values =
crate::gc::unsafe_erased_pointers::OpaqueReferenceNursery::drain_weak_references_to_steelvals();

Expand Down Expand Up @@ -469,7 +454,7 @@ impl Engine {
let mut engine = self.clone();
engine.virtual_machine.global_env = engine.virtual_machine.global_env.deep_clone();

let mut compiler_copy = engine.virtual_machine.compiler.read().clone();
let compiler_copy = engine.virtual_machine.compiler.read().clone();

engine.virtual_machine.compiler = Arc::new(RwLock::new(compiler_copy));

Expand Down Expand Up @@ -1307,7 +1292,7 @@ impl Engine {
T: ReferenceMarker<'b, Static = EXT>,
{
self.with_mut_reference(obj).consume(|engine, args| {
let mut args = args.into_iter();
let args = args.into_iter();

thunk(engine, args.into_iter().next().unwrap_or(SteelVal::Void))
})
Expand All @@ -1327,7 +1312,7 @@ impl Engine {
T: ReferenceMarker<'b, Static = EXT>,
{
self.with_immutable_reference(obj).consume(|engine, args| {
let mut args = args.into_iter();
let args = args.into_iter();

thunk(engine, args.into_iter().next().unwrap_or(SteelVal::Void))
})
Expand Down Expand Up @@ -2369,6 +2354,8 @@ mod engine_sandbox_tests {

#[cfg(test)]
mod derive_macro_tests {
use crate::rvals::SteelString;

use super::*;

#[derive(steel_derive::_Steel, PartialEq, Debug)]
Expand Down
10 changes: 2 additions & 8 deletions crates/steel-core/src/steel_vm/meta.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
#![allow(unused)]

// pub type BuiltInSignature = fn(Vec<SteelVal>, &mut dyn VmContext) -> Result<SteelVal>;`

use std::borrow::Cow;
use std::{cell::RefCell, convert::TryFrom, io::Write, rc::Rc};
use std::{convert::TryFrom, io::Write};

use crate::gc::shared::ShareableMut;
use crate::parser::tryfrom_visitor::TryFromExprKindForSteelVal;
// use im_lists::list::List;
use crate::values::lists::List;

use crate::values::port::SteelPortRepr;
use crate::values::structs::SteelResult;
use crate::{
parser::ast::ExprKind,
rvals::Custom,
values::port::{SteelPort, CAPTURED_OUTPUT_PORT, DEFAULT_OUTPUT_PORT},
SteelErr, SteelVal,
parser::ast::ExprKind, rvals::Custom, values::port::CAPTURED_OUTPUT_PORT, SteelErr, SteelVal,
};
use crate::{parser::expander::LocalMacroManager, rvals::Result};
use crate::{parser::parser::ParseError, steel_vm::engine::Engine};
Expand Down
Loading