Skip to content

Commit

Permalink
chore: rework workspace structure for utils crates (#4886)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

This PR flattens a layer of nesting from our crate structure. I've
renamed `arena` to `noirc_arena` so we can publish to crates.io in the
future.

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
TomAFrench authored Apr 25, 2024
1 parent dbfca58 commit 7ea0e91
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 19 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ members = [
# Aztec Macro crate for metaprogramming
"aztec_macros",
# Compiler crates
"compiler/noirc_arena",
"compiler/noirc_evaluator",
"compiler/noirc_frontend",
"compiler/noirc_errors",
"compiler/noirc_driver",
"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",
Expand All @@ -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"
Expand All @@ -61,9 +61,8 @@ acvm_blackbox_solver = { version = "0.44.0", path = "acvm-repo/blackbox_solver",
bn254_blackbox_solver = { version = "0.44.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" }
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "arena"
name = "noirc_arena"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/def_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/hir/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ pub mod test {
}

fn local_module_id(&self) -> LocalModuleId {
LocalModuleId(arena::Index::unsafe_zeroed())
LocalModuleId(noirc_arena::Index::unsafe_zeroed())
}

fn module_id(&self) -> ModuleId {
Expand Down Expand Up @@ -724,7 +724,7 @@ pub mod test {
let mut def_maps = BTreeMap::new();
let file = FileId::default();

let mut modules = arena::Arena::default();
let mut modules = noirc_arena::Arena::default();
let location = Location::new(Default::default(), file);
modules.insert(ModuleData::new(None, location, false));

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/node_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/resolve_locations.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use arena::Index;
use noirc_arena::Index;
use noirc_errors::Location;

use crate::hir_def::expr::HirExpression;
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ mod test {
hir::def_map::{CrateDefMap, LocalModuleId},
parse_program,
};
use arena::Arena;
use fm::FileManager;
use noirc_arena::Arena;

pub(crate) fn has_parser_error(errors: &[(CompilationError, FileId)]) -> bool {
errors.iter().any(|(e, _f)| matches!(e, CompilationError::ParseError(_)))
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 7ea0e91

Please sign in to comment.