diff --git a/aztec_macros/src/transforms/compute_note_hash_and_optionally_a_nullifier.rs b/aztec_macros/src/transforms/compute_note_hash_and_optionally_a_nullifier.rs index 30c0f63a2d4..40fde39a06f 100644 --- a/aztec_macros/src/transforms/compute_note_hash_and_optionally_a_nullifier.rs +++ b/aztec_macros/src/transforms/compute_note_hash_and_optionally_a_nullifier.rs @@ -176,7 +176,7 @@ fn generate_compute_note_hash_and_optionally_a_nullifier_source( format!( " unconstrained fn compute_note_hash_and_optionally_a_nullifier( - contract_address: dep::aztec::protocol_types::address::AztecAddress, + contract_address: aztec::protocol_types::address::AztecAddress, nonce: Field, storage_slot: Field, note_type_id: Field, @@ -194,7 +194,7 @@ fn generate_compute_note_hash_and_optionally_a_nullifier_source( let if_statements: Vec = note_types.iter().map(|note_type| format!( "if (note_type_id == {0}::get_note_type_id()) {{ - dep::aztec::note::utils::compute_note_hash_and_optionally_a_nullifier({0}::deserialize_content, note_header, compute_nullifier, serialized_note) + aztec::note::utils::compute_note_hash_and_optionally_a_nullifier({0}::deserialize_content, note_header, compute_nullifier, serialized_note) }}" , note_type)).collect(); @@ -208,14 +208,14 @@ fn generate_compute_note_hash_and_optionally_a_nullifier_source( format!( " unconstrained fn compute_note_hash_and_optionally_a_nullifier( - contract_address: dep::aztec::protocol_types::address::AztecAddress, + contract_address: aztec::protocol_types::address::AztecAddress, nonce: Field, storage_slot: Field, note_type_id: Field, compute_nullifier: bool, serialized_note: [Field; {}], ) -> pub [Field; 4] {{ - let note_header = dep::aztec::prelude::NoteHeader::new(contract_address, nonce, storage_slot); + let note_header = aztec::prelude::NoteHeader::new(contract_address, nonce, storage_slot); {} }}", diff --git a/aztec_macros/src/transforms/contract_interface.rs b/aztec_macros/src/transforms/contract_interface.rs index 90f9ce6164a..e6ac43ad2c4 100644 --- a/aztec_macros/src/transforms/contract_interface.rs +++ b/aztec_macros/src/transforms/contract_interface.rs @@ -30,8 +30,8 @@ use crate::utils::{ // for i in 0..third_arg.len() { // args_acc = args_acc.append(third_arg[i].serialize().as_slice()); // } -// let args_hash = dep::aztec::hash::hash_args(args_acc); -// assert(args_hash == dep::aztec::oracle::arguments::pack_arguments(args_acc)); +// let args_hash = aztec::hash::hash_args(args_acc); +// assert(args_hash == aztec::oracle::arguments::pack_arguments(args_acc)); // PublicCallInterface { // target_contract: self.target_contract, // selector: FunctionSelector::from_signature("SELECTOR_PLACEHOLDER"), @@ -56,7 +56,10 @@ pub fn stub_function(aztec_visibility: &str, func: &NoirFunction, is_static_call .join(", "); let fn_return_type: noirc_frontend::ast::UnresolvedType = func.return_type(); - let fn_selector = format!("dep::aztec::protocol_types::abis::function_selector::FunctionSelector::from_signature(\"{}\")", SELECTOR_PLACEHOLDER); + let fn_selector = format!( + "aztec::protocol_types::abis::function_selector::FunctionSelector::from_signature(\"{}\")", + SELECTOR_PLACEHOLDER + ); let parameters = func.parameters(); let is_void = if matches!(fn_return_type.typ, UnresolvedTypeData::Unit) { "Void" } else { "" }; @@ -93,8 +96,8 @@ pub fn stub_function(aztec_visibility: &str, func: &NoirFunction, is_static_call format!( "let mut args_acc: [Field] = &[]; {} - let args_hash = dep::aztec::hash::hash_args(args_acc); - assert(args_hash == dep::aztec::oracle::arguments::pack_arguments(args_acc));", + let args_hash = aztec::hash::hash_args(args_acc); + assert(args_hash == aztec::oracle::arguments::pack_arguments(args_acc));", call_args ) } else { @@ -103,7 +106,7 @@ pub fn stub_function(aztec_visibility: &str, func: &NoirFunction, is_static_call let fn_body = format!( "{} - dep::aztec::context::{}{}{}CallInterface {{ + aztec::context::{}{}{}CallInterface {{ target_contract: self.target_contract, selector: {}, args_hash, @@ -111,7 +114,7 @@ pub fn stub_function(aztec_visibility: &str, func: &NoirFunction, is_static_call args_hash, aztec_visibility, is_static, is_void, fn_selector, ); format!( - "pub fn {}(self, {}) -> dep::aztec::context::{}{}{}CallInterface{} {{ + "pub fn {}(self, {}) -> aztec::context::{}{}{}CallInterface{} {{ {} }}", fn_name, fn_parameters, aztec_visibility, is_static, is_void, return_type_hint, fn_body @@ -125,16 +128,16 @@ pub fn stub_function(aztec_visibility: &str, func: &NoirFunction, is_static_call ); let fn_body = format!( "{} - dep::aztec::context::Public{}{}CallInterface {{ + aztec::context::Public{}{}CallInterface {{ target_contract: self.target_contract, selector: {}, args: args_acc, - gas_opts: dep::aztec::context::gas::GasOpts::default(), + gas_opts: aztec::context::gas::GasOpts::default(), }}", args, is_static, is_void, fn_selector, ); format!( - "pub fn {}(self, {}) -> dep::aztec::context::Public{}{}CallInterface{} {{ + "pub fn {}(self, {}) -> aztec::context::Public{}{}CallInterface{} {{ {} }}", fn_name, fn_parameters, is_static, is_void, return_type_hint, fn_body @@ -153,14 +156,14 @@ pub fn generate_contract_interface( let contract_interface = format!( " struct {0} {{ - target_contract: dep::aztec::protocol_types::address::AztecAddress + target_contract: aztec::protocol_types::address::AztecAddress }} impl {0} {{ {1} pub fn at( - target_contract: dep::aztec::protocol_types::address::AztecAddress + target_contract: aztec::protocol_types::address::AztecAddress ) -> Self {{ Self {{ target_contract }} }} @@ -168,7 +171,7 @@ pub fn generate_contract_interface( #[contract_library_method] pub fn at( - target_contract: dep::aztec::protocol_types::address::AztecAddress + target_contract: aztec::protocol_types::address::AztecAddress ) -> {0} {{ {0} {{ target_contract }} }} diff --git a/aztec_macros/src/transforms/note_interface.rs b/aztec_macros/src/transforms/note_interface.rs index fdce8b81db2..f0e7d0d5034 100644 --- a/aztec_macros/src/transforms/note_interface.rs +++ b/aztec_macros/src/transforms/note_interface.rs @@ -268,7 +268,7 @@ fn generate_note_get_header( ) -> Result { let function_source = format!( " - fn get_header(note: {}) -> dep::aztec::note::note_header::NoteHeader {{ + fn get_header(note: {}) -> aztec::note::note_header::NoteHeader {{ note.{} }} ", @@ -299,7 +299,7 @@ fn generate_note_set_header( ) -> Result { let function_source = format!( " - fn set_header(self: &mut {}, header: dep::aztec::note::note_header::NoteHeader) {{ + fn set_header(self: &mut {}, header: aztec::note::note_header::NoteHeader) {{ self.{} = header; }} ", @@ -488,7 +488,7 @@ fn generate_note_properties_fn( // Automatically generate the method to compute the note's content hash as: // fn compute_note_content_hash(self: NoteType) -> Field { -// dep::aztec::hash::pedersen_hash(self.serialize_content(), dep::aztec::protocol_types::constants::GENERATOR_INDEX__NOTE_CONTENT_HASH) +// aztec::hash::pedersen_hash(self.serialize_content(), aztec::protocol_types::constants::GENERATOR_INDEX__NOTE_CONTENT_HASH) // } // fn generate_compute_note_content_hash( @@ -498,7 +498,7 @@ fn generate_compute_note_content_hash( let function_source = format!( " fn compute_note_content_hash(self: {}) -> Field {{ - dep::aztec::hash::pedersen_hash(self.serialize_content(), dep::aztec::protocol_types::constants::GENERATOR_INDEX__NOTE_CONTENT_HASH) + aztec::hash::pedersen_hash(self.serialize_content(), aztec::protocol_types::constants::GENERATOR_INDEX__NOTE_CONTENT_HASH) }} ", note_type @@ -557,10 +557,7 @@ fn generate_note_properties_struct_source( .iter() .filter_map(|(field_name, _)| { if field_name != note_header_field_name { - Some(format!( - "{}: dep::aztec::note::note_getter_options::PropertySelector", - field_name - )) + Some(format!("{}: aztec::note::note_getter_options::PropertySelector", field_name)) } else { None } @@ -588,7 +585,7 @@ fn generate_note_properties_fn_source( .filter_map(|(index, (field_name, _))| { if field_name != note_header_field_name { Some(format!( - "{}: dep::aztec::note::note_getter_options::PropertySelector {{ index: {}, offset: 0, length: 32 }}", + "{}: aztec::note::note_getter_options::PropertySelector {{ index: {}, offset: 0, length: 32 }}", field_name, index )) @@ -665,10 +662,7 @@ fn generate_note_deserialize_content_source( ) } } else { - format!( - "{}: dep::aztec::note::note_header::NoteHeader::empty()", - note_header_field_name - ) + format!("{}: aztec::note::note_header::NoteHeader::empty()", note_header_field_name) } }) .collect::>() diff --git a/aztec_macros/src/transforms/storage.rs b/aztec_macros/src/transforms/storage.rs index a1c21c7efcf..8b778b4cca6 100644 --- a/aztec_macros/src/transforms/storage.rs +++ b/aztec_macros/src/transforms/storage.rs @@ -509,10 +509,10 @@ pub fn generate_storage_layout( let mut storable_fields_impl = vec![]; definition.fields.iter().enumerate().for_each(|(index, (field_ident, field_type))| { - storable_fields.push(format!("{}: dep::aztec::prelude::Storable", field_ident, index)); + storable_fields.push(format!("{}: aztec::prelude::Storable", field_ident, index)); generic_args.push(format!("N{}", index)); storable_fields_impl.push(format!( - "{}: dep::aztec::prelude::Storable {{ slot: 0, typ: \"{}\" }}", + "{}: aztec::prelude::Storable {{ slot: 0, typ: \"{}\" }}", field_ident, field_type.to_string().replace("plain::", "") )); diff --git a/aztec_macros/src/utils/ast_utils.rs b/aztec_macros/src/utils/ast_utils.rs index 48b3b25747b..4467c4bca4b 100644 --- a/aztec_macros/src/utils/ast_utils.rs +++ b/aztec_macros/src/utils/ast_utils.rs @@ -161,7 +161,7 @@ macro_rules! chained_dep { ( $base:expr $(, $tail:expr)* ) => { { let mut base_path = ident_path($base); - base_path.kind = PathKind::Dep; + base_path.kind = PathKind::Plain; $( base_path.segments.push(ident($tail)); )* diff --git a/compiler/integration-tests/circuits/assert_lt/src/main.nr b/compiler/integration-tests/circuits/assert_lt/src/main.nr index b8e255ca492..47e229d6c8b 100644 --- a/compiler/integration-tests/circuits/assert_lt/src/main.nr +++ b/compiler/integration-tests/circuits/assert_lt/src/main.nr @@ -1,10 +1,7 @@ -use dep::std; - fn main(x: u64, y: pub u64) -> pub u64 { // We include a println statement to show that noirJS will ignore this and continue execution std::println("foo"); - assert(x < y); x + y } diff --git a/compiler/integration-tests/circuits/recursion/src/main.nr b/compiler/integration-tests/circuits/recursion/src/main.nr index 173207766fb..94cae14daa7 100644 --- a/compiler/integration-tests/circuits/recursion/src/main.nr +++ b/compiler/integration-tests/circuits/recursion/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main( verification_key: [Field; 114], proof: [Field; 93], diff --git a/compiler/noirc_frontend/src/debug/mod.rs b/compiler/noirc_frontend/src/debug/mod.rs index f5866f5b756..443267380b5 100644 --- a/compiler/noirc_frontend/src/debug/mod.rs +++ b/compiler/noirc_frontend/src/debug/mod.rs @@ -470,7 +470,7 @@ impl DebugInstrumenter { .join(",\n"); let (program, errors) = parse_program(&format!( r#" - use dep::__debug::{{ + use __debug::{{ __debug_var_assign, __debug_var_drop, __debug_fn_enter, diff --git a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs index 4511537a1cc..4d64481bc9f 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs @@ -468,7 +468,7 @@ fn inject_prelude( let path = Path { segments: segments.clone(), - kind: crate::ast::PathKind::Dep, + kind: crate::ast::PathKind::Plain, span: Span::default(), }; @@ -489,7 +489,7 @@ fn inject_prelude( 0, ImportDirective { module_id: crate_root, - path: Path { segments, kind: PathKind::Dep, span: Span::default() }, + path: Path { segments, kind: PathKind::Plain, span: Span::default() }, alias: None, is_prelude: true, }, diff --git a/compiler/noirc_frontend/src/hir/resolution/import.rs b/compiler/noirc_frontend/src/hir/resolution/import.rs index 343113836ed..f3dae31e1e0 100644 --- a/compiler/noirc_frontend/src/hir/resolution/import.rs +++ b/compiler/noirc_frontend/src/hir/resolution/import.rs @@ -158,16 +158,34 @@ fn resolve_path_to_ns( allow_contracts, ) } - crate::ast::PathKind::Dep => resolve_external_dep( - def_map, - import_directive, - def_maps, - allow_contracts, - importing_crate, - ), crate::ast::PathKind::Plain => { - // Plain paths are only used to import children modules. It's possible to allow import of external deps, but maybe this distinction is better? - // In Rust they can also point to external Dependencies, if no children can be found with the specified name + // There is a possibility that the import path is empty + // In that case, early return + if import_path.is_empty() { + return resolve_name_in_module( + crate_id, + importing_crate, + import_path, + import_directive.module_id, + def_maps, + allow_contracts, + ); + } + + let current_mod_id = ModuleId { krate: crate_id, local_id: import_directive.module_id }; + let current_mod = &def_map.modules[current_mod_id.local_id.0]; + let first_segment = import_path.first().expect("ice: could not fetch first segment"); + if current_mod.find_name(first_segment).is_none() { + // Resolve externally when first segment is unresolved + return resolve_external_dep( + def_map, + import_directive, + def_maps, + allow_contracts, + importing_crate, + ); + } + resolve_name_in_module( crate_id, importing_crate, @@ -177,6 +195,14 @@ fn resolve_path_to_ns( allow_contracts, ) } + + crate::ast::PathKind::Dep => resolve_external_dep( + def_map, + import_directive, + def_maps, + allow_contracts, + importing_crate, + ), } } @@ -302,7 +328,9 @@ fn resolve_external_dep( .ok_or_else(|| PathResolutionError::Unresolved(crate_name.to_owned()))?; // Create an import directive for the dependency crate - let path_without_crate_name = &path[1..]; // XXX: This will panic if the path is of the form `use dep::std` Ideal algorithm will not distinguish between crate and module + // XXX: This will panic if the path is of the form `use std`. Ideal algorithm will not distinguish between crate and module + // See `singleton_import.nr` test case for a check that such cases are handled elsewhere. + let path_without_crate_name = &path[1..]; let path = Path { segments: path_without_crate_name.to_vec(), diff --git a/compiler/noirc_frontend/src/noir_parser.lalrpop b/compiler/noirc_frontend/src/noir_parser.lalrpop index c6cb788a5a4..5768e3c1d17 100644 --- a/compiler/noirc_frontend/src/noir_parser.lalrpop +++ b/compiler/noirc_frontend/src/noir_parser.lalrpop @@ -125,7 +125,7 @@ pub(crate) Path: Path = { }, "dep" "::" => { - let kind = PathKind::Dep; + let kind = PathKind::Plain; let span = Span::from(lo as u32..hi as u32); Path { segments, kind, span } }, diff --git a/compiler/noirc_frontend/src/parser/parser.rs b/compiler/noirc_frontend/src/parser/parser.rs index 0d8215f2ea4..e8838c58772 100644 --- a/compiler/noirc_frontend/src/parser/parser.rs +++ b/compiler/noirc_frontend/src/parser/parser.rs @@ -1445,7 +1445,7 @@ mod test { "use foo::{bar, hello}", "use foo::{bar as bar2, hello}", "use foo::{bar as bar2, hello::{foo}, nested::{foo, bar}}", - "use dep::{std::println, bar::baz}", + "use std::{println, bar::baz}", ]; let invalid_use_statements = [ diff --git a/compiler/noirc_frontend/src/parser/parser/path.rs b/compiler/noirc_frontend/src/parser/parser/path.rs index 47bb11991fa..e40268af410 100644 --- a/compiler/noirc_frontend/src/parser/parser/path.rs +++ b/compiler/noirc_frontend/src/parser/parser/path.rs @@ -25,7 +25,7 @@ fn empty_path() -> impl NoirParser { let make_path = |kind| move |_, span| Path { segments: Vec::new(), kind, span }; let path_kind = |key, kind| keyword(key).map_with_span(make_path(kind)); - choice((path_kind(Keyword::Crate, PathKind::Crate), path_kind(Keyword::Dep, PathKind::Dep))) + choice((path_kind(Keyword::Crate, PathKind::Crate), path_kind(Keyword::Dep, PathKind::Plain))) } pub(super) fn maybe_empty_path() -> impl NoirParser { @@ -43,7 +43,8 @@ mod test { ("std", vec!["std"]), ("std::hash", vec!["std", "hash"]), ("std::hash::collections", vec!["std", "hash", "collections"]), - ("dep::foo::bar", vec!["foo", "bar"]), + ("foo::bar", vec!["foo", "bar"]), + ("foo::bar", vec!["foo", "bar"]), ("crate::std::hash", vec!["std", "hash"]), ]; @@ -61,7 +62,7 @@ mod test { fn parse_path_kinds() { let cases = vec![ ("std", PathKind::Plain), - ("dep::hash::collections", PathKind::Dep), + ("hash::collections", PathKind::Plain), ("crate::std::hash", PathKind::Crate), ]; @@ -72,7 +73,7 @@ mod test { parse_all_failing( path(), - vec!["dep", "crate", "crate::std::crate", "foo::bar::crate", "foo::dep"], + vec!["crate", "crate::std::crate", "foo::bar::crate", "foo::dep"], ); } } diff --git a/compiler/wasm/test/fixtures/deps/lib-a/src/lib.nr b/compiler/wasm/test/fixtures/deps/lib-a/src/lib.nr index 3f8fa051daf..c38188d0119 100644 --- a/compiler/wasm/test/fixtures/deps/lib-a/src/lib.nr +++ b/compiler/wasm/test/fixtures/deps/lib-a/src/lib.nr @@ -1,4 +1,4 @@ -use dep::lib_b::assert_non_zero; +use lib_b::assert_non_zero; pub fn divide(a: u64, b: u64) -> u64 { assert_non_zero(b); diff --git a/compiler/wasm/test/fixtures/deps/lib-c/src/module/foo.nr b/compiler/wasm/test/fixtures/deps/lib-c/src/module/foo.nr index 0376cd4cb87..23b6659b3c5 100644 --- a/compiler/wasm/test/fixtures/deps/lib-c/src/module/foo.nr +++ b/compiler/wasm/test/fixtures/deps/lib-c/src/module/foo.nr @@ -1,3 +1,3 @@ pub fn bar(param: Field) -> Field { - dep::std::hash::pedersen_hash([param]) + std::hash::pedersen_hash([param]) } diff --git a/compiler/wasm/test/fixtures/noir-contract/src/main.nr b/compiler/wasm/test/fixtures/noir-contract/src/main.nr index fc1dc8a5a17..6f63850e3a0 100644 --- a/compiler/wasm/test/fixtures/noir-contract/src/main.nr +++ b/compiler/wasm/test/fixtures/noir-contract/src/main.nr @@ -1,5 +1,5 @@ contract TestContract { - use dep::test::module::foo; + use test::module::foo; fn constructor(param: Field, pub_param: pub Field) -> pub [Field; 2] { [foo::bar(param), param + pub_param] diff --git a/compiler/wasm/test/fixtures/with-deps/src/main.nr b/compiler/wasm/test/fixtures/with-deps/src/main.nr index 056bcc180b4..fe9e7f9ca77 100644 --- a/compiler/wasm/test/fixtures/with-deps/src/main.nr +++ b/compiler/wasm/test/fixtures/with-deps/src/main.nr @@ -1,4 +1,4 @@ -use dep::lib_a::divide; +use lib_a::divide; fn main(x: u64, y: pub u64) { divide(x, y); } diff --git a/docs/docs/how_to/merkle-proof.mdx b/docs/docs/how_to/merkle-proof.mdx index 16c425bed76..0a128adb2de 100644 --- a/docs/docs/how_to/merkle-proof.mdx +++ b/docs/docs/how_to/merkle-proof.mdx @@ -12,7 +12,6 @@ Let's walk through an example of a merkle membership proof in Noir that proves t in a merkle tree. ```rust -use dep::std; fn main(message : [Field; 62], index : Field, hashpath : [Field; 40], root : Field) { let leaf = std::hash::hash_to_field(message.as_slice()); diff --git a/docs/docs/noir/concepts/data_types/integers.md b/docs/docs/noir/concepts/data_types/integers.md index c14fffa7174..a1d59bf3166 100644 --- a/docs/docs/noir/concepts/data_types/integers.md +++ b/docs/docs/noir/concepts/data_types/integers.md @@ -149,7 +149,6 @@ fn wrapping_mul(x: T, y: T) -> T; Example of how it is used: ```rust -use dep::std; fn main(x: u8, y: u8) -> pub u8 { std::wrapping_add(x, y) diff --git a/docs/docs/noir/concepts/data_types/slices.mdx b/docs/docs/noir/concepts/data_types/slices.mdx index 4eccc677b80..dff08d63ffb 100644 --- a/docs/docs/noir/concepts/data_types/slices.mdx +++ b/docs/docs/noir/concepts/data_types/slices.mdx @@ -12,9 +12,7 @@ import Experimental from '@site/src/components/Notes/_experimental.mdx'; A slice is a dynamically-sized view into a sequence of elements. They can be resized at runtime, but because they don't own the data, they cannot be returned from a circuit. You can treat slices as arrays without a constrained size. ```rust -use dep::std::slice; - -fn main() -> pub Field { +fn main() -> pub u32 { let mut slice: [Field] = &[0; 2]; let mut new_slice = slice.push_back(6); diff --git a/docs/docs/noir/concepts/data_types/strings.md b/docs/docs/noir/concepts/data_types/strings.md index 8ab5825a4c4..1fdee42425e 100644 --- a/docs/docs/noir/concepts/data_types/strings.md +++ b/docs/docs/noir/concepts/data_types/strings.md @@ -20,7 +20,6 @@ You can use strings in `assert()` functions or print them with `println()`. See more about [Logging](../../standard_library/logging.md). ```rust -use dep::std; fn main(message : pub str<11>, hex_as_string : str<4>) { println(message); diff --git a/docs/docs/noir/concepts/traits.md b/docs/docs/noir/concepts/traits.md index ef1445a5907..df7cb9ebda0 100644 --- a/docs/docs/noir/concepts/traits.md +++ b/docs/docs/noir/concepts/traits.md @@ -372,13 +372,13 @@ impls for any trait we need on it. ```rust struct Wrapper { - foo: dep::some_library::Foo, + foo: some_library::Foo, } impl Default for Wrapper { fn default() -> Wrapper { Wrapper { - foo: dep::some_library::Foo::new(), + foo: some_library::Foo::new(), } } } diff --git a/docs/docs/noir/modules_packages_crates/dependencies.md b/docs/docs/noir/modules_packages_crates/dependencies.md index 2c028d85853..24e02de08fe 100644 --- a/docs/docs/noir/modules_packages_crates/dependencies.md +++ b/docs/docs/noir/modules_packages_crates/dependencies.md @@ -70,15 +70,15 @@ You can import a dependency to a Noir file using the following syntax. For examp ecrecover-noir library and local lib_a referenced above: ```rust -use dep::ecrecover; -use dep::lib_a; +use ecrecover; +use lib_a; ``` You can also import only the specific parts of dependency that you want to use, like so: ```rust -use dep::std::hash::sha256; -use dep::std::scalar_mul::fixed_base_embedded_curve; +use std::hash::sha256; +use std::scalar_mul::fixed_base_embedded_curve; ``` Lastly, as demonstrated in the @@ -86,7 +86,7 @@ Lastly, as demonstrated in the can import multiple items in the same line by enclosing them in curly braces: ```rust -use dep::std::ec::tecurve::affine::{Curve, Point}; +use std::ec::tecurve::affine::{Curve, Point}; ``` We don't have a way to consume libraries from inside a [workspace](./workspaces.md) as external dependencies right now. @@ -100,7 +100,7 @@ Note that when you import a dependency, you also get access to all of the depend For example, the [phy_vector](https://github.com/resurgencelabs/phy_vector) library imports an [fraction](https://github.com/resurgencelabs/fraction) library. If you're importing the phy_vector library, then you can access the functions in fractions library like so: ```rust -use dep::phy_vector; +use phy_vector; fn main(x : Field, y : pub Field) { //... diff --git a/docs/docs/noir/standard_library/containers/hashmap.md b/docs/docs/noir/standard_library/containers/hashmap.md index 2b9f4895722..651e7f5723b 100644 --- a/docs/docs/noir/standard_library/containers/hashmap.md +++ b/docs/docs/noir/standard_library/containers/hashmap.md @@ -21,7 +21,7 @@ Example: ```rust // Create a mapping from Fields to u32s with a maximum length of 12 // using a poseidon2 hasher -use dep::std::hash::poseidon2::Poseidon2Hasher; +use std::hash::poseidon2::Poseidon2Hasher; let mut map: HashMap> = HashMap::default(); map.insert(1, 2); diff --git a/docs/docs/noir/standard_library/cryptographic_primitives/ec_primitives.md b/docs/docs/noir/standard_library/cryptographic_primitives/ec_primitives.md index d2b42d67b7c..f839b4a228e 100644 --- a/docs/docs/noir/standard_library/cryptographic_primitives/ec_primitives.md +++ b/docs/docs/noir/standard_library/cryptographic_primitives/ec_primitives.md @@ -81,7 +81,7 @@ from the private key. This is a matter of using scalar multiplication. In the ca for example, this code would do: ```rust -use dep::std::ec::tecurve::affine::{Curve, Point}; +use std::ec::tecurve::affine::{Curve, Point}; fn bjj_pub_key(priv_key: Field) -> Point { diff --git a/docs/docs/noir/standard_library/cryptographic_primitives/eddsa.mdx b/docs/docs/noir/standard_library/cryptographic_primitives/eddsa.mdx index 789d26ce426..1ad42a5ac96 100644 --- a/docs/docs/noir/standard_library/cryptographic_primitives/eddsa.mdx +++ b/docs/docs/noir/standard_library/cryptographic_primitives/eddsa.mdx @@ -18,7 +18,7 @@ fn eddsa_poseidon_verify(public_key_x : Field, public_key_y : Field, signature_s It is also possible to specify the hash algorithm used for the signature by using the `eddsa_verify` function by passing a type implementing the Hasher trait with the turbofish operator. For instance, if you want to use Poseidon2 instead, you can do the following: ```rust -use dep::std::hash::poseidon2::Poseidon2Hasher; +use std::hash::poseidon2::Poseidon2Hasher; eddsa_verify::(pub_key_a.x, pub_key_a.y, s_a, r8_a.x, r8_a.y, msg); ``` diff --git a/docs/docs/noir/standard_library/recursion.md b/docs/docs/noir/standard_library/recursion.md index cb3e7a9fcdf..8cfb37fc52d 100644 --- a/docs/docs/noir/standard_library/recursion.md +++ b/docs/docs/noir/standard_library/recursion.md @@ -40,7 +40,6 @@ pub fn verify_proof(verification_key: [Field], proof: [Field], public_inputs: [F ## Example usage ```rust -use dep::std; fn main( verification_key : [Field; 114], diff --git a/examples/recursion/recurse_leaf/src/main.nr b/examples/recursion/recurse_leaf/src/main.nr index b6a2b49b219..4859e84d49e 100644 --- a/examples/recursion/recurse_leaf/src/main.nr +++ b/examples/recursion/recurse_leaf/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - #[recursive] fn main( verification_key: [Field; 114], @@ -17,4 +15,4 @@ fn main( ); // Take output of previous proof and add another number to it. public_inputs[2] as u64 + num -} \ No newline at end of file +} diff --git a/examples/recursion/recurse_node/src/main.nr b/examples/recursion/recurse_node/src/main.nr index 7c983dcf050..60192493b54 100644 --- a/examples/recursion/recurse_node/src/main.nr +++ b/examples/recursion/recurse_node/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main( verification_key: [Field; 114], public_inputs: pub [Field; 4], @@ -14,4 +12,4 @@ fn main( key_hash ); public_inputs[3] as u64 -} \ No newline at end of file +} diff --git a/test_programs/benchmarks/bench_eddsa_poseidon/src/main.nr b/test_programs/benchmarks/bench_eddsa_poseidon/src/main.nr index 31c2f1f2d13..cb853e48c30 100644 --- a/test_programs/benchmarks/bench_eddsa_poseidon/src/main.nr +++ b/test_programs/benchmarks/bench_eddsa_poseidon/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::eddsa::{eddsa_poseidon_verify}; +use std::eddsa::eddsa_poseidon_verify; fn main( msg: pub Field, @@ -9,4 +9,4 @@ fn main( s: Field ) -> pub bool { eddsa_poseidon_verify(pub_key_x, pub_key_y, s, r8_x, r8_y, msg) -} \ No newline at end of file +} diff --git a/test_programs/benchmarks/bench_poseidon_hash/src/main.nr b/test_programs/benchmarks/bench_poseidon_hash/src/main.nr index 38adeef6ec7..9900e91c1d7 100644 --- a/test_programs/benchmarks/bench_poseidon_hash/src/main.nr +++ b/test_programs/benchmarks/bench_poseidon_hash/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::hash::poseidon; +use std::hash::poseidon; fn main(input: [Field; 2]) -> pub Field { poseidon::bn254::hash_2(input) diff --git a/test_programs/benchmarks/bench_poseidon_hash_100/src/main.nr b/test_programs/benchmarks/bench_poseidon_hash_100/src/main.nr index fc9a5b7a970..1c9bbfe61bf 100644 --- a/test_programs/benchmarks/bench_poseidon_hash_100/src/main.nr +++ b/test_programs/benchmarks/bench_poseidon_hash_100/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::hash; +use std::hash; global SIZE = 100; @@ -9,4 +9,4 @@ fn main(input: [[Field; 2]; SIZE]) -> pub [Field; SIZE] { } results -} \ No newline at end of file +} diff --git a/test_programs/benchmarks/bench_poseidon_hash_30/src/main.nr b/test_programs/benchmarks/bench_poseidon_hash_30/src/main.nr index 4d2d94e4946..3edb47e9f72 100644 --- a/test_programs/benchmarks/bench_poseidon_hash_30/src/main.nr +++ b/test_programs/benchmarks/bench_poseidon_hash_30/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::hash; +use std::hash; global SIZE = 30; @@ -9,4 +9,4 @@ fn main(input: [[Field; 2]; SIZE]) -> pub [Field; SIZE] { } results -} \ No newline at end of file +} diff --git a/test_programs/benchmarks/bench_sha256_100/src/main.nr b/test_programs/benchmarks/bench_sha256_100/src/main.nr index d78ca8002d2..6df856a83fc 100644 --- a/test_programs/benchmarks/bench_sha256_100/src/main.nr +++ b/test_programs/benchmarks/bench_sha256_100/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - global SIZE = 100; fn main(input: [[u8; 2]; SIZE]) -> pub [[u8; 32]; SIZE] { @@ -9,4 +7,4 @@ fn main(input: [[u8; 2]; SIZE]) -> pub [[u8; 32]; SIZE] { } results -} \ No newline at end of file +} diff --git a/test_programs/benchmarks/bench_sha256_30/src/main.nr b/test_programs/benchmarks/bench_sha256_30/src/main.nr index fa66d626586..220c1cfbbed 100644 --- a/test_programs/benchmarks/bench_sha256_30/src/main.nr +++ b/test_programs/benchmarks/bench_sha256_30/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - global SIZE = 30; fn main(input: [[u8; 2]; SIZE]) -> pub [[u8; 32]; SIZE] { @@ -9,4 +7,4 @@ fn main(input: [[u8; 2]; SIZE]) -> pub [[u8; 32]; SIZE] { } results -} \ No newline at end of file +} diff --git a/test_programs/compile_failure/array_length_defaulting/src/main.nr b/test_programs/compile_failure/array_length_defaulting/src/main.nr index 216a9ae3f0c..40543db2870 100644 --- a/test_programs/compile_failure/array_length_defaulting/src/main.nr +++ b/test_programs/compile_failure/array_length_defaulting/src/main.nr @@ -1,5 +1,5 @@ fn main() { - let x = dep::std::unsafe::zeroed(); + let x = std::unsafe::zeroed(); foo(x); } diff --git a/test_programs/compile_failure/assert_constant_fail/src/main.nr b/test_programs/compile_failure/assert_constant_fail/src/main.nr index cf682607083..b8d5d255228 100644 --- a/test_programs/compile_failure/assert_constant_fail/src/main.nr +++ b/test_programs/compile_failure/assert_constant_fail/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::assert_constant; +use std::assert_constant; fn main(x: Field) { foo(5, x); diff --git a/test_programs/compile_failure/brillig_nested_slices/src/main.nr b/test_programs/compile_failure/brillig_nested_slices/src/main.nr index 3d8a6748ccf..ee61195cf8f 100644 --- a/test_programs/compile_failure/brillig_nested_slices/src/main.nr +++ b/test_programs/compile_failure/brillig_nested_slices/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::slice; +use std::slice; // Tests nested slice passing to/from functions unconstrained fn push_back_to_slice(slice: [T], item: T) -> [T] { slice.push_back(item) diff --git a/test_programs/compile_failure/dep_impl_primitive/src/main.nr b/test_programs/compile_failure/dep_impl_primitive/src/main.nr index e61ae82b62c..40578574c75 100644 --- a/test_programs/compile_failure/dep_impl_primitive/src/main.nr +++ b/test_programs/compile_failure/dep_impl_primitive/src/main.nr @@ -1,4 +1,4 @@ -use dep::bad_impl; +use bad_impl; fn main(x: Field) { x.something(); diff --git a/test_programs/compile_failure/dep_submodule_overlap/Nargo.toml b/test_programs/compile_failure/dep_submodule_overlap/Nargo.toml new file mode 100644 index 00000000000..0d5a6221ef2 --- /dev/null +++ b/test_programs/compile_failure/dep_submodule_overlap/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "dep_submodule_overlap" +type = "bin" +authors = [""] +compiler_version = ">=0.28.0" + +[dependencies] +reexporting_lib = { path = "../../test_libraries/reexporting_lib" } diff --git a/test_programs/compile_failure/dep_submodule_overlap/src/lib.nr b/test_programs/compile_failure/dep_submodule_overlap/src/lib.nr new file mode 100644 index 00000000000..e2e82b2f5cd --- /dev/null +++ b/test_programs/compile_failure/dep_submodule_overlap/src/lib.nr @@ -0,0 +1,3 @@ +struct MyStruct { + inner: Field +} diff --git a/test_programs/compile_failure/dep_submodule_overlap/src/main.nr b/test_programs/compile_failure/dep_submodule_overlap/src/main.nr new file mode 100644 index 00000000000..c53630c53ca --- /dev/null +++ b/test_programs/compile_failure/dep_submodule_overlap/src/main.nr @@ -0,0 +1,9 @@ +use reexporting_lib::{MyStruct, lib}; + +mod lib; +use crate::lib::MyStruct; + +fn main() { + let x = MyStruct { inner: 0 }; + assert(lib::is_struct_zero(x)); +} diff --git a/test_programs/compile_failure/depend_on_bin/src/main.nr b/test_programs/compile_failure/depend_on_bin/src/main.nr index 4e03e8eb41e..d7aff600fe6 100644 --- a/test_programs/compile_failure/depend_on_bin/src/main.nr +++ b/test_programs/compile_failure/depend_on_bin/src/main.nr @@ -1,4 +1,4 @@ -use dep::bin_dep; +use bin_dep; fn main(x : Field) { assert(x == 1); diff --git a/test_programs/compile_failure/negate_unsigned/src/main.nr b/test_programs/compile_failure/negate_unsigned/src/main.nr index db5f9b0820f..4d3c5abe5a4 100644 --- a/test_programs/compile_failure/negate_unsigned/src/main.nr +++ b/test_programs/compile_failure/negate_unsigned/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { let var = -1 as u8; std::println(var); diff --git a/test_programs/compile_failure/orphaned_trait_impl/src/main.nr b/test_programs/compile_failure/orphaned_trait_impl/src/main.nr index dfd88d8f074..dd04aa454b2 100644 --- a/test_programs/compile_failure/orphaned_trait_impl/src/main.nr +++ b/test_programs/compile_failure/orphaned_trait_impl/src/main.nr @@ -1,4 +1,4 @@ -impl dep::crate1::MyTrait for dep::crate2::MyStruct { +impl crate1::MyTrait for crate2::MyStruct { } fn main(x: Field, y: pub Field) { diff --git a/test_programs/compile_failure/overlapping_dep_and_mod/Nargo.toml b/test_programs/compile_failure/overlapping_dep_and_mod/Nargo.toml new file mode 100644 index 00000000000..b2c3e5f94be --- /dev/null +++ b/test_programs/compile_failure/overlapping_dep_and_mod/Nargo.toml @@ -0,0 +1,6 @@ +[workspace] +members = [ + "bin", + "foo", +] +default-member = "bin" diff --git a/test_programs/compile_failure/overlapping_dep_and_mod/bin/Nargo.toml b/test_programs/compile_failure/overlapping_dep_and_mod/bin/Nargo.toml new file mode 100644 index 00000000000..57e704462db --- /dev/null +++ b/test_programs/compile_failure/overlapping_dep_and_mod/bin/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "overlapping_dep_and_mod" +type = "bin" +authors = [""] +compiler_version = ">=0.29.0" + +[dependencies] +foo = { path = "../foo" } diff --git a/test_programs/compile_failure/overlapping_dep_and_mod/bin/Prover.toml b/test_programs/compile_failure/overlapping_dep_and_mod/bin/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test_programs/compile_failure/overlapping_dep_and_mod/bin/src/main.nr b/test_programs/compile_failure/overlapping_dep_and_mod/bin/src/main.nr new file mode 100644 index 00000000000..675e889b7e5 --- /dev/null +++ b/test_programs/compile_failure/overlapping_dep_and_mod/bin/src/main.nr @@ -0,0 +1,12 @@ +fn main() -> pub Field { + assert(foo::bar() + foo::baz() == 3); + assert(foo::bar() == 1); + assert(foo::baz() == 2); + foo::bar() + foo::baz() +} + +mod foo { + pub(crate) fn bar() -> Field { + 1 + } +} diff --git a/test_programs/compile_failure/overlapping_dep_and_mod/foo/Nargo.toml b/test_programs/compile_failure/overlapping_dep_and_mod/foo/Nargo.toml new file mode 100644 index 00000000000..857d4e722a8 --- /dev/null +++ b/test_programs/compile_failure/overlapping_dep_and_mod/foo/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "foo" +type = "lib" +authors = [""] +compiler_version = ">=0.29.0" + +[dependencies] diff --git a/test_programs/compile_failure/overlapping_dep_and_mod/foo/src/lib.nr b/test_programs/compile_failure/overlapping_dep_and_mod/foo/src/lib.nr new file mode 100644 index 00000000000..7834e2c9276 --- /dev/null +++ b/test_programs/compile_failure/overlapping_dep_and_mod/foo/src/lib.nr @@ -0,0 +1,3 @@ +pub fn baz() -> Field { + 2 +} diff --git a/test_programs/compile_failure/restricted_bit_sizes/src/main.nr b/test_programs/compile_failure/restricted_bit_sizes/src/main.nr index 01e72bfcfd7..a3fea13cc3a 100644 --- a/test_programs/compile_failure/restricted_bit_sizes/src/main.nr +++ b/test_programs/compile_failure/restricted_bit_sizes/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::assert_constant; +use std::assert_constant; fn main() -> pub u63 { 5 diff --git a/test_programs/compile_failure/turbofish_generic_count/src/main.nr b/test_programs/compile_failure/turbofish_generic_count/src/main.nr index a360641fa15..4091b2f0581 100644 --- a/test_programs/compile_failure/turbofish_generic_count/src/main.nr +++ b/test_programs/compile_failure/turbofish_generic_count/src/main.nr @@ -1,4 +1,3 @@ - struct Bar { one: Field, two: Field, @@ -7,7 +6,7 @@ struct Bar { impl Bar { fn zeroed(_self: Self) -> A { - dep::std::unsafe::zeroed() + std::unsafe::zeroed() } } diff --git a/test_programs/compile_success_empty/conditional_regression_to_bits/src/main.nr b/test_programs/compile_success_empty/conditional_regression_to_bits/src/main.nr index 5446cfbb1e4..9b5d95c11bc 100644 --- a/test_programs/compile_success_empty/conditional_regression_to_bits/src/main.nr +++ b/test_programs/compile_success_empty/conditional_regression_to_bits/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { //Regression for to_le_bits() constant evaluation // binary array representation of u8 1 diff --git a/test_programs/compile_success_empty/ec_baby_jubjub/src/main.nr b/test_programs/compile_success_empty/ec_baby_jubjub/src/main.nr index becd3c8927a..fa6be84c26e 100644 --- a/test_programs/compile_success_empty/ec_baby_jubjub/src/main.nr +++ b/test_programs/compile_success_empty/ec_baby_jubjub/src/main.nr @@ -1,14 +1,14 @@ // Tests may be checked against https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve/tree/main/poc -use dep::std::ec::tecurve::affine::Curve as AffineCurve; -use dep::std::ec::tecurve::affine::Point as Gaffine; -use dep::std::ec::tecurve::curvegroup::Curve; -use dep::std::ec::tecurve::curvegroup::Point as G; +use std::ec::tecurve::affine::Curve as AffineCurve; +use std::ec::tecurve::affine::Point as Gaffine; +use std::ec::tecurve::curvegroup::Curve; +use std::ec::tecurve::curvegroup::Point as G; -use dep::std::ec::swcurve::affine::Point as SWGaffine; -use dep::std::ec::swcurve::curvegroup::Point as SWG; +use std::ec::swcurve::affine::Point as SWGaffine; +use std::ec::swcurve::curvegroup::Point as SWG; -use dep::std::ec::montcurve::affine::Point as MGaffine; -use dep::std::ec::montcurve::curvegroup::Point as MG; +use std::ec::montcurve::affine::Point as MGaffine; +use std::ec::montcurve::curvegroup::Point as MG; fn main() { // This test only makes sense if Field is the right prime field. diff --git a/test_programs/compile_success_empty/intrinsic_die/src/main.nr b/test_programs/compile_success_empty/intrinsic_die/src/main.nr index a6c6d3df9a1..c6e269c155d 100644 --- a/test_programs/compile_success_empty/intrinsic_die/src/main.nr +++ b/test_programs/compile_success_empty/intrinsic_die/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // This test checks that we perform dead-instruction-elimination on intrinsic functions. fn main(x: Field) { let hash = std::hash::pedersen_commitment([x]); diff --git a/test_programs/compile_success_empty/method_call_regression/src/main.nr b/test_programs/compile_success_empty/method_call_regression/src/main.nr index 8bb7ebcac45..88b8dc57196 100644 --- a/test_programs/compile_success_empty/method_call_regression/src/main.nr +++ b/test_programs/compile_success_empty/method_call_regression/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { // s: Struct let s = Struct { b: () }; diff --git a/test_programs/compile_success_empty/overlapping_dep_and_mod/Nargo.toml b/test_programs/compile_success_empty/overlapping_dep_and_mod/Nargo.toml new file mode 100644 index 00000000000..b2c3e5f94be --- /dev/null +++ b/test_programs/compile_success_empty/overlapping_dep_and_mod/Nargo.toml @@ -0,0 +1,6 @@ +[workspace] +members = [ + "bin", + "foo", +] +default-member = "bin" diff --git a/test_programs/compile_success_empty/overlapping_dep_and_mod/bin/Nargo.toml b/test_programs/compile_success_empty/overlapping_dep_and_mod/bin/Nargo.toml new file mode 100644 index 00000000000..57e704462db --- /dev/null +++ b/test_programs/compile_success_empty/overlapping_dep_and_mod/bin/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "overlapping_dep_and_mod" +type = "bin" +authors = [""] +compiler_version = ">=0.29.0" + +[dependencies] +foo = { path = "../foo" } diff --git a/test_programs/compile_success_empty/overlapping_dep_and_mod/bin/src/main.nr b/test_programs/compile_success_empty/overlapping_dep_and_mod/bin/src/main.nr new file mode 100644 index 00000000000..1d9c917d91a --- /dev/null +++ b/test_programs/compile_success_empty/overlapping_dep_and_mod/bin/src/main.nr @@ -0,0 +1,9 @@ +fn main() { + let _ = foo::bar() + dep::foo::baz(); +} + +mod foo { + pub(crate) fn bar() -> Field { + 5 + } +} diff --git a/test_programs/compile_success_empty/overlapping_dep_and_mod/foo/Nargo.toml b/test_programs/compile_success_empty/overlapping_dep_and_mod/foo/Nargo.toml new file mode 100644 index 00000000000..857d4e722a8 --- /dev/null +++ b/test_programs/compile_success_empty/overlapping_dep_and_mod/foo/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "foo" +type = "lib" +authors = [""] +compiler_version = ">=0.29.0" + +[dependencies] diff --git a/test_programs/compile_success_empty/overlapping_dep_and_mod/foo/src/lib.nr b/test_programs/compile_success_empty/overlapping_dep_and_mod/foo/src/lib.nr new file mode 100644 index 00000000000..cb8392ed275 --- /dev/null +++ b/test_programs/compile_success_empty/overlapping_dep_and_mod/foo/src/lib.nr @@ -0,0 +1,5 @@ +// foo/lib.nr + +pub fn baz() -> Field { + 6 +} diff --git a/test_programs/compile_success_empty/reexports/src/main.nr b/test_programs/compile_success_empty/reexports/src/main.nr index ed469ff77d0..0fd65a33564 100644 --- a/test_programs/compile_success_empty/reexports/src/main.nr +++ b/test_programs/compile_success_empty/reexports/src/main.nr @@ -1,4 +1,4 @@ -use dep::reexporting_lib::{FooStruct, MyStruct, lib}; +use reexporting_lib::{FooStruct, MyStruct, lib}; fn main() { let x: FooStruct = MyStruct { inner: 0 }; diff --git a/test_programs/compile_success_empty/regression_2099/src/main.nr b/test_programs/compile_success_empty/regression_2099/src/main.nr index f92373ce63a..660f72f56e5 100644 --- a/test_programs/compile_success_empty/regression_2099/src/main.nr +++ b/test_programs/compile_success_empty/regression_2099/src/main.nr @@ -1,13 +1,13 @@ -use dep::std::ec::tecurve::affine::Curve as AffineCurve; -use dep::std::ec::tecurve::affine::Point as Gaffine; -use dep::std::ec::tecurve::curvegroup::Curve; -use dep::std::ec::tecurve::curvegroup::Point as G; +use std::ec::tecurve::affine::Curve as AffineCurve; +use std::ec::tecurve::affine::Point as Gaffine; +use std::ec::tecurve::curvegroup::Curve; +use std::ec::tecurve::curvegroup::Point as G; -use dep::std::ec::swcurve::affine::Point as SWGaffine; -use dep::std::ec::swcurve::curvegroup::Point as SWG; +use std::ec::swcurve::affine::Point as SWGaffine; +use std::ec::swcurve::curvegroup::Point as SWG; -use dep::std::ec::montcurve::affine::Point as MGaffine; -use dep::std::ec::montcurve::curvegroup::Point as MG; +use std::ec::montcurve::affine::Point as MGaffine; +use std::ec::montcurve::curvegroup::Point as MG; fn main() { // Define Baby Jubjub (ERC-2494) parameters in affine representation diff --git a/test_programs/compile_success_empty/regression_3635/src/main.nr b/test_programs/compile_success_empty/regression_3635/src/main.nr index 97a04f9d93f..edc6d8690e8 100644 --- a/test_programs/compile_success_empty/regression_3635/src/main.nr +++ b/test_programs/compile_success_empty/regression_3635/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { let x: u8 = 0x61; let y: u8 = "a".as_bytes()[0]; diff --git a/test_programs/compile_success_empty/str_as_bytes/src/main.nr b/test_programs/compile_success_empty/str_as_bytes/src/main.nr index 6fdd926ce7f..1330924e501 100644 --- a/test_programs/compile_success_empty/str_as_bytes/src/main.nr +++ b/test_programs/compile_success_empty/str_as_bytes/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; fn main() { let a = "hello"; let b = a.as_bytes(); diff --git a/test_programs/compile_success_empty/trait_default_implementation/src/main.nr b/test_programs/compile_success_empty/trait_default_implementation/src/main.nr index 2f5bff8c40c..90c375b6010 100644 --- a/test_programs/compile_success_empty/trait_default_implementation/src/main.nr +++ b/test_programs/compile_success_empty/trait_default_implementation/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - trait MyDefault { fn my_default(x: Field, y: Field) -> Self; diff --git a/test_programs/compile_success_empty/trait_override_implementation/src/main.nr b/test_programs/compile_success_empty/trait_override_implementation/src/main.nr index 85528291870..21d89b1b261 100644 --- a/test_programs/compile_success_empty/trait_override_implementation/src/main.nr +++ b/test_programs/compile_success_empty/trait_override_implementation/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - trait MyDefault { fn my_default(x: Field, y: Field) -> Self; diff --git a/test_programs/compile_success_empty/traits/src/main.nr b/test_programs/compile_success_empty/traits/src/main.nr index ed804559fed..0a5644e7530 100644 --- a/test_programs/compile_success_empty/traits/src/main.nr +++ b/test_programs/compile_success_empty/traits/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - trait MyDefault { fn my_default(x: Field, y: Field) -> Self; } diff --git a/test_programs/compile_success_empty/vectors/src/main.nr b/test_programs/compile_success_empty/vectors/src/main.nr index d105ceed180..ac02a4691dd 100644 --- a/test_programs/compile_success_empty/vectors/src/main.nr +++ b/test_programs/compile_success_empty/vectors/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::collections::vec::Vec; +use std::collections::vec::Vec; fn main(x: Field, y: pub Field) { let mut vector = Vec::new(); diff --git a/test_programs/compile_success_empty/workspace_reexport_bug/binary/src/main.nr b/test_programs/compile_success_empty/workspace_reexport_bug/binary/src/main.nr index ab0ae9a48b8..a4207794a8a 100644 --- a/test_programs/compile_success_empty/workspace_reexport_bug/binary/src/main.nr +++ b/test_programs/compile_success_empty/workspace_reexport_bug/binary/src/main.nr @@ -1,2 +1,2 @@ -use dep::library::ReExportMeFromAnotherLib; +use library::ReExportMeFromAnotherLib; fn main(_x: ReExportMeFromAnotherLib) {} diff --git a/test_programs/compile_success_empty/workspace_reexport_bug/library/src/lib.nr b/test_programs/compile_success_empty/workspace_reexport_bug/library/src/lib.nr index 8e84662ed03..e3a1539ea65 100644 --- a/test_programs/compile_success_empty/workspace_reexport_bug/library/src/lib.nr +++ b/test_programs/compile_success_empty/workspace_reexport_bug/library/src/lib.nr @@ -1,2 +1,2 @@ // Re-export -use dep::library2::ReExportMeFromAnotherLib; +use library2::ReExportMeFromAnotherLib; diff --git a/test_programs/execution_failure/div_by_zero_constants/src/main.nr b/test_programs/execution_failure/div_by_zero_constants/src/main.nr index 58adc5444b1..f90b3ef9429 100644 --- a/test_programs/execution_failure/div_by_zero_constants/src/main.nr +++ b/test_programs/execution_failure/div_by_zero_constants/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { let a: Field = 3 / 0; std::println(a); diff --git a/test_programs/execution_failure/div_by_zero_numerator_witness/src/main.nr b/test_programs/execution_failure/div_by_zero_numerator_witness/src/main.nr index f51b26d5ba1..012e823b297 100644 --- a/test_programs/execution_failure/div_by_zero_numerator_witness/src/main.nr +++ b/test_programs/execution_failure/div_by_zero_numerator_witness/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(x: Field) { let a: Field = x / 0; std::println(a); diff --git a/test_programs/execution_failure/div_by_zero_witness/src/main.nr b/test_programs/execution_failure/div_by_zero_witness/src/main.nr index a814f88f320..eaa3c1f2a72 100644 --- a/test_programs/execution_failure/div_by_zero_witness/src/main.nr +++ b/test_programs/execution_failure/div_by_zero_witness/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // It is expected that `y` must be equal to 0. fn main(x: Field, y: pub Field) { let a: Field = x / y; diff --git a/test_programs/execution_failure/hashmap_load_factor/src/main.nr b/test_programs/execution_failure/hashmap_load_factor/src/main.nr index 907c3628142..e95da67a084 100644 --- a/test_programs/execution_failure/hashmap_load_factor/src/main.nr +++ b/test_programs/execution_failure/hashmap_load_factor/src/main.nr @@ -1,6 +1,6 @@ -use dep::std::collections::map::HashMap; -use dep::std::hash::BuildHasherDefault; -use dep::std::hash::poseidon2::Poseidon2Hasher; +use std::collections::map::HashMap; +use std::hash::BuildHasherDefault; +use std::hash::poseidon2::Poseidon2Hasher; struct Entry{ key: Field, diff --git a/test_programs/execution_success/4_sub/src/main.nr b/test_programs/execution_success/4_sub/src/main.nr index 6aef8e7b208..2b4fc395705 100644 --- a/test_programs/execution_success/4_sub/src/main.nr +++ b/test_programs/execution_success/4_sub/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Test unsafe integer subtraction with underflow: 12 - 2418266113 = 1876701195 modulo 2^32 fn main(mut x: u32, y: u32, z: u32) { x = std::wrapping_sub(x,y); diff --git a/test_programs/execution_success/5_over/src/main.nr b/test_programs/execution_success/5_over/src/main.nr index 313d580a8d1..6c4153e4b49 100644 --- a/test_programs/execution_success/5_over/src/main.nr +++ b/test_programs/execution_success/5_over/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Test unsafe integer arithmetic // Test odd bits integer fn main(mut x: u32, y: u32) { diff --git a/test_programs/execution_success/6/src/main.nr b/test_programs/execution_success/6/src/main.nr index 5ecb809e68b..8657199bd7f 100644 --- a/test_programs/execution_success/6/src/main.nr +++ b/test_programs/execution_success/6/src/main.nr @@ -5,7 +5,6 @@ // If you do not cast, it will take all the bytes from the field element! // Mimc input is an array of field elements // The function is called mimc_bn254 to emphasize its parameters are chosen for bn254 curve, it should be used only with a proving system using the same curve (e.g Plonk from Aztec) -use dep::std; fn main(x: [u8; 5], result: pub [u8; 32]) { let mut digest = std::hash::sha256(x); diff --git a/test_programs/execution_success/6_array/src/main.nr b/test_programs/execution_success/6_array/src/main.nr index 6aa05f58b71..d7180c260ff 100644 --- a/test_programs/execution_success/6_array/src/main.nr +++ b/test_programs/execution_success/6_array/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; //Basic tests for arrays fn main(x: [u32; 5], y: [u32; 5], mut z: u32, t: u32) { let mut c = 2301; diff --git a/test_programs/execution_success/7/src/main.nr b/test_programs/execution_success/7/src/main.nr index a6bba978644..ad3fe1aadc8 100644 --- a/test_programs/execution_success/7/src/main.nr +++ b/test_programs/execution_success/7/src/main.nr @@ -2,7 +2,6 @@ // // Pre-alpha dependencies must now be prefixed with the word "dep". // The line below indicates that we would like to pull in the standard library dependency. -use dep::std; fn main(x: [u8; 5], result: [u8; 32]) { let digest = std::hash::blake2s(x); diff --git a/test_programs/execution_success/aes128_encrypt/src/main.nr b/test_programs/execution_success/aes128_encrypt/src/main.nr index f6ed0f309c3..cd7fb4772e2 100644 --- a/test_programs/execution_success/aes128_encrypt/src/main.nr +++ b/test_programs/execution_success/aes128_encrypt/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - unconstrained fn decode_ascii(ascii: u8) -> u8 { if ascii < 58 { ascii - 48 diff --git a/test_programs/execution_success/array_dynamic_blackbox_input/src/main.nr b/test_programs/execution_success/array_dynamic_blackbox_input/src/main.nr index 4cbf1bd8e6d..260d609928b 100644 --- a/test_programs/execution_success/array_dynamic_blackbox_input/src/main.nr +++ b/test_programs/execution_success/array_dynamic_blackbox_input/src/main.nr @@ -18,7 +18,7 @@ fn compute_root(leaf: [u8; 32], path: [u8; 64], _index: u32, root: [u8; 32]) { hash_input[j + b] = path[offset + j]; } - current = dep::std::hash::sha256(hash_input); + current = std::hash::sha256(hash_input); index = index >> 1; } diff --git a/test_programs/execution_success/array_dynamic_nested_blackbox_input/src/main.nr b/test_programs/execution_success/array_dynamic_nested_blackbox_input/src/main.nr index 8faaf69dfc8..15a2747eaa9 100644 --- a/test_programs/execution_success/array_dynamic_nested_blackbox_input/src/main.nr +++ b/test_programs/execution_success/array_dynamic_nested_blackbox_input/src/main.nr @@ -15,6 +15,6 @@ fn main(mut x: [Foo; 3], y: pub Field, hash_result: pub [u8; 32]) { // Make sure that we are passing a dynamic array to the black box function call // by setting the array using a dynamic index here hash_input[y - 1] = 0; - let hash = dep::std::hash::sha256(hash_input); + let hash = std::hash::sha256(hash_input); assert_eq(hash, hash_result); } diff --git a/test_programs/execution_success/bigint/src/main.nr b/test_programs/execution_success/bigint/src/main.nr index c454c2b66cd..9385b39e847 100644 --- a/test_programs/execution_success/bigint/src/main.nr +++ b/test_programs/execution_success/bigint/src/main.nr @@ -1,5 +1,5 @@ -use dep::std::bigint; -use dep::std::{bigint::Secpk1Fq, println}; +use std::bigint; +use std::{bigint::Secpk1Fq, println}; fn main(mut x: [u8; 5], y: [u8; 5]) { let a = bigint::Secpk1Fq::from_le_bytes(&[x[0], x[1], x[2], x[3], x[4]]); @@ -10,8 +10,8 @@ fn main(mut x: [u8; 5], y: [u8; 5]) { a_be_bytes[31-i] = x[i]; b_be_bytes[31-i] = y[i]; } - let a_field = dep::std::field::bytes32_to_field(a_be_bytes); - let b_field = dep::std::field::bytes32_to_field(b_be_bytes); + let a_field = std::field::bytes32_to_field(a_be_bytes); + let b_field = std::field::bytes32_to_field(b_be_bytes); // Regression for issue #4682 let c = if x[0] != 0 { @@ -19,7 +19,7 @@ fn main(mut x: [u8; 5], y: [u8; 5]) { } else { test_unconstrained2(a, b) }; - assert(c.array[0] == dep::std::wrapping_mul(x[0], y[0])); + assert(c.array[0] == std::wrapping_mul(x[0], y[0])); let a_bytes = a.to_le_bytes(); let b_bytes = b.to_le_bytes(); diff --git a/test_programs/execution_success/blake3/src/main.nr b/test_programs/execution_success/blake3/src/main.nr index 3bfea6c5f95..fb056bfa848 100644 --- a/test_programs/execution_success/blake3/src/main.nr +++ b/test_programs/execution_success/blake3/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(x: [u8; 5], result: [u8; 32]) { let digest = std::hash::blake3(x); assert(digest == result); diff --git a/test_programs/execution_success/brillig_blake2s/src/main.nr b/test_programs/execution_success/brillig_blake2s/src/main.nr index 5bd52666ae9..2743e02e920 100644 --- a/test_programs/execution_success/brillig_blake2s/src/main.nr +++ b/test_programs/execution_success/brillig_blake2s/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Tests a very simple program. // // The features being tested is blake2s in brillig diff --git a/test_programs/execution_success/brillig_blake3/src/main.nr b/test_programs/execution_success/brillig_blake3/src/main.nr index 05a5b31f936..64852d775f4 100644 --- a/test_programs/execution_success/brillig_blake3/src/main.nr +++ b/test_programs/execution_success/brillig_blake3/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - unconstrained fn main(x: [u8; 5], result: [u8; 32]) { let digest = std::hash::blake3(x); assert(digest == result); diff --git a/test_programs/execution_success/brillig_block_parameter_liveness/src/main.nr b/test_programs/execution_success/brillig_block_parameter_liveness/src/main.nr index 142290ecbe2..2809668c574 100644 --- a/test_programs/execution_success/brillig_block_parameter_liveness/src/main.nr +++ b/test_programs/execution_success/brillig_block_parameter_liveness/src/main.nr @@ -38,11 +38,11 @@ struct Outer { // If we don't take into account block parameter liveness, this function will need 5*500=2500 stack items unconstrained fn main(conditions: [bool; 5]) -> pub Outer { let out0 = if conditions[0] { - let mut outer: Outer = dep::std::unsafe::zeroed(); + let mut outer: Outer = std::unsafe::zeroed(); outer.middle_a.inner_a.a = 1; outer } else { - let mut outer: Outer= dep::std::unsafe::zeroed(); + let mut outer: Outer= std::unsafe::zeroed(); outer.middle_f.inner_c.d = 2; outer }; diff --git a/test_programs/execution_success/brillig_cow_regression/src/main.nr b/test_programs/execution_success/brillig_cow_regression/src/main.nr index 1cae9b1ba41..7cd50860978 100644 --- a/test_programs/execution_success/brillig_cow_regression/src/main.nr +++ b/test_programs/execution_success/brillig_cow_regression/src/main.nr @@ -25,7 +25,7 @@ struct NewContractData { impl NewContractData { fn hash(self) -> Field { - dep::std::hash::pedersen_hash([self.contract_address, self.portal_contract_address]) + std::hash::pedersen_hash([self.contract_address, self.portal_contract_address]) } } @@ -173,6 +173,6 @@ unconstrained fn main(kernel_data: DataToHash) -> pub [Field; NUM_FIELDS_PER_SHA } } - let sha_digest = dep::std::hash::sha256(hash_input_flattened); + let sha_digest = std::hash::sha256(hash_input_flattened); U256::from_bytes32(sha_digest).to_u128_limbs() } diff --git a/test_programs/execution_success/brillig_ecdsa_secp256k1/src/main.nr b/test_programs/execution_success/brillig_ecdsa_secp256k1/src/main.nr index 5d84d885567..78343dcd26c 100644 --- a/test_programs/execution_success/brillig_ecdsa_secp256k1/src/main.nr +++ b/test_programs/execution_success/brillig_ecdsa_secp256k1/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Tests a very simple program. // // The features being tested is ecdsa in brillig diff --git a/test_programs/execution_success/brillig_ecdsa_secp256r1/src/main.nr b/test_programs/execution_success/brillig_ecdsa_secp256r1/src/main.nr index 9da07f531aa..48debadb012 100644 --- a/test_programs/execution_success/brillig_ecdsa_secp256r1/src/main.nr +++ b/test_programs/execution_success/brillig_ecdsa_secp256r1/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Tests a very simple program. // // The features being tested is ecdsa in brillig diff --git a/test_programs/execution_success/brillig_fns_as_values/src/main.nr b/test_programs/execution_success/brillig_fns_as_values/src/main.nr index 9248bff2f4c..1476c447431 100644 --- a/test_programs/execution_success/brillig_fns_as_values/src/main.nr +++ b/test_programs/execution_success/brillig_fns_as_values/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - struct MyStruct { operation: fn (u32) -> u32, } diff --git a/test_programs/execution_success/brillig_hash_to_field/src/main.nr b/test_programs/execution_success/brillig_hash_to_field/src/main.nr index 53ed85b3ddd..78759bd84c6 100644 --- a/test_programs/execution_success/brillig_hash_to_field/src/main.nr +++ b/test_programs/execution_success/brillig_hash_to_field/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Tests a very simple program. // // The features being tested is hash_to_field in brillig diff --git a/test_programs/execution_success/brillig_keccak/src/main.nr b/test_programs/execution_success/brillig_keccak/src/main.nr index a300bc18279..9150e38f208 100644 --- a/test_programs/execution_success/brillig_keccak/src/main.nr +++ b/test_programs/execution_success/brillig_keccak/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Tests a very simple program. // // The features being tested is keccak256 in brillig diff --git a/test_programs/execution_success/brillig_oracle/src/main.nr b/test_programs/execution_success/brillig_oracle/src/main.nr index 6a9e5806621..0305cb06978 100644 --- a/test_programs/execution_success/brillig_oracle/src/main.nr +++ b/test_programs/execution_success/brillig_oracle/src/main.nr @@ -1,5 +1,5 @@ -use dep::std::slice; -use dep::std::test::OracleMock; +use std::slice; +use std::test::OracleMock; // Tests oracle usage in brillig/unconstrained functions fn main(_x: Field) { diff --git a/test_programs/execution_success/brillig_pedersen/src/main.nr b/test_programs/execution_success/brillig_pedersen/src/main.nr index 2379818c454..17c79f9d0ae 100644 --- a/test_programs/execution_success/brillig_pedersen/src/main.nr +++ b/test_programs/execution_success/brillig_pedersen/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - unconstrained fn main(x: Field, y: Field, salt: Field, out_x: Field, out_y: Field, out_hash: Field) { let res = std::hash::pedersen_commitment_with_separator([x, y], 0); assert(res.x == out_x); diff --git a/test_programs/execution_success/brillig_sha256/src/main.nr b/test_programs/execution_success/brillig_sha256/src/main.nr index e76109df9c3..fcc01978a0a 100644 --- a/test_programs/execution_success/brillig_sha256/src/main.nr +++ b/test_programs/execution_success/brillig_sha256/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Tests a very simple program. // // The features being tested is sha256 in brillig diff --git a/test_programs/execution_success/brillig_slices/src/main.nr b/test_programs/execution_success/brillig_slices/src/main.nr index 2cf1850f151..89f838a3a57 100644 --- a/test_programs/execution_success/brillig_slices/src/main.nr +++ b/test_programs/execution_success/brillig_slices/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::slice; +use std::slice; unconstrained fn main(x: Field, y: Field) { let mut slice: [Field] = &[y, x]; assert(slice.len() == 2); diff --git a/test_programs/execution_success/conditional_1/src/main.nr b/test_programs/execution_success/conditional_1/src/main.nr index 5064c82bce9..e7d780263b8 100644 --- a/test_programs/execution_success/conditional_1/src/main.nr +++ b/test_programs/execution_success/conditional_1/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn sort(mut a: [u32; 4]) -> [u32; 4] { for i in 1..4 { for j in 0..i { diff --git a/test_programs/execution_success/conditional_2/src/main.nr b/test_programs/execution_success/conditional_2/src/main.nr index 5b3f64f6be5..ea23ec3cf3b 100644 --- a/test_programs/execution_success/conditional_2/src/main.nr +++ b/test_programs/execution_success/conditional_2/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn must_be_zero(x: u8) { assert(x == 0); } diff --git a/test_programs/execution_success/conditional_regression_short_circuit/src/main.nr b/test_programs/execution_success/conditional_regression_short_circuit/src/main.nr index d260fa49dc3..de5ad20a642 100644 --- a/test_programs/execution_success/conditional_regression_short_circuit/src/main.nr +++ b/test_programs/execution_success/conditional_regression_short_circuit/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]) { //regression for short-circuit2 if 35 == a { diff --git a/test_programs/execution_success/databus/src/main.nr b/test_programs/execution_success/databus/src/main.nr index 1cf95be8a22..7e5c23d508d 100644 --- a/test_programs/execution_success/databus/src/main.nr +++ b/test_programs/execution_success/databus/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(mut x: u32, y: call_data u32, z: call_data [u32; 4]) -> return_data u32 { let a = z[x]; a + foo(y) diff --git a/test_programs/execution_success/diamond_deps_0/src/main.nr b/test_programs/execution_success/diamond_deps_0/src/main.nr index ca95c6e0aa8..690d6fc9fc8 100644 --- a/test_programs/execution_success/diamond_deps_0/src/main.nr +++ b/test_programs/execution_success/diamond_deps_0/src/main.nr @@ -1,6 +1,6 @@ -use dep::dep1::call_dep1_then_dep2; -use dep::dep2::call_dep2; -use dep::dep2::RESOLVE_THIS; +use dep1::call_dep1_then_dep2; +use dep2::call_dep2; +use dep2::RESOLVE_THIS; fn main(x: Field, y: pub Field) -> pub Field { call_dep1_then_dep2(x, y) + call_dep2(x, y) + RESOLVE_THIS diff --git a/test_programs/execution_success/double_verify_nested_proof/src/main.nr b/test_programs/execution_success/double_verify_nested_proof/src/main.nr index 95d4b6f6995..5f0eb1a5b53 100644 --- a/test_programs/execution_success/double_verify_nested_proof/src/main.nr +++ b/test_programs/execution_success/double_verify_nested_proof/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // This circuit aggregates two recursive proofs from `double_verify_proof_recursive`. // Recursive aggregation is a backend-specific process and it is expected for backends diff --git a/test_programs/execution_success/double_verify_proof/src/main.nr b/test_programs/execution_success/double_verify_proof/src/main.nr index d832ce0f049..d3b909c3fa4 100644 --- a/test_programs/execution_success/double_verify_proof/src/main.nr +++ b/test_programs/execution_success/double_verify_proof/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // This circuit aggregates two proofs from `assert_statement_recursive`. fn main( diff --git a/test_programs/execution_success/double_verify_proof_recursive/src/main.nr b/test_programs/execution_success/double_verify_proof_recursive/src/main.nr index 86b4971c3a6..2555bbc4758 100644 --- a/test_programs/execution_success/double_verify_proof_recursive/src/main.nr +++ b/test_programs/execution_success/double_verify_proof_recursive/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // This circuit aggregates two proofs from `assert_statement_recursive`. #[recursive] diff --git a/test_programs/execution_success/ecdsa_secp256k1/src/main.nr b/test_programs/execution_success/ecdsa_secp256k1/src/main.nr index ac0359e4bb8..7f0999fc360 100644 --- a/test_programs/execution_success/ecdsa_secp256k1/src/main.nr +++ b/test_programs/execution_success/ecdsa_secp256k1/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main( message: [u8; 38], hashed_message: [u8; 32], diff --git a/test_programs/execution_success/ecdsa_secp256r1/src/main.nr b/test_programs/execution_success/ecdsa_secp256r1/src/main.nr index c64e390d652..09f427c37d9 100644 --- a/test_programs/execution_success/ecdsa_secp256r1/src/main.nr +++ b/test_programs/execution_success/ecdsa_secp256r1/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(hashed_message: [u8; 32], pub_key_x: [u8; 32], pub_key_y: [u8; 32], signature: [u8; 64]) { let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); assert(valid_signature); diff --git a/test_programs/execution_success/ecdsa_secp256r1_3x/src/main.nr b/test_programs/execution_success/ecdsa_secp256r1_3x/src/main.nr index e7a6be9d47a..b5bd633915f 100644 --- a/test_programs/execution_success/ecdsa_secp256r1_3x/src/main.nr +++ b/test_programs/execution_success/ecdsa_secp256r1_3x/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main( hashed_message: [u8; 32], pub_key_x: [u8; 32], diff --git a/test_programs/execution_success/eddsa/src/main.nr b/test_programs/execution_success/eddsa/src/main.nr index ada15d5405c..407ca049806 100644 --- a/test_programs/execution_success/eddsa/src/main.nr +++ b/test_programs/execution_success/eddsa/src/main.nr @@ -1,9 +1,9 @@ -use dep::std::compat; -use dep::std::ec::consts::te::baby_jubjub; -use dep::std::ec::tecurve::affine::Point as TEPoint; -use dep::std::hash; -use dep::std::eddsa::{eddsa_to_pub, eddsa_poseidon_verify, eddsa_verify}; -use dep::std::hash::poseidon2::Poseidon2Hasher; +use std::compat; +use std::ec::consts::te::baby_jubjub; +use std::ec::tecurve::affine::Point as TEPoint; +use std::hash; +use std::eddsa::{eddsa_to_pub, eddsa_poseidon_verify, eddsa_verify}; +use std::hash::poseidon2::Poseidon2Hasher; fn main(msg: pub Field, _priv_key_a: Field, _priv_key_b: Field) { // Skip this test for non-bn254 backends diff --git a/test_programs/execution_success/embedded_curve_ops/src/main.nr b/test_programs/execution_success/embedded_curve_ops/src/main.nr index 46f919e947a..4eeda39c6aa 100644 --- a/test_programs/execution_success/embedded_curve_ops/src/main.nr +++ b/test_programs/execution_success/embedded_curve_ops/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(priv_key: Field, pub_x: pub Field, pub_y: pub Field) { let g1_y = 17631683881184975370165255887551781615748388533673675138860; let g1 = std::embedded_curve_ops::EmbeddedCurvePoint { x: 1, y: g1_y, is_infinite: false }; diff --git a/test_programs/execution_success/fold_numeric_generic_poseidon/src/main.nr b/test_programs/execution_success/fold_numeric_generic_poseidon/src/main.nr index f9f3e75789b..7d12d63634b 100644 --- a/test_programs/execution_success/fold_numeric_generic_poseidon/src/main.nr +++ b/test_programs/execution_success/fold_numeric_generic_poseidon/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::hash::{pedersen_hash_with_separator, poseidon2::Poseidon2}; +use std::hash::{pedersen_hash_with_separator, poseidon2::Poseidon2}; global NUM_HASHES = 2; global HASH_LENGTH = 10; diff --git a/test_programs/execution_success/generics/src/main.nr b/test_programs/execution_success/generics/src/main.nr index c8616960559..f754fb96292 100644 --- a/test_programs/execution_success/generics/src/main.nr +++ b/test_programs/execution_success/generics/src/main.nr @@ -34,7 +34,7 @@ impl Bar { impl Bar { // This is to test that we can use turbofish on methods as well fn zeroed(_self: Self) -> A { - dep::std::unsafe::zeroed() + std::unsafe::zeroed() } } diff --git a/test_programs/execution_success/hash_to_field/src/main.nr b/test_programs/execution_success/hash_to_field/src/main.nr index 242b5ecbc18..bb4f829ec33 100644 --- a/test_programs/execution_success/hash_to_field/src/main.nr +++ b/test_programs/execution_success/hash_to_field/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(input: Field) -> pub Field { std::hash::hash_to_field(&[input]) } diff --git a/test_programs/execution_success/hashmap/src/main.nr b/test_programs/execution_success/hashmap/src/main.nr index 76daa594a89..8cf70cc5970 100644 --- a/test_programs/execution_success/hashmap/src/main.nr +++ b/test_programs/execution_success/hashmap/src/main.nr @@ -1,9 +1,9 @@ mod utils; -use dep::std::collections::map::HashMap; -use dep::std::hash::BuildHasherDefault; -use dep::std::hash::poseidon2::Poseidon2Hasher; -use dep::std::cmp::Eq; +use std::collections::map::HashMap; +use std::hash::BuildHasherDefault; +use std::hash::poseidon2::Poseidon2Hasher; +use std::cmp::Eq; use utils::cut; diff --git a/test_programs/execution_success/import/src/main.nr b/test_programs/execution_success/import/src/main.nr index 7dcc16fed16..0f5aa7e5460 100644 --- a/test_programs/execution_success/import/src/main.nr +++ b/test_programs/execution_success/import/src/main.nr @@ -2,7 +2,7 @@ mod import; use crate::import::hello; fn main(x: Field, y: Field) { - let _k = dep::std::hash::pedersen_commitment([x]); + let _k = std::hash::pedersen_commitment([x]); let _l = hello(x); assert(x != import::hello(y)); diff --git a/test_programs/execution_success/is_unconstrained/src/main.nr b/test_programs/execution_success/is_unconstrained/src/main.nr index af40af1029f..ddafc73c598 100644 --- a/test_programs/execution_success/is_unconstrained/src/main.nr +++ b/test_programs/execution_success/is_unconstrained/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::runtime::is_unconstrained; +use std::runtime::is_unconstrained; fn check(should_be_unconstrained: bool) { assert_eq(should_be_unconstrained, is_unconstrained()); diff --git a/test_programs/execution_success/keccak256/src/main.nr b/test_programs/execution_success/keccak256/src/main.nr index eb401fe614c..ff18cae0c9c 100644 --- a/test_programs/execution_success/keccak256/src/main.nr +++ b/test_programs/execution_success/keccak256/src/main.nr @@ -1,5 +1,4 @@ // docs:start:keccak256 -use dep::std; fn main(x: Field, result: [u8; 32]) { // We use the `as` keyword here to denote the fact that we want to take just the first byte from the x Field diff --git a/test_programs/execution_success/merkle_insert/src/main.nr b/test_programs/execution_success/merkle_insert/src/main.nr index ac9a7b34ea3..a08088e847b 100644 --- a/test_programs/execution_success/merkle_insert/src/main.nr +++ b/test_programs/execution_success/merkle_insert/src/main.nr @@ -1,5 +1,4 @@ -use dep::std; -use dep::std::hash::mimc; +use std::hash::mimc; fn main( old_root: Field, diff --git a/test_programs/execution_success/modulus/src/main.nr b/test_programs/execution_success/modulus/src/main.nr index 35f63fdc8c5..c7d6a2e2c7d 100644 --- a/test_programs/execution_success/modulus/src/main.nr +++ b/test_programs/execution_success/modulus/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(bn254_modulus_be_bytes: [u8; 32], bn254_modulus_be_bits: [u1; 254]) { let modulus_size = std::field::modulus_num_bits(); // NOTE: The constraints used in this circuit will only work when testing nargo with the plonk bn254 backend diff --git a/test_programs/execution_success/no_predicates_numeric_generic_poseidon/src/main.nr b/test_programs/execution_success/no_predicates_numeric_generic_poseidon/src/main.nr index dcb5e6bc5ca..94db8c2b414 100644 --- a/test_programs/execution_success/no_predicates_numeric_generic_poseidon/src/main.nr +++ b/test_programs/execution_success/no_predicates_numeric_generic_poseidon/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::hash::{pedersen_hash_with_separator, poseidon2::Poseidon2}; +use std::hash::{pedersen_hash_with_separator, poseidon2::Poseidon2}; global NUM_HASHES = 2; global HASH_LENGTH = 10; diff --git a/test_programs/execution_success/operator_overloading/src/main.nr b/test_programs/execution_success/operator_overloading/src/main.nr index 3956ea5c577..c2c831d0c1e 100644 --- a/test_programs/execution_success/operator_overloading/src/main.nr +++ b/test_programs/execution_success/operator_overloading/src/main.nr @@ -1,5 +1,5 @@ -use dep::std::ops::{Add, Sub, Mul, Div, Rem, BitAnd, BitOr, BitXor, Shl, Shr}; -use dep::std::cmp::Ordering; +use std::ops::{Add, Sub, Mul, Div, Rem, BitAnd, BitOr, BitXor, Shl, Shr}; +use std::cmp::Ordering; // x = 3, y = 9 fn main(x: u32, y: u32) { diff --git a/test_programs/execution_success/overlapping_dep_and_mod/Nargo.toml b/test_programs/execution_success/overlapping_dep_and_mod/Nargo.toml new file mode 100644 index 00000000000..b2c3e5f94be --- /dev/null +++ b/test_programs/execution_success/overlapping_dep_and_mod/Nargo.toml @@ -0,0 +1,6 @@ +[workspace] +members = [ + "bin", + "foo", +] +default-member = "bin" diff --git a/test_programs/execution_success/overlapping_dep_and_mod/bin/Nargo.toml b/test_programs/execution_success/overlapping_dep_and_mod/bin/Nargo.toml new file mode 100644 index 00000000000..57e704462db --- /dev/null +++ b/test_programs/execution_success/overlapping_dep_and_mod/bin/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "overlapping_dep_and_mod" +type = "bin" +authors = [""] +compiler_version = ">=0.29.0" + +[dependencies] +foo = { path = "../foo" } diff --git a/test_programs/execution_success/overlapping_dep_and_mod/bin/Prover.toml b/test_programs/execution_success/overlapping_dep_and_mod/bin/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test_programs/execution_success/overlapping_dep_and_mod/bin/src/main.nr b/test_programs/execution_success/overlapping_dep_and_mod/bin/src/main.nr new file mode 100644 index 00000000000..16c940f12fc --- /dev/null +++ b/test_programs/execution_success/overlapping_dep_and_mod/bin/src/main.nr @@ -0,0 +1,14 @@ +// bin/main.nr + +fn main() -> pub Field { + assert(foo::bar() + dep::foo::bar() == 11); + assert(foo::bar() == 5); + assert(dep::foo::bar() == 6); + foo::bar() + dep::foo::bar() +} + +mod foo { + pub(crate) fn bar() -> Field { + 5 + } +} diff --git a/test_programs/execution_success/overlapping_dep_and_mod/foo/Nargo.toml b/test_programs/execution_success/overlapping_dep_and_mod/foo/Nargo.toml new file mode 100644 index 00000000000..857d4e722a8 --- /dev/null +++ b/test_programs/execution_success/overlapping_dep_and_mod/foo/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "foo" +type = "lib" +authors = [""] +compiler_version = ">=0.29.0" + +[dependencies] diff --git a/test_programs/execution_success/overlapping_dep_and_mod/foo/src/lib.nr b/test_programs/execution_success/overlapping_dep_and_mod/foo/src/lib.nr new file mode 100644 index 00000000000..09283defed7 --- /dev/null +++ b/test_programs/execution_success/overlapping_dep_and_mod/foo/src/lib.nr @@ -0,0 +1,5 @@ +// foo/lib.nr + +pub fn bar() -> Field { + 6 +} diff --git a/test_programs/execution_success/pedersen_check/src/main.nr b/test_programs/execution_success/pedersen_check/src/main.nr index 90ef218249b..c71b2b570da 100644 --- a/test_programs/execution_success/pedersen_check/src/main.nr +++ b/test_programs/execution_success/pedersen_check/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(x: Field, y: Field, salt: Field, out_x: Field, out_y: Field, out_hash: Field) { let res = std::hash::pedersen_commitment([x, y]); assert(res.x == out_x); diff --git a/test_programs/execution_success/pedersen_commitment/src/main.nr b/test_programs/execution_success/pedersen_commitment/src/main.nr index a3a9aea1cf0..81c605a64dd 100644 --- a/test_programs/execution_success/pedersen_commitment/src/main.nr +++ b/test_programs/execution_success/pedersen_commitment/src/main.nr @@ -1,5 +1,4 @@ // docs:start:pedersen-commitment -use dep::std; fn main(x: Field, y: Field, expected_commitment: std::embedded_curve_ops::EmbeddedCurvePoint) { let commitment = std::hash::pedersen_commitment([x, y]); diff --git a/test_programs/execution_success/pedersen_hash/src/main.nr b/test_programs/execution_success/pedersen_hash/src/main.nr index 20c7de12d6c..f8ec56a9d98 100644 --- a/test_programs/execution_success/pedersen_hash/src/main.nr +++ b/test_programs/execution_success/pedersen_hash/src/main.nr @@ -1,5 +1,4 @@ // docs:start:pedersen-hash -use dep::std; fn main(x: Field, y: Field, expected_hash: Field) { let hash = std::hash::pedersen_hash([x, y]); diff --git a/test_programs/execution_success/poseidon_bn254_hash/src/main.nr b/test_programs/execution_success/poseidon_bn254_hash/src/main.nr index a1607956190..cf1c190e5c9 100644 --- a/test_programs/execution_success/poseidon_bn254_hash/src/main.nr +++ b/test_programs/execution_success/poseidon_bn254_hash/src/main.nr @@ -1,6 +1,6 @@ // docs:start:poseidon -use dep::std::hash::poseidon; -use dep::std::hash::poseidon2; +use std::hash::poseidon; +use std::hash::poseidon2; fn main(x1: [Field; 2], y1: pub Field, x2: [Field; 4], y2: pub Field, x3: [Field; 4], y3: Field) { let hash1 = poseidon::bn254::hash_2(x1); diff --git a/test_programs/execution_success/poseidonsponge_x5_254/src/main.nr b/test_programs/execution_success/poseidonsponge_x5_254/src/main.nr index 910a17c8c89..137f3e5d2a6 100644 --- a/test_programs/execution_success/poseidonsponge_x5_254/src/main.nr +++ b/test_programs/execution_success/poseidonsponge_x5_254/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::hash::poseidon; +use std::hash::poseidon; fn main(x: [Field; 7]) { // Test optimized sponge diff --git a/test_programs/execution_success/prelude/src/main.nr b/test_programs/execution_success/prelude/src/main.nr index 226341f1e7b..4fe6080222e 100644 --- a/test_programs/execution_success/prelude/src/main.nr +++ b/test_programs/execution_success/prelude/src/main.nr @@ -8,8 +8,8 @@ fn main() { mod a { // We don't want to give an error due to re-importing elements that are already in the prelude. - use dep::std::collections::vec::Vec; - use dep::std::option::Option; + use std::collections::vec::Vec; + use std::option::Option; fn main() { let _xs = Vec::new(); diff --git a/test_programs/execution_success/regression_3051/src/main.nr b/test_programs/execution_success/regression_3051/src/main.nr index 2e7d10fd7b0..90eb652db7a 100644 --- a/test_programs/execution_success/regression_3051/src/main.nr +++ b/test_programs/execution_success/regression_3051/src/main.nr @@ -19,6 +19,6 @@ impl Bar for u64 { } fn main() { - dep::std::println(1.foo()); - dep::std::println(1.bar()); + std::println(1.foo()); + std::println(1.bar()); } diff --git a/test_programs/execution_success/regression_3394/src/main.nr b/test_programs/execution_success/regression_3394/src/main.nr index 94b6c818ff2..59494253757 100644 --- a/test_programs/execution_success/regression_3394/src/main.nr +++ b/test_programs/execution_success/regression_3394/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { let x : i8 = -128; std::println(x); diff --git a/test_programs/execution_success/regression_4124/src/main.nr b/test_programs/execution_success/regression_4124/src/main.nr index 49ff68ee6ad..2b0e65a0b6c 100644 --- a/test_programs/execution_success/regression_4124/src/main.nr +++ b/test_programs/execution_success/regression_4124/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::option::Option; +use std::option::Option; trait MyDeserialize { fn deserialize(fields: [Field; N]) -> Self; @@ -11,7 +11,7 @@ impl MyDeserialize<1> for Field { } pub fn storage_read() -> [Field; N] { - dep::std::unsafe::zeroed() + std::unsafe::zeroed() } struct PublicMutable { diff --git a/test_programs/execution_success/regression_4449/src/main.nr b/test_programs/execution_success/regression_4449/src/main.nr index 454a93f5d1a..66bab2e09f4 100644 --- a/test_programs/execution_success/regression_4449/src/main.nr +++ b/test_programs/execution_success/regression_4449/src/main.nr @@ -1,5 +1,4 @@ // Regression test for issue #4449 -use dep::std; fn main(x: u8, result: [u8; 32]) { let x = x % 31; diff --git a/test_programs/execution_success/regression_5045/src/main.nr b/test_programs/execution_success/regression_5045/src/main.nr index 015fb1b2555..cf39b2f97e4 100644 --- a/test_programs/execution_success/regression_5045/src/main.nr +++ b/test_programs/execution_success/regression_5045/src/main.nr @@ -1,5 +1,5 @@ -use dep::std::embedded_curve_ops::EmbeddedCurvePoint; -use dep::std::embedded_curve_ops::EmbeddedCurveScalar; +use std::embedded_curve_ops::EmbeddedCurvePoint; +use std::embedded_curve_ops::EmbeddedCurveScalar; fn main(is_active: bool) { let a = EmbeddedCurvePoint { @@ -11,7 +11,7 @@ fn main(is_active: bool) { if is_active { let bad = EmbeddedCurvePoint { x: 0, y: 5, is_infinite: false }; let d = bad.double(); - let e = dep::std::embedded_curve_ops::multi_scalar_mul( + let e = std::embedded_curve_ops::multi_scalar_mul( [a, bad], [EmbeddedCurveScalar { lo: 1, hi: 0 }, EmbeddedCurveScalar { lo: 1, hi: 0 }] ); diff --git a/test_programs/execution_success/regression_5202/src/main.nr b/test_programs/execution_success/regression_5202/src/main.nr index e41b760b83e..2ebfd7890ba 100644 --- a/test_programs/execution_success/regression_5202/src/main.nr +++ b/test_programs/execution_success/regression_5202/src/main.nr @@ -1,4 +1,4 @@ -use dep::fraction::{Fraction, MAX, floor, toFraction, addFraction}; +use fraction::{Fraction, MAX, floor, toFraction, addFraction}; fn main() { let g1 = toFraction(true, 33333333, 5); diff --git a/test_programs/execution_success/regression_5252/src/main.nr b/test_programs/execution_success/regression_5252/src/main.nr index 315807c3396..0bfd596a777 100644 --- a/test_programs/execution_success/regression_5252/src/main.nr +++ b/test_programs/execution_success/regression_5252/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::hash::{mimc, poseidon, poseidon2::Poseidon2}; +use std::hash::{mimc, poseidon, poseidon2::Poseidon2}; global NUM_HASHES = 3; global HASH_LENGTH = 20; diff --git a/test_programs/execution_success/regression_method_cannot_be_found/src/main.nr b/test_programs/execution_success/regression_method_cannot_be_found/src/main.nr index 1a6931a6870..c7db543f1bb 100644 --- a/test_programs/execution_success/regression_method_cannot_be_found/src/main.nr +++ b/test_programs/execution_success/regression_method_cannot_be_found/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; struct Item { id: Field, } diff --git a/test_programs/execution_success/schnorr/src/main.nr b/test_programs/execution_success/schnorr/src/main.nr index 1067d9707b2..5bc0ca9fefb 100644 --- a/test_programs/execution_success/schnorr/src/main.nr +++ b/test_programs/execution_success/schnorr/src/main.nr @@ -1,5 +1,4 @@ -use dep::std; -use dep::std::embedded_curve_ops; +use std::embedded_curve_ops; // Note: If main has any unsized types, then the verifier will never be able // to figure out the circuit instance @@ -37,11 +36,7 @@ fn main( // Meanwhile, you have to use a message with 32 additional bytes: // If you want to verify a signature on a message of 10 bytes, you need to pass a message of length 42, // where the first 10 bytes are the one from the original message (the other bytes are not used) -pub fn verify_signature_noir( - public_key: embedded_curve_ops::EmbeddedCurvePoint, - signature: [u8; 64], - message: [u8; M] -) -> bool { +pub fn verify_signature_noir(public_key: embedded_curve_ops::EmbeddedCurvePoint, signature: [u8; 64], message: [u8; M]) -> bool { let N = message.len() - 32; //scalar lo/hi from bytes @@ -90,11 +85,7 @@ pub fn bytes_to_scalar(bytes: [u8; 64], offset: u32) -> embedded_curve_ops::Embe sig_s } -pub fn assert_valid_signature( - public_key: embedded_curve_ops::EmbeddedCurvePoint, - signature: [u8; 64], - message: [u8; M] -) { +pub fn assert_valid_signature(public_key: embedded_curve_ops::EmbeddedCurvePoint, signature: [u8; 64], message: [u8; M]) { let N = message.len() - 32; //scalar lo/hi from bytes let sig_s = bytes_to_scalar(signature, 0); diff --git a/test_programs/execution_success/sha256/src/main.nr b/test_programs/execution_success/sha256/src/main.nr index d4240ded8b3..4f999d349f0 100644 --- a/test_programs/execution_success/sha256/src/main.nr +++ b/test_programs/execution_success/sha256/src/main.nr @@ -9,7 +9,6 @@ // // Not yet here: For R1CS, it is more about manipulating arithmetic gates to get performance // This can be done in ACIR! -use dep::std; fn main(x: Field, result: [u8; 32]) { // We use the `as` keyword here to denote the fact that we want to take just the first byte from the x Field diff --git a/test_programs/execution_success/sha2_byte/src/main.nr b/test_programs/execution_success/sha2_byte/src/main.nr index fa8ddfbdf69..aecd9fba2f3 100644 --- a/test_programs/execution_success/sha2_byte/src/main.nr +++ b/test_programs/execution_success/sha2_byte/src/main.nr @@ -1,5 +1,4 @@ // Test Noir implementations of SHA256 and SHA512 on a one-byte message. -use dep::std; fn main(x: Field, result256: [u8; 32], result512: [u8; 64]) { let digest256 = std::sha256::digest([x as u8]); diff --git a/test_programs/execution_success/signed_comparison/src/main.nr b/test_programs/execution_success/signed_comparison/src/main.nr index d020be380fb..0fe72112f5a 100644 --- a/test_programs/execution_success/signed_comparison/src/main.nr +++ b/test_programs/execution_success/signed_comparison/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(mut x: i8, mut y: i8, z: i8) { let mut s1: i8 = 5; let mut s2: i8 = 8; diff --git a/test_programs/execution_success/signed_division/src/main.nr b/test_programs/execution_success/signed_division/src/main.nr index 6289a2f9ed9..207ef59986b 100644 --- a/test_programs/execution_success/signed_division/src/main.nr +++ b/test_programs/execution_success/signed_division/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Testing signed integer division: // 7/3 = 2 // -7/3 = -2 diff --git a/test_programs/execution_success/simple_print/src/main.nr b/test_programs/execution_success/simple_print/src/main.nr index 6038b995af0..3a68f8cc4c3 100644 --- a/test_programs/execution_success/simple_print/src/main.nr +++ b/test_programs/execution_success/simple_print/src/main.nr @@ -1,6 +1,5 @@ // Simple program for testing the logging // of single witnesses and witness arrays. -use dep::std; fn main(x: Field, y: pub Field) { std::println(x); diff --git a/test_programs/execution_success/simple_shield/src/main.nr b/test_programs/execution_success/simple_shield/src/main.nr index 548ba17d462..d84288b9fd6 100644 --- a/test_programs/execution_success/simple_shield/src/main.nr +++ b/test_programs/execution_success/simple_shield/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main( // Public key of note // all notes have the same denomination diff --git a/test_programs/execution_success/slice_coercion/src/main.nr b/test_programs/execution_success/slice_coercion/src/main.nr index a7ba0443bd1..4a83b739523 100644 --- a/test_programs/execution_success/slice_coercion/src/main.nr +++ b/test_programs/execution_success/slice_coercion/src/main.nr @@ -23,5 +23,5 @@ fn main(expected: pub Field, first: Field) { fn regression_4967() { let var1: [(i32, u8)] = [(1, 2)]; assert(var1.len() == 1); - dep::std::println(var1); + std::println(var1); } diff --git a/test_programs/execution_success/slices/src/main.nr b/test_programs/execution_success/slices/src/main.nr index b20e3478898..8be79cdc3c4 100644 --- a/test_programs/execution_success/slices/src/main.nr +++ b/test_programs/execution_success/slices/src/main.nr @@ -1,5 +1,4 @@ -use dep::std::slice; -use dep::std; +use std::slice; fn main(x: Field, y: pub Field) { let mut slice = &[0; 2]; diff --git a/test_programs/execution_success/strings/src/main.nr b/test_programs/execution_success/strings/src/main.nr index cff229d368a..d28a9f483ac 100644 --- a/test_programs/execution_success/strings/src/main.nr +++ b/test_programs/execution_success/strings/src/main.nr @@ -1,4 +1,3 @@ -use dep::std; // Test global string literals global HELLO_WORLD = "hello world"; diff --git a/test_programs/execution_success/to_bits/src/main.nr b/test_programs/execution_success/to_bits/src/main.nr index 18f65f0bd66..84ace83903a 100644 --- a/test_programs/execution_success/to_bits/src/main.nr +++ b/test_programs/execution_success/to_bits/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { let field = 1000; let be_bits = field.to_be_bits(16); diff --git a/test_programs/execution_success/to_bytes_integration/src/main.nr b/test_programs/execution_success/to_bytes_integration/src/main.nr index 3c43caf1806..21c4ad90bfe 100644 --- a/test_programs/execution_success/to_bytes_integration/src/main.nr +++ b/test_programs/execution_success/to_bytes_integration/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(x: Field, a: Field) { let y: Field = 2040124; let be_byte_array = y.to_be_bytes(31); diff --git a/test_programs/execution_success/trait_method_mut_self/src/main.nr b/test_programs/execution_success/trait_method_mut_self/src/main.nr index fa47fd5d881..9cc8375b140 100644 --- a/test_programs/execution_success/trait_method_mut_self/src/main.nr +++ b/test_programs/execution_success/trait_method_mut_self/src/main.nr @@ -1,5 +1,5 @@ -use dep::std::hash::Hasher; -use dep::std::hash::poseidon2::Poseidon2Hasher; +use std::hash::Hasher; +use std::hash::poseidon2::Poseidon2Hasher; fn main(x: Field, y: pub Field) { let mut a_mut_ref = AType { x }; diff --git a/test_programs/execution_success/traits_in_crates_1/crate1/src/lib.nr b/test_programs/execution_success/traits_in_crates_1/crate1/src/lib.nr index 62dd5a2c111..e36a263093a 100644 --- a/test_programs/execution_success/traits_in_crates_1/crate1/src/lib.nr +++ b/test_programs/execution_success/traits_in_crates_1/crate1/src/lib.nr @@ -2,7 +2,7 @@ trait MyTrait { fn Add10(&mut self); } -impl MyTrait for dep::crate2::MyStruct { +impl MyTrait for crate2::MyStruct { fn Add10(&mut self) { self.Q += 10; } diff --git a/test_programs/execution_success/traits_in_crates_1/src/main.nr b/test_programs/execution_success/traits_in_crates_1/src/main.nr index 7ba2f63c5c0..2afec29ee1f 100644 --- a/test_programs/execution_success/traits_in_crates_1/src/main.nr +++ b/test_programs/execution_success/traits_in_crates_1/src/main.nr @@ -1,5 +1,5 @@ fn main(x: Field, y: pub Field) { - let mut V = dep::crate2::MyStruct { Q: x }; + let mut V = crate2::MyStruct { Q: x }; V.Add10(); assert(V.Q == y); } diff --git a/test_programs/execution_success/traits_in_crates_2/crate2/src/lib.nr b/test_programs/execution_success/traits_in_crates_2/crate2/src/lib.nr index 38870489131..fe6a94a4a95 100644 --- a/test_programs/execution_success/traits_in_crates_2/crate2/src/lib.nr +++ b/test_programs/execution_success/traits_in_crates_2/crate2/src/lib.nr @@ -2,7 +2,7 @@ struct MyStruct { Q: Field, } -impl dep::crate1::MyTrait for MyStruct { +impl crate1::MyTrait for MyStruct { fn Add10(&mut self) { self.Q += 10; } diff --git a/test_programs/execution_success/traits_in_crates_2/src/main.nr b/test_programs/execution_success/traits_in_crates_2/src/main.nr index 7ba2f63c5c0..2afec29ee1f 100644 --- a/test_programs/execution_success/traits_in_crates_2/src/main.nr +++ b/test_programs/execution_success/traits_in_crates_2/src/main.nr @@ -1,5 +1,5 @@ fn main(x: Field, y: pub Field) { - let mut V = dep::crate2::MyStruct { Q: x }; + let mut V = crate2::MyStruct { Q: x }; V.Add10(); assert(V.Q == y); } diff --git a/test_programs/execution_success/turbofish_call_func_diff_types/src/main.nr b/test_programs/execution_success/turbofish_call_func_diff_types/src/main.nr index b880d3ae047..36c7d2926c1 100644 --- a/test_programs/execution_success/turbofish_call_func_diff_types/src/main.nr +++ b/test_programs/execution_success/turbofish_call_func_diff_types/src/main.nr @@ -1,6 +1,6 @@ -use dep::std::hash::Hasher; -use dep::std::hash::poseidon2::Poseidon2Hasher; -use dep::std::hash::poseidon::PoseidonHasher; +use std::hash::Hasher; +use std::hash::poseidon2::Poseidon2Hasher; +use std::hash::poseidon::PoseidonHasher; fn main(x: Field, y: pub Field) { let mut hasher = PoseidonHasher::default(); diff --git a/test_programs/execution_success/u128/src/main.nr b/test_programs/execution_success/u128/src/main.nr index a403571ea74..d0835ccf30f 100644 --- a/test_programs/execution_success/u128/src/main.nr +++ b/test_programs/execution_success/u128/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(mut x: u32, y: u32, z: u32, big_int: U128, hexa: str<7>) { let a = U128::from_u64s_le(x as u64, x as u64); let b = U128::from_u64s_le(y as u64, x as u64); diff --git a/test_programs/execution_success/unit_value/src/main.nr b/test_programs/execution_success/unit_value/src/main.nr index f3844e03cf2..a488f267b4c 100644 --- a/test_programs/execution_success/unit_value/src/main.nr +++ b/test_programs/execution_success/unit_value/src/main.nr @@ -1,5 +1,5 @@ fn get_transaction() { - dep::std::unsafe::zeroed() + std::unsafe::zeroed() } fn main() { diff --git a/test_programs/execution_success/wrapping_operations/src/main.nr b/test_programs/execution_success/wrapping_operations/src/main.nr index 85fd65b193c..d8345884c82 100644 --- a/test_programs/execution_success/wrapping_operations/src/main.nr +++ b/test_programs/execution_success/wrapping_operations/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(x: u8, y: u8) { assert(std::wrapping_sub(x, 1) == y); assert(std::wrapping_add(y, 1) == x); diff --git a/test_programs/format.sh b/test_programs/format.sh index 3c679b8689e..fa63d228752 100755 --- a/test_programs/format.sh +++ b/test_programs/format.sh @@ -2,7 +2,7 @@ set -e # These tests are incompatible with gas reporting -excluded_dirs=("workspace" "workspace_default_member" "workspace_reexport_bug") +excluded_dirs=("workspace" "overlapping_dep_and_mod" "overlapping_dep_and_mod_fix" "workspace_default_member" "workspace_reexport_bug") # These tests cause failures in CI with a stack overflow for some reason. ci_excluded_dirs=("eddsa") diff --git a/test_programs/noir_test_failure/should_fail_mismatch/src/main.nr b/test_programs/noir_test_failure/should_fail_mismatch/src/main.nr index 253e999ce07..08a9234a752 100644 --- a/test_programs/noir_test_failure/should_fail_mismatch/src/main.nr +++ b/test_programs/noir_test_failure/should_fail_mismatch/src/main.nr @@ -11,5 +11,5 @@ fn test_with_extra_space() { #[test(should_fail_with = "Not equal")] fn test_runtime_mismatch() { // We use a pedersen commitment here so that the assertion failure is only known at runtime. - assert_eq(dep::std::hash::pedersen_commitment([27]).x, 0, "Not equal "); + assert_eq(std::hash::pedersen_commitment([27]).x, 0, "Not equal "); } diff --git a/test_programs/noir_test_success/brillig_overflow_checks/src/main.nr b/test_programs/noir_test_success/brillig_overflow_checks/src/main.nr index 5d73ef96d49..35a0c44218f 100644 --- a/test_programs/noir_test_success/brillig_overflow_checks/src/main.nr +++ b/test_programs/noir_test_success/brillig_overflow_checks/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::field::bn254::{TWO_POW_128, assert_gt}; +use std::field::bn254::{TWO_POW_128, assert_gt}; #[test(should_fail_with = "attempt to add with overflow")] unconstrained fn test_overflow_add() { diff --git a/test_programs/noir_test_success/embedded_curve_ops/src/main.nr b/test_programs/noir_test_success/embedded_curve_ops/src/main.nr index 9e3c5d87874..225e86397fd 100644 --- a/test_programs/noir_test_success/embedded_curve_ops/src/main.nr +++ b/test_programs/noir_test_success/embedded_curve_ops/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul}; +use std::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, multi_scalar_mul}; #[test] diff --git a/test_programs/noir_test_success/field_comparisons/src/main.nr b/test_programs/noir_test_success/field_comparisons/src/main.nr index 105d82ca755..8613e6d6c4f 100644 --- a/test_programs/noir_test_success/field_comparisons/src/main.nr +++ b/test_programs/noir_test_success/field_comparisons/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::field::bn254::{TWO_POW_128, assert_gt}; +use std::field::bn254::{TWO_POW_128, assert_gt}; #[test(should_fail)] fn test_assert_gt_should_fail_eq() { diff --git a/test_programs/noir_test_success/mock_oracle/src/main.nr b/test_programs/noir_test_success/mock_oracle/src/main.nr index d840ffaef66..4d3dd8d030b 100644 --- a/test_programs/noir_test_success/mock_oracle/src/main.nr +++ b/test_programs/noir_test_success/mock_oracle/src/main.nr @@ -1,4 +1,4 @@ -use dep::std::test::OracleMock; +use std::test::OracleMock; struct Point { x: Field, diff --git a/test_programs/noir_test_success/regression_4561/src/main.nr b/test_programs/noir_test_success/regression_4561/src/main.nr index 138f7e805b3..70c447b49af 100644 --- a/test_programs/noir_test_success/regression_4561/src/main.nr +++ b/test_programs/noir_test_success/regression_4561/src/main.nr @@ -1,5 +1,5 @@ // Regression test for issue #4561 -use dep::std::test::OracleMock; +use std::test::OracleMock; type TReturnElem = [Field; 3]; type TReturn = [TReturnElem; 2]; @@ -41,4 +41,4 @@ unconstrained fn two_nested_return_unconstrained() -> (Field, TReturn, Field, TR fn two_nested_return() { OracleMock::mock("two_nested_return").returns((0, [1, 2, 3, 4, 5, 6], 7, [1, 2, 3, 4, 5, 6])); assert_eq(two_nested_return_unconstrained(), (0, [[1, 2, 3], [4, 5, 6]], 7, [[1, 2, 3], [4, 5, 6]])); -} \ No newline at end of file +} diff --git a/test_programs/noir_test_success/should_fail_with_matches/src/main.nr b/test_programs/noir_test_success/should_fail_with_matches/src/main.nr index 1f5c29e58a2..b713976643b 100644 --- a/test_programs/noir_test_success/should_fail_with_matches/src/main.nr +++ b/test_programs/noir_test_success/should_fail_with_matches/src/main.nr @@ -10,21 +10,21 @@ fn test_should_fail_without_match() { #[test(should_fail_with = "Not equal")] fn test_should_fail_with_runtime_match() { - assert_eq(dep::std::hash::pedersen_commitment([27]).x, 0, "Not equal"); + assert_eq(std::hash::pedersen_commitment([27]).x, 0, "Not equal"); } #[test(should_fail)] fn test_should_fail_without_runtime_match() { - assert_eq(dep::std::hash::pedersen_commitment([27]).x, 0); + assert_eq(std::hash::pedersen_commitment([27]).x, 0); } struct InvalidPointError { - point: dep::std::embedded_curve_ops::EmbeddedCurvePoint, + point: std::embedded_curve_ops::EmbeddedCurvePoint, } #[test(should_fail_with = "InvalidPointError { point: EmbeddedCurvePoint { x: 0x1cea3a116d01eb94d568ef04c3dfbc39f96f015ed801ab8958e360d406503ce0, y: 0x2721b237df87234acc36a238b8f231a3d31d18fe3845fff4cc59f0bd873818f8, is_infinite: false } }")] fn test_should_fail_with_struct() { - let hash = dep::std::hash::pedersen_commitment([27]); + let hash = std::hash::pedersen_commitment([27]); assert_eq(hash.x, 0, InvalidPointError { point: hash }); } @@ -37,7 +37,7 @@ fn test_should_fail_with_basic_type_fmt_string() { #[test(should_fail_with = "Invalid hash: EmbeddedCurvePoint { x: 0x1cea3a116d01eb94d568ef04c3dfbc39f96f015ed801ab8958e360d406503ce0, y: 0x2721b237df87234acc36a238b8f231a3d31d18fe3845fff4cc59f0bd873818f8, is_infinite: false }")] fn test_should_fail_with_struct_fmt_string() { - let hash = dep::std::hash::pedersen_commitment([27]); + let hash = std::hash::pedersen_commitment([27]); assert_eq(hash.x, 0, f"Invalid hash: {hash}"); } @@ -55,17 +55,17 @@ unconstrained fn unconstrained_test_should_fail_without_match() { #[test(should_fail_with = "Not equal")] unconstrained fn unconstrained_test_should_fail_with_runtime_match() { - assert_eq(dep::std::hash::pedersen_commitment([27]).x, 0, "Not equal"); + assert_eq(std::hash::pedersen_commitment([27]).x, 0, "Not equal"); } #[test(should_fail)] unconstrained fn unconstrained_test_should_fail_without_runtime_match() { - assert_eq(dep::std::hash::pedersen_commitment([27]).x, 0); + assert_eq(std::hash::pedersen_commitment([27]).x, 0); } #[test(should_fail_with = "InvalidPointError { point: EmbeddedCurvePoint { x: 0x1cea3a116d01eb94d568ef04c3dfbc39f96f015ed801ab8958e360d406503ce0, y: 0x2721b237df87234acc36a238b8f231a3d31d18fe3845fff4cc59f0bd873818f8, is_infinite: false } }")] unconstrained fn unconstrained_test_should_fail_with_struct() { - let hash = dep::std::hash::pedersen_commitment([27]); + let hash = std::hash::pedersen_commitment([27]); assert_eq(hash.x, 0, InvalidPointError { point: hash }); } @@ -78,6 +78,6 @@ unconstrained fn unconstrained_test_should_fail_with_basic_type_fmt_string() { #[test(should_fail_with = "Invalid hash: EmbeddedCurvePoint { x: 0x1cea3a116d01eb94d568ef04c3dfbc39f96f015ed801ab8958e360d406503ce0, y: 0x2721b237df87234acc36a238b8f231a3d31d18fe3845fff4cc59f0bd873818f8, is_infinite: false }")] unconstrained fn unconstrained_test_should_fail_with_struct_fmt_string() { - let hash = dep::std::hash::pedersen_commitment([27]); + let hash = std::hash::pedersen_commitment([27]); assert_eq(hash.x, 0, f"Invalid hash: {hash}"); } diff --git a/test_programs/rebuild.sh b/test_programs/rebuild.sh index 2d4147cb08c..094c3902583 100755 --- a/test_programs/rebuild.sh +++ b/test_programs/rebuild.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -e -NO_PARALLEL=${1:-} - process_dir() { local dir=$1 local current_dir=$2 @@ -62,28 +60,7 @@ for dir in $current_dir/benchmarks/*; do dirs_to_process+=("$dir") done -# Process each directory in parallel -pids=() -if [ -z $NO_PARALLEL ]; then -for dir in "${dirs_to_process[@]}"; do - process_dir "$dir" "$current_dir" & - pids+=($!) -done -else -for dir in "${dirs_to_process[@]}"; do - process_dir "$dir" "$current_dir" - pids+=($!) -done -fi -# Check the exit status of each background job. -for pid in "${pids[@]}"; do - wait $pid || exit_status=$? -done +parallel -j0 process_dir {} "$current_dir" ::: ${dirs_to_process[@]} -# Exit with a failure status if any job failed. -if [ ! -z "$exit_status" ]; then - echo "Rebuild failed!" - exit $exit_status -fi echo "Rebuild Succeeded!" diff --git a/test_programs/test_libraries/diamond_deps_1/src/lib.nr b/test_programs/test_libraries/diamond_deps_1/src/lib.nr index 60c001ec64e..d76ce5a05e9 100644 --- a/test_programs/test_libraries/diamond_deps_1/src/lib.nr +++ b/test_programs/test_libraries/diamond_deps_1/src/lib.nr @@ -1,4 +1,4 @@ -use dep::dep2::call_dep2; +use dep2::call_dep2; pub fn call_dep1_then_dep2(x: Field, y: Field) -> Field { call_dep2(x, y) diff --git a/test_programs/test_libraries/exporting_lib/src/lib.nr b/test_programs/test_libraries/exporting_lib/src/lib.nr index bfb1819132a..fdd9f139d41 100644 --- a/test_programs/test_libraries/exporting_lib/src/lib.nr +++ b/test_programs/test_libraries/exporting_lib/src/lib.nr @@ -4,6 +4,6 @@ struct MyStruct { type FooStruct = MyStruct; -fn is_struct_zero(val: MyStruct) -> bool { +pub fn is_struct_zero(val: MyStruct) -> bool { val.inner == 0 } diff --git a/test_programs/test_libraries/reexporting_lib/src/lib.nr b/test_programs/test_libraries/reexporting_lib/src/lib.nr index f12dfe01ecd..1bced548304 100644 --- a/test_programs/test_libraries/reexporting_lib/src/lib.nr +++ b/test_programs/test_libraries/reexporting_lib/src/lib.nr @@ -1,3 +1,3 @@ -use dep::exporting_lib::{MyStruct, FooStruct}; +use exporting_lib::{MyStruct, FooStruct}; -use dep::exporting_lib as lib; +use exporting_lib as lib; diff --git a/tooling/debugger/src/source_code_printer.rs b/tooling/debugger/src/source_code_printer.rs index e298eb8aadd..ad511563477 100644 --- a/tooling/debugger/src/source_code_printer.rs +++ b/tooling/debugger/src/source_code_printer.rs @@ -143,7 +143,7 @@ fn render_line( // // Consider for example the file (line numbers added to facilitate this doc): // ``` -// 1 use dep::std::hash::poseidon; +// 1 use std::hash::poseidon; // 2 // 3 fn main(x1: [Field; 2], y1: pub Field, x2: [Field; 4], y2: pub Field) { // 4 let hash1 = poseidon::bn254::hash_2(x1); @@ -157,7 +157,7 @@ fn render_line( // // If the location to render is `poseidon::bn254::hash_2(x1)`, we'll render the file as: // ``` -// 1 use dep::std::hash::poseidon; +// 1 use std::hash::poseidon; // 2 // 3 fn main(x1: [Field; 2], y1: pub Field, x2: [Field; 4], y2: pub Field) { // 4 let hash1 = poseidon::bn254::hash_2(x1); diff --git a/tooling/nargo_fmt/tests/expected/contract.nr b/tooling/nargo_fmt/tests/expected/contract.nr index 97a6ebd6b77..e3a5877725a 100644 --- a/tooling/nargo_fmt/tests/expected/contract.nr +++ b/tooling/nargo_fmt/tests/expected/contract.nr @@ -3,11 +3,11 @@ // Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. // Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. contract Benchmarking { - use dep::aztec::protocol_types::abis::function_selector::FunctionSelector; + use aztec::protocol_types::abis::function_selector::FunctionSelector; - use dep::value_note::{utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}}; + use value_note::{utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}}; - use dep::aztec::{ + use aztec::{ context::Context, note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, log::emit_unencrypted_log, state_vars::{Map, PublicMutable, PrivateSet}, types::type_serialization::field_serialization::{FieldSerializationMethods, FIELD_SERIALIZED_LEN}, diff --git a/tooling/nargo_fmt/tests/expected/import_braces.nr b/tooling/nargo_fmt/tests/expected/import_braces.nr index 49c9d09001e..9c74c477f5f 100644 --- a/tooling/nargo_fmt/tests/expected/import_braces.nr +++ b/tooling/nargo_fmt/tests/expected/import_braces.nr @@ -1 +1 @@ -use dep::std::hash::sha256; +use std::hash::sha256; diff --git a/tooling/nargo_fmt/tests/expected/let.nr b/tooling/nargo_fmt/tests/expected/let.nr index 7ff69e74306..0edc0eaf922 100644 --- a/tooling/nargo_fmt/tests/expected/let.nr +++ b/tooling/nargo_fmt/tests/expected/let.nr @@ -51,10 +51,10 @@ fn let_() { let expr = MyExpr { /*A boolean literal (true, false).*/ kind: ExprKind::Bool(true) }; - let mut V = dep::crate2::MyStruct { Q: x }; - let mut V = dep::crate2::MyStruct {}; - let mut V = dep::crate2::MyStruct {/*test*/}; - let mut V = dep::crate2::MyStruct { + let mut V = crate2::MyStruct { Q: x }; + let mut V = crate2::MyStruct {}; + let mut V = crate2::MyStruct {/*test*/}; + let mut V = crate2::MyStruct { // sad }; } diff --git a/tooling/nargo_fmt/tests/expected/print.nr b/tooling/nargo_fmt/tests/expected/print.nr index 3bce0941da2..d8404f674b0 100644 --- a/tooling/nargo_fmt/tests/expected/print.nr +++ b/tooling/nargo_fmt/tests/expected/print.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { std::print("Hello world"); std::println("Hello world"); diff --git a/tooling/nargo_fmt/tests/expected/print2.nr b/tooling/nargo_fmt/tests/expected/print2.nr index 3bce0941da2..d8404f674b0 100644 --- a/tooling/nargo_fmt/tests/expected/print2.nr +++ b/tooling/nargo_fmt/tests/expected/print2.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { std::print("Hello world"); std::println("Hello world"); diff --git a/tooling/nargo_fmt/tests/expected/singleton_import.nr b/tooling/nargo_fmt/tests/expected/singleton_import.nr new file mode 100644 index 00000000000..bb1bad500d9 --- /dev/null +++ b/tooling/nargo_fmt/tests/expected/singleton_import.nr @@ -0,0 +1,2 @@ +use dep::std; +use some_crate; diff --git a/tooling/nargo_fmt/tests/input/contract.nr b/tooling/nargo_fmt/tests/input/contract.nr index 97a6ebd6b77..e3a5877725a 100644 --- a/tooling/nargo_fmt/tests/input/contract.nr +++ b/tooling/nargo_fmt/tests/input/contract.nr @@ -3,11 +3,11 @@ // Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. // Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. contract Benchmarking { - use dep::aztec::protocol_types::abis::function_selector::FunctionSelector; + use aztec::protocol_types::abis::function_selector::FunctionSelector; - use dep::value_note::{utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}}; + use value_note::{utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}}; - use dep::aztec::{ + use aztec::{ context::Context, note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, log::emit_unencrypted_log, state_vars::{Map, PublicMutable, PrivateSet}, types::type_serialization::field_serialization::{FieldSerializationMethods, FIELD_SERIALIZED_LEN}, diff --git a/tooling/nargo_fmt/tests/input/import_braces.nr b/tooling/nargo_fmt/tests/input/import_braces.nr index 88c7e9562a8..0647bbaa580 100644 --- a/tooling/nargo_fmt/tests/input/import_braces.nr +++ b/tooling/nargo_fmt/tests/input/import_braces.nr @@ -1 +1 @@ -use dep::std::hash::{sha256}; \ No newline at end of file +use std::hash::{sha256}; diff --git a/tooling/nargo_fmt/tests/input/let.nr b/tooling/nargo_fmt/tests/input/let.nr index 37cdc6655c7..16ce0a9d7f1 100644 --- a/tooling/nargo_fmt/tests/input/let.nr +++ b/tooling/nargo_fmt/tests/input/let.nr @@ -26,10 +26,10 @@ kind: ExprKind::Bool(true), let expr = MyExpr {/*A boolean literal (true, false).*/kind: ExprKind::Bool(true),}; - let mut V = dep::crate2::MyStruct { Q: x }; - let mut V = dep::crate2::MyStruct {}; - let mut V = dep::crate2::MyStruct {/*test*/}; - let mut V = dep::crate2::MyStruct { + let mut V = crate2::MyStruct { Q: x }; + let mut V = crate2::MyStruct {}; + let mut V = crate2::MyStruct {/*test*/}; + let mut V = crate2::MyStruct { // sad }; } diff --git a/tooling/nargo_fmt/tests/input/print.nr b/tooling/nargo_fmt/tests/input/print.nr index 3bce0941da2..d8404f674b0 100644 --- a/tooling/nargo_fmt/tests/input/print.nr +++ b/tooling/nargo_fmt/tests/input/print.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { std::print("Hello world"); std::println("Hello world"); diff --git a/tooling/nargo_fmt/tests/input/print2.nr b/tooling/nargo_fmt/tests/input/print2.nr index 3bce0941da2..d8404f674b0 100644 --- a/tooling/nargo_fmt/tests/input/print2.nr +++ b/tooling/nargo_fmt/tests/input/print2.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main() { std::print("Hello world"); std::println("Hello world"); diff --git a/tooling/nargo_fmt/tests/input/singleton_import.nr b/tooling/nargo_fmt/tests/input/singleton_import.nr new file mode 100644 index 00000000000..bb1bad500d9 --- /dev/null +++ b/tooling/nargo_fmt/tests/input/singleton_import.nr @@ -0,0 +1,2 @@ +use dep::std; +use some_crate; diff --git a/tooling/noir_js/test/noir_compiled_examples/assert_lt/src/main.nr b/tooling/noir_js/test/noir_compiled_examples/assert_lt/src/main.nr index a9aaae5f2f7..5a20a92048f 100644 --- a/tooling/noir_js/test/noir_compiled_examples/assert_lt/src/main.nr +++ b/tooling/noir_js/test/noir_compiled_examples/assert_lt/src/main.nr @@ -1,5 +1,3 @@ -use dep::std; - fn main(x: u64, y: pub u64) -> pub u64 { // We include a println statement to show that noirJS will ignore this and continue execution std::println("foo");