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

chore: rework workspace structure for utils crates #4886

Merged
merged 5 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.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" }
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 @@ -136,7 +136,7 @@
// when multiple impls are available. Instead we default first to choose the Field or u64 impl.
for typ in &type_checker.type_variables {
if let Type::TypeVariable(variable, kind) = typ.follow_bindings() {
let msg = "TypeChecker should only track defaultable type vars";

Check warning on line 139 in compiler/noirc_frontend/src/hir/type_check/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (defaultable)
variable.bind(kind.default_type().expect(msg));
}
}
Expand Down Expand Up @@ -672,7 +672,7 @@
}

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 @@
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,13 +2,13 @@
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;

Check warning on line 9 in compiler/noirc_frontend/src/node_interner.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (petgraph)

Check warning on line 9 in compiler/noirc_frontend/src/node_interner.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (tarjan)
use petgraph::prelude::DiGraph;

Check warning on line 10 in compiler/noirc_frontend/src/node_interner.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (petgraph)
use petgraph::prelude::NodeIndex as PetGraphIndex;

Check warning on line 11 in compiler/noirc_frontend/src/node_interner.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (petgraph)

use crate::ast::Ident;
use crate::graph::CrateId;
Expand Down Expand Up @@ -60,7 +60,7 @@
function_modules: HashMap<FuncId, ModuleId>,

/// This graph tracks dependencies between different global definitions.
/// This is used to ensure the absense of dependency cycles for globals and types.

Check warning on line 63 in compiler/noirc_frontend/src/node_interner.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (absense)
dependency_graph: DiGraph<DependencyId, ()>,

/// To keep track of where each DependencyId is in `dependency_graph`, we need
Expand Down Expand Up @@ -465,7 +465,7 @@
function_modifiers: HashMap::new(),
function_modules: HashMap::new(),
func_id_to_trait: HashMap::new(),
dependency_graph: petgraph::graph::DiGraph::new(),

Check warning on line 468 in compiler/noirc_frontend/src/node_interner.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (petgraph)
dependency_graph_indices: HashMap::new(),
id_to_location: HashMap::new(),
definitions: vec![],
Expand Down Expand Up @@ -1598,7 +1598,7 @@
}

pub(crate) fn check_for_dependency_cycles(&self) -> Vec<(CompilationError, FileId)> {
let strongly_connected_components = tarjan_scc(&self.dependency_graph);

Check warning on line 1601 in compiler/noirc_frontend/src/node_interner.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (tarjan)
let mut errors = Vec::new();

let mut push_error = |item: String, scc: &[_], i, location: Location| {
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.
Loading