From 53e83016f1406c9dd09f0a4a10d35ac6a75e8645 Mon Sep 17 00:00:00 2001 From: Tom French Date: Sat, 20 Apr 2024 18:10:21 +0100 Subject: [PATCH] chore: rework workspace structure for utils crates --- Cargo.lock | 10 +++++----- Cargo.toml | 14 ++++++++------ compiler/{utils/arena => noirc_arena}/Cargo.toml | 2 +- compiler/{utils/arena => noirc_arena}/src/lib.rs | 0 compiler/noirc_frontend/Cargo.toml | 2 +- compiler/noirc_frontend/src/hir/def_map/mod.rs | 2 +- compiler/noirc_frontend/src/node_interner.rs | 2 +- compiler/noirc_frontend/src/resolve_locations.rs | 2 +- {compiler/utils => utils}/iter-extended/Cargo.toml | 0 {compiler/utils => utils}/iter-extended/src/lib.rs | 0 10 files changed, 18 insertions(+), 16 deletions(-) rename compiler/{utils/arena => noirc_arena}/Cargo.toml (86%) rename compiler/{utils/arena => noirc_arena}/src/lib.rs (100%) rename {compiler/utils => utils}/iter-extended/Cargo.toml (100%) rename {compiler/utils => utils}/iter-extended/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 35702c8df03..48890e18602 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,10 +233,6 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" -[[package]] -name = "arena" -version = "0.27.0" - [[package]] name = "ark-bls12-381" version = "0.4.0" @@ -3096,6 +3092,10 @@ dependencies = [ "wasm-bindgen-test", ] +[[package]] +name = "noirc_arena" +version = "0.27.0" + [[package]] name = "noirc_driver" version = "0.27.0" @@ -3157,7 +3157,6 @@ name = "noirc_frontend" version = "0.27.0" dependencies = [ "acvm", - "arena", "base64 0.21.2", "chumsky", "fm", @@ -3165,6 +3164,7 @@ dependencies = [ "iter-extended", "lalrpop", "lalrpop-util", + "noirc_arena", "noirc_errors", "noirc_printable_type", "petgraph", diff --git a/Cargo.toml b/Cargo.toml index 132ff181e44..e209cd95b16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ members = [ # Aztec Macro crate for metaprogramming "aztec_macros", # Compiler crates + "compiler/noirc_arena", "compiler/noirc_evaluator", "compiler/noirc_frontend", "compiler/noirc_errors", @@ -11,10 +12,7 @@ members = [ "compiler/noirc_printable_type", "compiler/fm", "compiler/wasm", - # Utility crates used by the Noir compiler - "compiler/utils/arena", - "compiler/utils/iter-extended", - # Crates related to tooling built ontop of the Noir compiler + # Crates related to tooling built on top of the Noir compiler "tooling/backend_interface", "tooling/bb_abstraction_leaks", "tooling/lsp", @@ -35,6 +33,8 @@ members = [ "acvm-repo/brillig_vm", "acvm-repo/blackbox_solver", "acvm-repo/bn254_blackbox_solver", + # Utility crates + "utils/iter-extended", ] default-members = ["tooling/nargo_cli", "tooling/acvm_cli"] resolver = "2" @@ -61,9 +61,8 @@ acvm_blackbox_solver = { version = "0.43.0", path = "acvm-repo/blackbox_solver", bn254_blackbox_solver = { version = "0.43.0", path = "acvm-repo/bn254_blackbox_solver", default-features = false } # Noir compiler workspace dependencies -arena = { path = "compiler/utils/arena" } fm = { path = "compiler/fm" } -iter-extended = { path = "compiler/utils/iter-extended" } +noirc_arena = { path = "compiler/noirc_arena" } noirc_driver = { path = "compiler/noirc_driver" } noirc_errors = { path = "compiler/noirc_errors" } noirc_evaluator = { path = "compiler/noirc_evaluator" } @@ -80,6 +79,9 @@ noirc_abi = { path = "tooling/noirc_abi" } bb_abstraction_leaks = { path = "tooling/bb_abstraction_leaks" } acvm_cli = { path = "tooling/acvm_cli" } +# Misc utils crates +iter-extended = { path = "utils/iter-extended" } + # LSP async-lsp = { version = "0.1.0", default-features = false } lsp-types = "0.94.1" diff --git a/compiler/utils/arena/Cargo.toml b/compiler/noirc_arena/Cargo.toml similarity index 86% rename from compiler/utils/arena/Cargo.toml rename to compiler/noirc_arena/Cargo.toml index f6bd764ee62..b94f997b7b9 100644 --- a/compiler/utils/arena/Cargo.toml +++ b/compiler/noirc_arena/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "arena" +name = "noirc_arena" version.workspace = true authors.workspace = true edition.workspace = true diff --git a/compiler/utils/arena/src/lib.rs b/compiler/noirc_arena/src/lib.rs similarity index 100% rename from compiler/utils/arena/src/lib.rs rename to compiler/noirc_arena/src/lib.rs diff --git a/compiler/noirc_frontend/Cargo.toml b/compiler/noirc_frontend/Cargo.toml index 84c9393fa37..0430d214d53 100644 --- a/compiler/noirc_frontend/Cargo.toml +++ b/compiler/noirc_frontend/Cargo.toml @@ -10,10 +10,10 @@ license.workspace = true [dependencies] acvm.workspace = true +noirc_arena.workspace = true noirc_errors.workspace = true noirc_printable_type.workspace = true fm.workspace = true -arena.workspace = true iter-extended.workspace = true chumsky.workspace = true thiserror.workspace = true diff --git a/compiler/noirc_frontend/src/hir/def_map/mod.rs b/compiler/noirc_frontend/src/hir/def_map/mod.rs index 7c0090ff95b..590c2e3d6b6 100644 --- a/compiler/noirc_frontend/src/hir/def_map/mod.rs +++ b/compiler/noirc_frontend/src/hir/def_map/mod.rs @@ -5,8 +5,8 @@ use crate::macros_api::MacroProcessor; use crate::node_interner::{FuncId, GlobalId, NodeInterner, StructId}; use crate::parser::{parse_program, ParsedModule, ParserError}; use crate::token::{FunctionAttribute, SecondaryAttribute, TestScope}; -use arena::{Arena, Index}; use fm::{FileId, FileManager}; +use noirc_arena::{Arena, Index}; use noirc_errors::Location; use std::collections::{BTreeMap, HashMap}; mod module_def; diff --git a/compiler/noirc_frontend/src/node_interner.rs b/compiler/noirc_frontend/src/node_interner.rs index b0e68be4868..f1e18087176 100644 --- a/compiler/noirc_frontend/src/node_interner.rs +++ b/compiler/noirc_frontend/src/node_interner.rs @@ -2,9 +2,9 @@ use std::borrow::Cow; use std::collections::HashMap; use std::ops::Deref; -use arena::{Arena, Index}; use fm::FileId; use iter_extended::vecmap; +use noirc_arena::{Arena, Index}; use noirc_errors::{Location, Span, Spanned}; use petgraph::algo::tarjan_scc; use petgraph::prelude::DiGraph; diff --git a/compiler/noirc_frontend/src/resolve_locations.rs b/compiler/noirc_frontend/src/resolve_locations.rs index b5f1b1d0c64..ac8c96a092e 100644 --- a/compiler/noirc_frontend/src/resolve_locations.rs +++ b/compiler/noirc_frontend/src/resolve_locations.rs @@ -1,4 +1,4 @@ -use arena::Index; +use noirc_arena::Index; use noirc_errors::Location; use crate::hir_def::expr::HirExpression; diff --git a/compiler/utils/iter-extended/Cargo.toml b/utils/iter-extended/Cargo.toml similarity index 100% rename from compiler/utils/iter-extended/Cargo.toml rename to utils/iter-extended/Cargo.toml diff --git a/compiler/utils/iter-extended/src/lib.rs b/utils/iter-extended/src/lib.rs similarity index 100% rename from compiler/utils/iter-extended/src/lib.rs rename to utils/iter-extended/src/lib.rs