From ca9117dc23964ff787e49d6fd1437ccebf449c78 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 11:39:58 +0100 Subject: [PATCH 01/11] Add a compiler_unstable_features field to Nargo.toml --- tooling/lsp/src/lib.rs | 4 ++++ tooling/nargo/src/package.rs | 2 ++ tooling/nargo_cli/tests/stdlib-tests.rs | 1 + tooling/nargo_toml/src/lib.rs | 14 +++++++++++- tooling/nargo_toml/src/semver.rs | 29 ++++++++----------------- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/tooling/lsp/src/lib.rs b/tooling/lsp/src/lib.rs index 0d161b55c44..fd5a8444dbf 100644 --- a/tooling/lsp/src/lib.rs +++ b/tooling/lsp/src/lib.rs @@ -269,6 +269,9 @@ fn byte_span_to_range<'a, F: files::Files<'a> + ?Sized>( } } +/// Create a workspace based on the source file location: +/// * if there is a `Nargo.toml`` file, use it to read the workspace +/// * otherwise treat the parent directory as a dummy workspace pub(crate) fn resolve_workspace_for_source_path(file_path: &Path) -> Result { if let Some(toml_path) = find_file_manifest(file_path) { match resolve_workspace_from_toml( @@ -304,6 +307,7 @@ pub(crate) fn resolve_workspace_for_source_path(file_path: &Path) -> Result, // A semver string which specifies the compiler version required to compile this package pub compiler_required_version: Option, + pub compiler_required_unstable_features: Vec, pub root_dir: PathBuf, pub package_type: PackageType, pub entry_path: PathBuf, diff --git a/tooling/nargo_cli/tests/stdlib-tests.rs b/tooling/nargo_cli/tests/stdlib-tests.rs index f2d9d133b3c..8c25e0b25fc 100644 --- a/tooling/nargo_cli/tests/stdlib-tests.rs +++ b/tooling/nargo_cli/tests/stdlib-tests.rs @@ -58,6 +58,7 @@ fn run_stdlib_tests(force_brillig: bool, inliner_aggressiveness: i64) { let dummy_package = Package { version: None, compiler_required_version: None, + compiler_required_unstable_features: Vec::new(), root_dir: PathBuf::from("."), package_type: PackageType::Binary, entry_path: PathBuf::from("main.nr"), diff --git a/tooling/nargo_toml/src/lib.rs b/tooling/nargo_toml/src/lib.rs index d3a00fc241f..06e070290c5 100644 --- a/tooling/nargo_toml/src/lib.rs +++ b/tooling/nargo_toml/src/lib.rs @@ -4,6 +4,7 @@ use std::{ collections::BTreeMap, path::{Component, Path, PathBuf}, + str::FromStr, }; use errors::SemverError; @@ -13,7 +14,7 @@ use nargo::{ workspace::Workspace, }; use noirc_driver::parse_expression_width; -use noirc_frontend::graph::CrateName; +use noirc_frontend::{elaborator::UnstableFeature, graph::CrateName}; use serde::Deserialize; mod errors; @@ -241,9 +242,17 @@ impl PackageConfig { }) .map_or(Ok(None), |res| res.map(Some))?; + // Collect any unstable features the package needs to compile. + // Ignore the ones that we don't recognize: maybe they are no longer unstable, but a dependency hasn't been updated. + let compiler_required_unstable_features = + self.package.compiler_unstable_features.as_ref().map_or(Vec::new(), |feats| { + feats.iter().flat_map(|feat| UnstableFeature::from_str(feat).ok()).collect() + }); + Ok(Package { version: self.package.version.clone(), compiler_required_version: self.package.compiler_version.clone(), + compiler_required_unstable_features, root_dir: root_dir.to_path_buf(), entry_path, package_type, @@ -317,6 +326,9 @@ pub struct PackageMetadata { // We also state that ACIR and the compiler will upgrade in lockstep. // so you will not need to supply an ACIR and compiler version pub compiler_version: Option, + /// List of unstable features we want the compiler to enable to compile this package. + /// This is most useful with the LSP, so it can figure out what is allowed without CLI args. + pub compiler_unstable_features: Option>, pub license: Option, pub expression_width: Option, } diff --git a/tooling/nargo_toml/src/semver.rs b/tooling/nargo_toml/src/semver.rs index 83f31c71a5e..4fc8f3ff60c 100644 --- a/tooling/nargo_toml/src/semver.rs +++ b/tooling/nargo_toml/src/semver.rs @@ -100,6 +100,7 @@ mod tests { let mut package = Package { compiler_required_version: Some("0.1.0".to_string()), + compiler_required_unstable_features: Vec::new(), root_dir: PathBuf::new(), package_type: PackageType::Library, entry_path: PathBuf::new(), @@ -136,6 +137,7 @@ mod tests { let mut package = Package { compiler_required_version: Some("0.1.0".to_string()), + compiler_required_unstable_features: Vec::new(), root_dir: PathBuf::new(), package_type: PackageType::Library, entry_path: PathBuf::new(), @@ -145,26 +147,10 @@ mod tests { expression_width: None, }; - let valid_dependency = Package { - compiler_required_version: Some("0.1.0".to_string()), - root_dir: PathBuf::new(), - package_type: PackageType::Library, - entry_path: PathBuf::new(), - name: CrateName::from_str("good_dependency").unwrap(), - dependencies: BTreeMap::new(), - version: Some("1.0".to_string()), - expression_width: None, - }; - let invalid_dependency = Package { - compiler_required_version: Some("0.2.0".to_string()), - root_dir: PathBuf::new(), - package_type: PackageType::Library, - entry_path: PathBuf::new(), - name: CrateName::from_str("bad_dependency").unwrap(), - dependencies: BTreeMap::new(), - version: Some("1.0".to_string()), - expression_width: None, - }; + let valid_dependency = + Package { compiler_required_version: Some("0.1.0".to_string()), ..package.clone() }; + let invalid_dependency = + Package { compiler_required_version: Some("0.2.0".to_string()), ..package.clone() }; package.dependencies.insert( CrateName::from_str("test_dep_valid").unwrap(), @@ -202,6 +188,7 @@ mod tests { let package = Package { compiler_required_version: Some(">=0.1.0".to_string()), + compiler_required_unstable_features: Vec::new(), root_dir: PathBuf::new(), package_type: PackageType::Library, entry_path: PathBuf::new(), @@ -224,6 +211,7 @@ mod tests { let package = Package { compiler_required_version: Some(">=0.1.0".to_string()), + compiler_required_unstable_features: Vec::new(), root_dir: PathBuf::new(), package_type: PackageType::Library, entry_path: PathBuf::new(), @@ -244,6 +232,7 @@ mod tests { let package = Package { compiler_required_version: Some("0.1.0".to_string()), + compiler_required_unstable_features: Vec::new(), root_dir: PathBuf::new(), package_type: PackageType::Library, entry_path: PathBuf::new(), From e0c64c40654e6060c72be556faa655a062071be1 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 12:34:44 +0100 Subject: [PATCH 02/11] Copy the unstable features from the package and its dependencies to the context --- compiler/noirc_frontend/src/elaborator/options.rs | 2 +- compiler/noirc_frontend/src/hir/mod.rs | 6 ++++++ tooling/nargo/src/lib.rs | 10 +++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/compiler/noirc_frontend/src/elaborator/options.rs b/compiler/noirc_frontend/src/elaborator/options.rs index 0d72d2955ba..d76314f68ea 100644 --- a/compiler/noirc_frontend/src/elaborator/options.rs +++ b/compiler/noirc_frontend/src/elaborator/options.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -#[derive(Copy, Clone, Debug, PartialEq, Eq)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub enum UnstableFeature { Enums, Ownership, diff --git a/compiler/noirc_frontend/src/hir/mod.rs b/compiler/noirc_frontend/src/hir/mod.rs index 56540ebad59..6211d2000e8 100644 --- a/compiler/noirc_frontend/src/hir/mod.rs +++ b/compiler/noirc_frontend/src/hir/mod.rs @@ -7,6 +7,7 @@ pub mod type_check; use crate::ast::UnresolvedGenerics; use crate::debug::DebugInstrumenter; +use crate::elaborator::UnstableFeature; use crate::graph::{CrateGraph, CrateId}; use crate::hir_def::function::FuncMeta; use crate::node_interner::{FuncId, NodeInterner, TypeId}; @@ -56,6 +57,9 @@ pub struct Context<'file_manager, 'parsed_files> { /// Writer for comptime prints. pub interpreter_output: Option>>, + + /// Any unstable features required by the current package or its dependencies. + pub required_unstable_features: HashSet, } #[derive(Debug)] @@ -78,6 +82,7 @@ impl Context<'_, '_> { parsed_files: Cow::Owned(parsed_files), package_build_path: PathBuf::default(), interpreter_output: Some(Rc::new(RefCell::new(std::io::stdout()))), + required_unstable_features: HashSet::new(), } } @@ -96,6 +101,7 @@ impl Context<'_, '_> { parsed_files: Cow::Borrowed(parsed_files), package_build_path: PathBuf::default(), interpreter_output: Some(Rc::new(RefCell::new(std::io::stdout()))), + required_unstable_features: HashSet::new(), } } diff --git a/tooling/nargo/src/lib.rs b/tooling/nargo/src/lib.rs index ba538d735d9..30a52beaf5a 100644 --- a/tooling/nargo/src/lib.rs +++ b/tooling/nargo/src/lib.rs @@ -40,6 +40,7 @@ pub fn prepare_dependencies( for (dep_name, dep) in dependencies.iter() { match dep { Dependency::Remote { package } | Dependency::Local { package } => { + add_unstable_features(context, package); let crate_id = prepare_dependency(context, &package.entry_path); add_dep(context, parent_crate, crate_id, dep_name.clone()); prepare_dependencies(context, crate_id, &package.dependencies); @@ -287,10 +288,13 @@ pub fn prepare_package<'file_manager, 'parsed_files>( package: &Package, ) -> (Context<'file_manager, 'parsed_files>, CrateId) { let mut context = Context::from_ref_file_manager(file_manager, parsed_files); - + add_unstable_features(&mut context, package); let crate_id = prepare_crate(&mut context, &package.entry_path); - prepare_dependencies(&mut context, crate_id, &package.dependencies); - (context, crate_id) } + +/// Add any unstable features requires by the `Package` to the `Context`. +fn add_unstable_features(context: &mut Context, package: &Package) { + context.required_unstable_features.extend(package.compiler_required_unstable_features.iter()); +} From bc32a766c1f7a4d75384958b13488873b0a2658a Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 12:43:17 +0100 Subject: [PATCH 03/11] Track required unstable features per crate --- compiler/noirc_frontend/src/hir/mod.rs | 6 +++--- tooling/nargo/src/lib.rs | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/compiler/noirc_frontend/src/hir/mod.rs b/compiler/noirc_frontend/src/hir/mod.rs index 6211d2000e8..88c6509f05a 100644 --- a/compiler/noirc_frontend/src/hir/mod.rs +++ b/compiler/noirc_frontend/src/hir/mod.rs @@ -59,7 +59,7 @@ pub struct Context<'file_manager, 'parsed_files> { pub interpreter_output: Option>>, /// Any unstable features required by the current package or its dependencies. - pub required_unstable_features: HashSet, + pub required_unstable_features: BTreeMap>, } #[derive(Debug)] @@ -82,7 +82,7 @@ impl Context<'_, '_> { parsed_files: Cow::Owned(parsed_files), package_build_path: PathBuf::default(), interpreter_output: Some(Rc::new(RefCell::new(std::io::stdout()))), - required_unstable_features: HashSet::new(), + required_unstable_features: BTreeMap::new(), } } @@ -101,7 +101,7 @@ impl Context<'_, '_> { parsed_files: Cow::Borrowed(parsed_files), package_build_path: PathBuf::default(), interpreter_output: Some(Rc::new(RefCell::new(std::io::stdout()))), - required_unstable_features: HashSet::new(), + required_unstable_features: BTreeMap::new(), } } diff --git a/tooling/nargo/src/lib.rs b/tooling/nargo/src/lib.rs index 30a52beaf5a..357b85e22db 100644 --- a/tooling/nargo/src/lib.rs +++ b/tooling/nargo/src/lib.rs @@ -40,8 +40,8 @@ pub fn prepare_dependencies( for (dep_name, dep) in dependencies.iter() { match dep { Dependency::Remote { package } | Dependency::Local { package } => { - add_unstable_features(context, package); let crate_id = prepare_dependency(context, &package.entry_path); + add_unstable_features(context, crate_id, package); add_dep(context, parent_crate, crate_id, dep_name.clone()); prepare_dependencies(context, crate_id, &package.dependencies); } @@ -288,13 +288,15 @@ pub fn prepare_package<'file_manager, 'parsed_files>( package: &Package, ) -> (Context<'file_manager, 'parsed_files>, CrateId) { let mut context = Context::from_ref_file_manager(file_manager, parsed_files); - add_unstable_features(&mut context, package); let crate_id = prepare_crate(&mut context, &package.entry_path); + add_unstable_features(&mut context, crate_id, package); prepare_dependencies(&mut context, crate_id, &package.dependencies); (context, crate_id) } /// Add any unstable features requires by the `Package` to the `Context`. -fn add_unstable_features(context: &mut Context, package: &Package) { - context.required_unstable_features.extend(package.compiler_required_unstable_features.iter()); +fn add_unstable_features(context: &mut Context, crate_id: CrateId, package: &Package) { + context + .required_unstable_features + .insert(crate_id, package.compiler_required_unstable_features.clone()); } From 32dd1a6ebffc20ec1e3427cb3f19a62089eda9ba Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 13:06:23 +0100 Subject: [PATCH 04/11] Check whether the feature is enabled on the crate itself --- .../noirc_frontend/src/elaborator/comptime.rs | 1 + compiler/noirc_frontend/src/elaborator/mod.rs | 23 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/compiler/noirc_frontend/src/elaborator/comptime.rs b/compiler/noirc_frontend/src/elaborator/comptime.rs index f223f870743..68ea6a796de 100644 --- a/compiler/noirc_frontend/src/elaborator/comptime.rs +++ b/compiler/noirc_frontend/src/elaborator/comptime.rs @@ -90,6 +90,7 @@ impl<'context> Elaborator<'context> { self.usage_tracker, self.crate_graph, self.interpreter_output, + self.required_unstable_features, self.crate_id, self.interpreter_call_stack.clone(), self.options, diff --git a/compiler/noirc_frontend/src/elaborator/mod.rs b/compiler/noirc_frontend/src/elaborator/mod.rs index 1396f63295a..548f8519ed2 100644 --- a/compiler/noirc_frontend/src/elaborator/mod.rs +++ b/compiler/noirc_frontend/src/elaborator/mod.rs @@ -127,6 +127,8 @@ pub struct Elaborator<'context> { pub(crate) crate_graph: &'context CrateGraph, pub(crate) interpreter_output: &'context Option>>, + required_unstable_features: &'context BTreeMap>, + unsafe_block_status: UnsafeBlockStatus, current_loop: Option, @@ -244,6 +246,7 @@ impl<'context> Elaborator<'context> { usage_tracker: &'context mut UsageTracker, crate_graph: &'context CrateGraph, interpreter_output: &'context Option>>, + required_unstable_features: &'context BTreeMap>, crate_id: CrateId, interpreter_call_stack: im::Vector, options: ElaboratorOptions<'context>, @@ -257,6 +260,7 @@ impl<'context> Elaborator<'context> { usage_tracker, crate_graph, interpreter_output, + required_unstable_features, unsafe_block_status: UnsafeBlockStatus::NotInUnsafeBlock, current_loop: None, generics: Vec::new(), @@ -290,6 +294,7 @@ impl<'context> Elaborator<'context> { &mut context.usage_tracker, &context.crate_graph, &context.interpreter_output, + &context.required_unstable_features, crate_id, im::Vector::new(), options, @@ -2383,10 +2388,22 @@ impl<'context> Elaborator<'context> { /// Register a use of the given unstable feature. Errors if the feature has not /// been explicitly enabled in this package. pub fn use_unstable_feature(&mut self, feature: UnstableFeature, location: Location) { - if !self.options.enabled_unstable_features.contains(&feature) { - let reason = ParserErrorReason::ExperimentalFeature(feature); - self.push_err(ParserError::with_reason(reason, location)); + // Is the feature globally enabled via CLI options? + if self.options.enabled_unstable_features.contains(&feature) { + return; } + + // Is it required by the current crate? + if self + .required_unstable_features + .get(&self.crate_id) + .is_some_and(|fs| fs.contains(&feature)) + { + return; + } + + let reason = ParserErrorReason::ExperimentalFeature(feature); + self.push_err(ParserError::with_reason(reason, location)); } /// Run the given function using the resolver and return true if any errors (not warnings) From b993702ebd03abac392f23925fd651ee2b8605f9 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 13:19:02 +0100 Subject: [PATCH 05/11] Mention the new field in the docs --- docs/docs/getting_started/project_breakdown.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs/getting_started/project_breakdown.md b/docs/docs/getting_started/project_breakdown.md index e442e377040..a26af0f37e7 100644 --- a/docs/docs/getting_started/project_breakdown.md +++ b/docs/docs/getting_started/project_breakdown.md @@ -62,6 +62,7 @@ The package section defines a number of fields including: - `type` (**required**) - can be "bin", "lib", or "contract" to specify whether its a binary, library or Aztec contract - `authors` (optional) - authors of the project - `compiler_version` - specifies the version of the compiler to use. This is enforced by the compiler and follow's [Rust's versioning](https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field), so a `compiler_version = 0.18.0` will enforce Nargo version 0.18.0, `compiler_version = ^0.18.0` will enforce anything above 0.18.0 but below 0.19.0, etc. For more information, see how [Rust handles these operators](https://docs.rs/semver/latest/semver/enum.Op.html) +- `compiler_unstable_features` (optional) - A list of unstable features required by this package to compile. - `description` (optional) - `entry` (optional) - a relative filepath to use as the entry point into your package (overrides the default of `src/lib.nr` or `src/main.nr`) - `backend` (optional) From f60a938c87254597abe30d686231a36a20e9b134 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 13:28:29 +0100 Subject: [PATCH 06/11] Fix docs --- tooling/lsp/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tooling/lsp/src/lib.rs b/tooling/lsp/src/lib.rs index fd5a8444dbf..380d170d146 100644 --- a/tooling/lsp/src/lib.rs +++ b/tooling/lsp/src/lib.rs @@ -270,7 +270,7 @@ fn byte_span_to_range<'a, F: files::Files<'a> + ?Sized>( } /// Create a workspace based on the source file location: -/// * if there is a `Nargo.toml`` file, use it to read the workspace +/// * if there is a `Nargo.toml` file, use it to read the workspace /// * otherwise treat the parent directory as a dummy workspace pub(crate) fn resolve_workspace_for_source_path(file_path: &Path) -> Result { if let Some(toml_path) = find_file_manifest(file_path) { From 4129dae8192caa33027d84cb6d9216ea01f23df4 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 13:46:54 +0100 Subject: [PATCH 07/11] Add CLI args to disable required unstable features --- compiler/noirc_driver/src/lib.rs | 11 +++++++++-- compiler/noirc_frontend/src/elaborator/mod.rs | 13 +++++++++---- compiler/noirc_frontend/src/elaborator/options.rs | 4 ++++ .../src/hir/def_collector/dc_crate.rs | 1 + tooling/nargo/src/lib.rs | 2 +- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/compiler/noirc_driver/src/lib.rs b/compiler/noirc_driver/src/lib.rs index 647b955f30e..81f4d5dd7a5 100644 --- a/compiler/noirc_driver/src/lib.rs +++ b/compiler/noirc_driver/src/lib.rs @@ -202,11 +202,17 @@ pub struct CompileOptions { #[arg(long, hide = true)] pub debug_compile_stdin: bool, - /// Unstable features to enable for this current build + /// Unstable features to enable for this current build. + /// + /// If non-empty, it disables unstable features required in crate manifests. #[arg(value_parser = clap::value_parser!(UnstableFeature))] - #[clap(long, short = 'Z', value_delimiter = ',')] + #[clap(long, short = 'Z', value_delimiter = ',', conflicts_with = "no_unstable_features")] pub unstable_features: Vec, + /// Disable any unstable features required in crate manifests. + #[arg(long, conflicts_with = "unstable_features")] + pub no_unstable_features: bool, + /// Used internally to avoid comptime println from producing output #[arg(long, hide = true)] pub disable_comptime_printing: bool, @@ -268,6 +274,7 @@ impl CompileOptions { debug_comptime_in_file: self.debug_comptime_in_file.as_deref(), pedantic_solving: self.pedantic_solving, enabled_unstable_features: &self.unstable_features, + disable_required_unstable_features: self.no_unstable_features, } } } diff --git a/compiler/noirc_frontend/src/elaborator/mod.rs b/compiler/noirc_frontend/src/elaborator/mod.rs index 548f8519ed2..88722741ae2 100644 --- a/compiler/noirc_frontend/src/elaborator/mod.rs +++ b/compiler/noirc_frontend/src/elaborator/mod.rs @@ -2393,11 +2393,16 @@ impl<'context> Elaborator<'context> { return; } + // Can crates require unstable features in their manifest? + let enable_required_unstable_features = self.options.enabled_unstable_features.is_empty() + && !self.options.disable_required_unstable_features; + // Is it required by the current crate? - if self - .required_unstable_features - .get(&self.crate_id) - .is_some_and(|fs| fs.contains(&feature)) + if enable_required_unstable_features + && self + .required_unstable_features + .get(&self.crate_id) + .is_some_and(|fs| fs.contains(&feature)) { return; } diff --git a/compiler/noirc_frontend/src/elaborator/options.rs b/compiler/noirc_frontend/src/elaborator/options.rs index d76314f68ea..daa1bcc5158 100644 --- a/compiler/noirc_frontend/src/elaborator/options.rs +++ b/compiler/noirc_frontend/src/elaborator/options.rs @@ -41,6 +41,9 @@ pub struct GenericOptions<'a, T> { /// Unstable compiler features that were explicitly enabled. Any unstable features /// that are not in this list result in an error when used. pub enabled_unstable_features: &'a [UnstableFeature], + + /// Deny crates from requiring unstable features. + pub disable_required_unstable_features: bool, } /// Options from nargo_cli that need to be passed down to the elaborator @@ -57,6 +60,7 @@ impl GenericOptions<'_, T> { debug_comptime_in_file: None, pedantic_solving: true, enabled_unstable_features: &[UnstableFeature::Enums], + disable_required_unstable_features: true, } } } 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 db124a2946f..429d95734f4 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs @@ -497,6 +497,7 @@ impl DefCollector { debug_comptime_in_file, pedantic_solving: options.pedantic_solving, enabled_unstable_features: options.enabled_unstable_features, + disable_required_unstable_features: options.disable_required_unstable_features, }; let mut more_errors = diff --git a/tooling/nargo/src/lib.rs b/tooling/nargo/src/lib.rs index 357b85e22db..078de320a6c 100644 --- a/tooling/nargo/src/lib.rs +++ b/tooling/nargo/src/lib.rs @@ -294,7 +294,7 @@ pub fn prepare_package<'file_manager, 'parsed_files>( (context, crate_id) } -/// Add any unstable features requires by the `Package` to the `Context`. +/// Add any unstable features required by the `Package` to the `Context`. fn add_unstable_features(context: &mut Context, crate_id: CrateId, package: &Package) { context .required_unstable_features From 75d55349ecab67357b4e1a52ae9be59e1442fdfc Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 13:53:35 +0100 Subject: [PATCH 08/11] Update compiler/noirc_frontend/src/elaborator/options.rs --- compiler/noirc_frontend/src/elaborator/options.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/noirc_frontend/src/elaborator/options.rs b/compiler/noirc_frontend/src/elaborator/options.rs index daa1bcc5158..3d33919d32d 100644 --- a/compiler/noirc_frontend/src/elaborator/options.rs +++ b/compiler/noirc_frontend/src/elaborator/options.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum UnstableFeature { Enums, Ownership, From 1a637a6dc2a016c76e5d1475c6bd9d9628ffa61b Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 13:57:49 +0100 Subject: [PATCH 09/11] Add --no-unstable-features to the docs --- .../version-v1.0.0-beta.5/reference/nargo_commands.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/versioned_docs/version-v1.0.0-beta.5/reference/nargo_commands.md b/docs/versioned_docs/version-v1.0.0-beta.5/reference/nargo_commands.md index 3e8d29ee9f4..bde4d5825a6 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.5/reference/nargo_commands.md +++ b/docs/versioned_docs/version-v1.0.0-beta.5/reference/nargo_commands.md @@ -680,6 +680,13 @@ Run the fuzzing harnesses for this program Possible values: `true`, `false` * `-Z`, `--unstable-features ` — Unstable features to enable for this current build + +* `--no-unstable-features` — Disable unstable features required by crates in their manifests + + Default value: `false` + + Possible values: `true`, `false` + * `--oracle-resolver ` — JSON RPC url to solve oracle calls * `--timeout ` — Maximum time in seconds to spend fuzzing (default: no timeout) @@ -690,6 +697,7 @@ Run the fuzzing harnesses for this program + ## `nargo info` Provides detailed information on each of a program's function (represented by a single circuit) @@ -855,4 +863,3 @@ Generates a shell completion script for your favorite shell This document was generated automatically by clap-markdown. - From 70f9ac7e75334b91a9142e7bddc32ca82efe51be Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 14:00:47 +0100 Subject: [PATCH 10/11] Add back the name field --- tooling/nargo_toml/src/semver.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tooling/nargo_toml/src/semver.rs b/tooling/nargo_toml/src/semver.rs index 4fc8f3ff60c..1dcfc131834 100644 --- a/tooling/nargo_toml/src/semver.rs +++ b/tooling/nargo_toml/src/semver.rs @@ -147,10 +147,16 @@ mod tests { expression_width: None, }; - let valid_dependency = - Package { compiler_required_version: Some("0.1.0".to_string()), ..package.clone() }; - let invalid_dependency = - Package { compiler_required_version: Some("0.2.0".to_string()), ..package.clone() }; + let valid_dependency = Package { + compiler_required_version: Some("0.1.0".to_string()), + name: CrateName::from_str("good_dependency").unwrap(), + ..package.clone() + }; + let invalid_dependency = Package { + compiler_required_version: Some("0.2.0".to_string()), + name: CrateName::from_str("bad_dependency").unwrap(), + ..package.clone() + }; package.dependencies.insert( CrateName::from_str("test_dep_valid").unwrap(), From 2ddd0808dd228efe28cef1399a426ca1511e7434 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Wed, 16 Jul 2025 14:32:44 +0100 Subject: [PATCH 11/11] Increase loop freq in brillig --- tooling/ast_fuzzer/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tooling/ast_fuzzer/src/lib.rs b/tooling/ast_fuzzer/src/lib.rs index 05705b93284..5f56cf32391 100644 --- a/tooling/ast_fuzzer/src/lib.rs +++ b/tooling/ast_fuzzer/src/lib.rs @@ -107,9 +107,9 @@ impl Default for Config { ("assign", 30), ("if", 10), ("match", 15), - ("for", 17), - ("loop", 17), - ("while", 17), + ("for", 22), + ("loop", 22), + ("while", 22), ("let", 20), ("call", 5), ("print", 15),