From e7b94c619029d268287f309f7e38cfee466dc22d Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Mon, 15 Jul 2024 11:01:23 -0500 Subject: [PATCH 1/5] Add comptime prefix to impls --- aztec_macros/src/transforms/note_interface.rs | 1 + aztec_macros/src/transforms/storage.rs | 1 + compiler/noirc_frontend/src/ast/structure.rs | 13 +- compiler/noirc_frontend/src/ast/traits.rs | 3 + compiler/noirc_frontend/src/elaborator/mod.rs | 152 ++++++++++-------- .../src/hir/comptime/interpreter.rs | 4 +- .../src/hir/def_collector/dc_crate.rs | 3 +- .../src/hir/def_collector/dc_mod.rs | 1 + .../noirc_frontend/src/hir/def_map/mod.rs | 2 +- compiler/noirc_frontend/src/parser/mod.rs | 18 +++ compiler/noirc_frontend/src/parser/parser.rs | 30 ++-- .../src/parser/parser/structs.rs | 8 +- .../src/parser/parser/traits.rs | 11 +- compiler/noirc_frontend/src/tests.rs | 2 +- .../comptime_trait_constraint/src/main.nr | 11 +- 15 files changed, 146 insertions(+), 114 deletions(-) diff --git a/aztec_macros/src/transforms/note_interface.rs b/aztec_macros/src/transforms/note_interface.rs index 49525fc2ae1..1a25950e6c8 100644 --- a/aztec_macros/src/transforms/note_interface.rs +++ b/aztec_macros/src/transforms/note_interface.rs @@ -73,6 +73,7 @@ pub fn generate_note_interface_impl(module: &mut SortedModule) -> Result<(), Azt generics: vec![], methods: vec![], where_clause: vec![], + is_comptime: false, }; module.impls.push(default_impl.clone()); module.impls.last_mut().unwrap() diff --git a/aztec_macros/src/transforms/storage.rs b/aztec_macros/src/transforms/storage.rs index c302dd87aa5..1c6ef634070 100644 --- a/aztec_macros/src/transforms/storage.rs +++ b/aztec_macros/src/transforms/storage.rs @@ -248,6 +248,7 @@ pub fn generate_storage_implementation( methods: vec![(init, Span::default())], where_clause: vec![], + is_comptime: false, }; module.impls.push(storage_impl); diff --git a/compiler/noirc_frontend/src/ast/structure.rs b/compiler/noirc_frontend/src/ast/structure.rs index bb2d89841b9..112747e09fb 100644 --- a/compiler/noirc_frontend/src/ast/structure.rs +++ b/compiler/noirc_frontend/src/ast/structure.rs @@ -14,18 +14,7 @@ pub struct NoirStruct { pub generics: UnresolvedGenerics, pub fields: Vec<(Ident, UnresolvedType)>, pub span: Span, -} - -impl NoirStruct { - pub fn new( - name: Ident, - attributes: Vec, - generics: UnresolvedGenerics, - fields: Vec<(Ident, UnresolvedType)>, - span: Span, - ) -> NoirStruct { - NoirStruct { name, attributes, generics, fields, span } - } + pub is_comptime: bool, } impl Display for NoirStruct { diff --git a/compiler/noirc_frontend/src/ast/traits.rs b/compiler/noirc_frontend/src/ast/traits.rs index f8f8ef667b4..b23fbaede61 100644 --- a/compiler/noirc_frontend/src/ast/traits.rs +++ b/compiler/noirc_frontend/src/ast/traits.rs @@ -53,6 +53,7 @@ pub struct TypeImpl { pub generics: UnresolvedGenerics, pub where_clause: Vec, pub methods: Vec<(NoirFunction, Span)>, + pub is_comptime: bool, } /// Ast node for an implementation of a trait for a particular type @@ -69,6 +70,8 @@ pub struct NoirTraitImpl { pub where_clause: Vec, pub items: Vec, + + pub is_comptime: bool, } /// Represents a simple trait constraint such as `where Foo: TraitY` diff --git a/compiler/noirc_frontend/src/elaborator/mod.rs b/compiler/noirc_frontend/src/elaborator/mod.rs index b0fd8f79557..6267590991e 100644 --- a/compiler/noirc_frontend/src/elaborator/mod.rs +++ b/compiler/noirc_frontend/src/elaborator/mod.rs @@ -1627,17 +1627,25 @@ impl<'context> Elaborator<'context> { function_sets.push(UnresolvedFunctions { functions, file_id, trait_id, self_type }); } + let (comptime_trait_impls, trait_impls) = + items.trait_impls.into_iter().partition(|trait_impl| trait_impl.is_comptime); + + let (comptime_structs, structs) = + items.types.into_iter().partition(|typ| typ.1.struct_def.is_comptime); + let comptime = CollectedItems { functions: comptime_function_sets, - types: BTreeMap::new(), + types: comptime_structs, type_aliases: BTreeMap::new(), traits: BTreeMap::new(), - trait_impls: Vec::new(), + trait_impls: comptime_trait_impls, globals: Vec::new(), impls: rustc_hash::FxHashMap::default(), }; items.functions = function_sets; + items.trait_impls = trait_impls; + items.types = structs; (comptime, items) } @@ -1648,75 +1656,85 @@ impl<'context> Elaborator<'context> { location: Location, ) { for item in items { - match item { - TopLevelStatement::Function(function) => { - let id = self.interner.push_empty_fn(); - let module = self.module_id(); - self.interner.push_function(id, &function.def, module, location); - let functions = vec![(self.local_module, id, function)]; - generated_items.functions.push(UnresolvedFunctions { - file_id: self.file, - functions, - trait_id: None, - self_type: None, - }); - } - TopLevelStatement::TraitImpl(mut trait_impl) => { - let methods = dc_mod::collect_trait_impl_functions( - self.interner, - &mut trait_impl, - self.crate_id, - self.file, - self.local_module, - ); + self.add_item(item, generated_items, location); + } + } - generated_items.trait_impls.push(UnresolvedTraitImpl { - file_id: self.file, - module_id: self.local_module, - trait_generics: trait_impl.trait_generics, - trait_path: trait_impl.trait_name, - object_type: trait_impl.object_type, - methods, - generics: trait_impl.impl_generics, - where_clause: trait_impl.where_clause, - - // These last fields are filled in later - trait_id: None, - impl_id: None, - resolved_object_type: None, - resolved_generics: Vec::new(), - resolved_trait_generics: Vec::new(), - }); - } - TopLevelStatement::Global(global) => { - let (global, error) = dc_mod::collect_global( - self.interner, - self.def_maps.get_mut(&self.crate_id).unwrap(), - global, - self.file, - self.local_module, - ); + fn add_item( + &mut self, + item: TopLevelStatement, + generated_items: &mut CollectedItems, + location: Location, + ) { + match item { + TopLevelStatement::Function(function) => { + let id = self.interner.push_empty_fn(); + let module = self.module_id(); + self.interner.push_function(id, &function.def, module, location); + let functions = vec![(self.local_module, id, function)]; + generated_items.functions.push(UnresolvedFunctions { + file_id: self.file, + functions, + trait_id: None, + self_type: None, + }); + } + TopLevelStatement::TraitImpl(mut trait_impl) => { + let methods = dc_mod::collect_trait_impl_functions( + self.interner, + &mut trait_impl, + self.crate_id, + self.file, + self.local_module, + ); - generated_items.globals.push(global); - if let Some(error) = error { - self.errors.push(error); - } - } - // Assume that an error has already been issued - TopLevelStatement::Error => (), - - TopLevelStatement::Module(_) - | TopLevelStatement::Import(_) - | TopLevelStatement::Struct(_) - | TopLevelStatement::Trait(_) - | TopLevelStatement::Impl(_) - | TopLevelStatement::TypeAlias(_) - | TopLevelStatement::SubModule(_) => { - let item = item.to_string(); - let error = InterpreterError::UnsupportedTopLevelItemUnquote { item, location }; - self.errors.push(error.into_compilation_error_pair()); + generated_items.trait_impls.push(UnresolvedTraitImpl { + file_id: self.file, + module_id: self.local_module, + trait_generics: trait_impl.trait_generics, + trait_path: trait_impl.trait_name, + object_type: trait_impl.object_type, + methods, + generics: trait_impl.impl_generics, + where_clause: trait_impl.where_clause, + is_comptime: trait_impl.is_comptime, + + // These last fields are filled in later + trait_id: None, + impl_id: None, + resolved_object_type: None, + resolved_generics: Vec::new(), + resolved_trait_generics: Vec::new(), + }); + } + TopLevelStatement::Global(global) => { + let (global, error) = dc_mod::collect_global( + self.interner, + self.def_maps.get_mut(&self.crate_id).unwrap(), + global, + self.file, + self.local_module, + ); + + generated_items.globals.push(global); + if let Some(error) = error { + self.errors.push(error); } } + // Assume that an error has already been issued + TopLevelStatement::Error => (), + + TopLevelStatement::Module(_) + | TopLevelStatement::Import(_) + | TopLevelStatement::Struct(_) + | TopLevelStatement::Trait(_) + | TopLevelStatement::Impl(_) + | TopLevelStatement::TypeAlias(_) + | TopLevelStatement::SubModule(_) => { + let item = item.to_string(); + let error = InterpreterError::UnsupportedTopLevelItemUnquote { item, location }; + self.errors.push(error.into_compilation_error_pair()); + } } } diff --git a/compiler/noirc_frontend/src/hir/comptime/interpreter.rs b/compiler/noirc_frontend/src/hir/comptime/interpreter.rs index 02714f77605..3a73c3eb09a 100644 --- a/compiler/noirc_frontend/src/hir/comptime/interpreter.rs +++ b/compiler/noirc_frontend/src/hir/comptime/interpreter.rs @@ -1300,7 +1300,9 @@ impl<'a> Interpreter<'a> { fn store_lvalue(&mut self, lvalue: HirLValue, rhs: Value) -> IResult<()> { match lvalue { - HirLValue::Ident(ident, typ) => self.mutate(ident.id, rhs, ident.location), + HirLValue::Ident(ident, typ) => { + self.mutate(ident.id, rhs, ident.location) + } HirLValue::Dereference { lvalue, element_type: _, location } => { match self.evaluate_lvalue(&lvalue)? { Value::Pointer(value) => { 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 f42819dab1f..d5af72b1ece 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs @@ -124,6 +124,7 @@ pub struct UnresolvedTraitImpl { pub methods: UnresolvedFunctions, pub generics: UnresolvedGenerics, pub where_clause: Vec, + pub is_comptime: bool, // Every field after this line is filled in later in the elaborator pub trait_id: Option, @@ -279,7 +280,7 @@ impl DefCollector { /// Collect all of the definitions in a given crate into a CrateDefMap /// Modules which are not a part of the module hierarchy starting with /// the root module, will be ignored. - pub fn collect( + pub fn collect_crate_and_dependencies( mut def_map: CrateDefMap, context: &mut Context, ast: SortedModule, diff --git a/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs b/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs index 1f30b4388b6..a9213a8c09a 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs @@ -185,6 +185,7 @@ impl<'a> ModCollector<'a> { generics: trait_impl.impl_generics, where_clause: trait_impl.where_clause, trait_generics: trait_impl.trait_generics, + is_comptime: trait_impl.is_comptime, // These last fields are filled later on trait_id: None, diff --git a/compiler/noirc_frontend/src/hir/def_map/mod.rs b/compiler/noirc_frontend/src/hir/def_map/mod.rs index 43d1548dc29..1b36a213b48 100644 --- a/compiler/noirc_frontend/src/hir/def_map/mod.rs +++ b/compiler/noirc_frontend/src/hir/def_map/mod.rs @@ -118,7 +118,7 @@ impl CrateDefMap { }; // Now we want to populate the CrateDefMap using the DefCollector - errors.extend(DefCollector::collect( + errors.extend(DefCollector::collect_crate_and_dependencies( def_map, context, ast, diff --git a/compiler/noirc_frontend/src/parser/mod.rs b/compiler/noirc_frontend/src/parser/mod.rs index 49ffd20b047..c62d66769ac 100644 --- a/compiler/noirc_frontend/src/parser/mod.rs +++ b/compiler/noirc_frontend/src/parser/mod.rs @@ -39,6 +39,24 @@ pub enum TopLevelStatement { Error, } +impl TopLevelStatement { + pub fn into_item_kind(self) -> Option { + match self { + TopLevelStatement::Function(f) => Some(ItemKind::Function(f)), + TopLevelStatement::Module(m) => Some(ItemKind::ModuleDecl(m)), + TopLevelStatement::Import(i) => Some(ItemKind::Import(i)), + TopLevelStatement::Struct(s) => Some(ItemKind::Struct(s)), + TopLevelStatement::Trait(t) => Some(ItemKind::Trait(t)), + TopLevelStatement::TraitImpl(t) => Some(ItemKind::TraitImpl(t)), + TopLevelStatement::Impl(i) => Some(ItemKind::Impl(i)), + TopLevelStatement::TypeAlias(t) => Some(ItemKind::TypeAlias(t)), + TopLevelStatement::SubModule(s) => Some(ItemKind::Submodules(s)), + TopLevelStatement::Global(c) => Some(ItemKind::Global(c)), + TopLevelStatement::Error => None, + } + } +} + // Helper trait that gives us simpler type signatures for return types: // e.g. impl Parser versus impl Parser> pub trait NoirParser: Parser + Sized + Clone {} diff --git a/compiler/noirc_frontend/src/parser/parser.rs b/compiler/noirc_frontend/src/parser/parser.rs index 20a9bec9005..7f3e0e68bbc 100644 --- a/compiler/noirc_frontend/src/parser/parser.rs +++ b/compiler/noirc_frontend/src/parser/parser.rs @@ -171,20 +171,8 @@ fn module() -> impl NoirParser { .to(ParsedModule::default()) .then(spanned(top_level_statement(module_parser)).repeated()) .foldl(|mut program, (statement, span)| { - let mut push_item = |kind| program.items.push(Item { kind, span }); - - match statement { - TopLevelStatement::Function(f) => push_item(ItemKind::Function(f)), - TopLevelStatement::Module(m) => push_item(ItemKind::ModuleDecl(m)), - TopLevelStatement::Import(i) => push_item(ItemKind::Import(i)), - TopLevelStatement::Struct(s) => push_item(ItemKind::Struct(s)), - TopLevelStatement::Trait(t) => push_item(ItemKind::Trait(t)), - TopLevelStatement::TraitImpl(t) => push_item(ItemKind::TraitImpl(t)), - TopLevelStatement::Impl(i) => push_item(ItemKind::Impl(i)), - TopLevelStatement::TypeAlias(t) => push_item(ItemKind::TypeAlias(t)), - TopLevelStatement::SubModule(s) => push_item(ItemKind::Submodules(s)), - TopLevelStatement::Global(c) => push_item(ItemKind::Global(c)), - TopLevelStatement::Error => (), + if let Some(kind) = statement.into_item_kind() { + program.items.push(Item { kind, span }); } program }) @@ -204,9 +192,9 @@ pub fn top_level_items() -> impl NoirParser> { /// | module_declaration /// | use_statement /// | global_declaration -fn top_level_statement( - module_parser: impl NoirParser, -) -> impl NoirParser { +fn top_level_statement<'a>( + module_parser: impl NoirParser + 'a, +) -> impl NoirParser + 'a { choice(( function::function_definition(false).map(TopLevelStatement::Function), structs::struct_definition(), @@ -227,8 +215,9 @@ fn top_level_statement( /// /// implementation: 'impl' generics type '{' function_definition ... '}' fn implementation() -> impl NoirParser { - keyword(Keyword::Impl) - .ignore_then(function::generics()) + maybe_comp_time() + .then_ignore(keyword(Keyword::Impl)) + .then(function::generics()) .then(parse_type().map_with_span(|typ, span| (typ, span))) .then(where_clause()) .then_ignore(just(Token::LeftBrace)) @@ -236,13 +225,14 @@ fn implementation() -> impl NoirParser { .then_ignore(just(Token::RightBrace)) .map(|args| { let ((other_args, where_clause), methods) = args; - let (generics, (object_type, type_span)) = other_args; + let ((is_comptime, generics), (object_type, type_span)) = other_args; TopLevelStatement::Impl(TypeImpl { generics, object_type, type_span, where_clause, methods, + is_comptime, }) }) } diff --git a/compiler/noirc_frontend/src/parser/parser/structs.rs b/compiler/noirc_frontend/src/parser/parser/structs.rs index 7da956bdfea..3055e9904df 100644 --- a/compiler/noirc_frontend/src/parser/parser/structs.rs +++ b/compiler/noirc_frontend/src/parser/parser/structs.rs @@ -1,6 +1,7 @@ use chumsky::prelude::*; use crate::ast::{Ident, NoirStruct, UnresolvedType}; +use crate::parser::parser::types::maybe_comp_time; use crate::{ parser::{ parser::{ @@ -28,13 +29,14 @@ pub(super) fn struct_definition() -> impl NoirParser { .or(just(Semicolon).to(Vec::new())); attributes() + .then(maybe_comp_time()) .then_ignore(keyword(Struct)) .then(ident()) .then(function::generics()) .then(fields) - .validate(|(((raw_attributes, name), generics), fields), span, emit| { - let attributes = validate_secondary_attributes(raw_attributes, span, emit); - TopLevelStatement::Struct(NoirStruct { name, attributes, generics, fields, span }) + .validate(|((((attributes, is_comptime), name), generics), fields), span, emit| { + let attributes = validate_secondary_attributes(attributes, span, emit); + TopLevelStatement::Struct(NoirStruct { name, attributes, generics, fields, span, is_comptime }) }) } diff --git a/compiler/noirc_frontend/src/parser/parser/traits.rs b/compiler/noirc_frontend/src/parser/parser/traits.rs index e64de584da4..4e4c9d5c0db 100644 --- a/compiler/noirc_frontend/src/parser/parser/traits.rs +++ b/compiler/noirc_frontend/src/parser/parser/traits.rs @@ -2,6 +2,7 @@ use chumsky::prelude::*; use super::attributes::{attributes, validate_secondary_attributes}; use super::function::function_return_type; +use super::types::maybe_comp_time; use super::{block, expression, fresh_statement, function, function_declaration_parameters}; use crate::ast::{ @@ -103,8 +104,9 @@ fn trait_type_declaration() -> impl NoirParser { /// /// trait_implementation: 'impl' generics ident generic_args for type '{' trait_implementation_body '}' pub(super) fn trait_implementation() -> impl NoirParser { - keyword(Keyword::Impl) - .ignore_then(function::generics()) + maybe_comp_time() + .then_ignore(keyword(Keyword::Impl)) + .then(function::generics()) .then(path()) .then(generic_type_args(parse_type())) .then_ignore(keyword(Keyword::For)) @@ -114,8 +116,8 @@ pub(super) fn trait_implementation() -> impl NoirParser { .then(trait_implementation_body()) .then_ignore(just(Token::RightBrace)) .map(|args| { - let ((other_args, where_clause), items) = args; - let (((impl_generics, trait_name), trait_generics), object_type) = other_args; + let (((other_args, object_type), where_clause), items) = args; + let (((is_comptime, impl_generics), trait_name), trait_generics) = other_args; TopLevelStatement::TraitImpl(NoirTraitImpl { impl_generics, @@ -124,6 +126,7 @@ pub(super) fn trait_implementation() -> impl NoirParser { object_type, items, where_clause, + is_comptime, }) }) } diff --git a/compiler/noirc_frontend/src/tests.rs b/compiler/noirc_frontend/src/tests.rs index 8cedeeeff0d..19b67f6ac86 100644 --- a/compiler/noirc_frontend/src/tests.rs +++ b/compiler/noirc_frontend/src/tests.rs @@ -80,7 +80,7 @@ pub(crate) fn get_program( }; // Now we want to populate the CrateDefMap using the DefCollector - errors.extend(DefCollector::collect( + errors.extend(DefCollector::collect_crate_and_dependencies( def_map, &mut context, program.clone().into_sorted(), diff --git a/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr b/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr index bee9e8f75fd..c493b9c6978 100644 --- a/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr +++ b/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr @@ -23,16 +23,19 @@ fn main() { } } -struct TestHasher { +comptime struct TestHasher { result: Field, } -impl Hasher for TestHasher { - fn finish(self) -> Field { +comptime impl Hasher for TestHasher { + comptime fn finish(self) -> Field { + println(self.result); self.result } - fn write(&mut self, input: Field) { + comptime fn write(&mut self, input: Field) { + println(self.result); self.result += input; + println(self.result); } } From dd757e44916f63fbd3024724bc1a7aff57aea6f3 Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Mon, 15 Jul 2024 11:19:23 -0500 Subject: [PATCH 2/5] Format --- compiler/noirc_frontend/src/hir/comptime/interpreter.rs | 4 +--- compiler/noirc_frontend/src/parser/parser/structs.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler/noirc_frontend/src/hir/comptime/interpreter.rs b/compiler/noirc_frontend/src/hir/comptime/interpreter.rs index 3a73c3eb09a..02714f77605 100644 --- a/compiler/noirc_frontend/src/hir/comptime/interpreter.rs +++ b/compiler/noirc_frontend/src/hir/comptime/interpreter.rs @@ -1300,9 +1300,7 @@ impl<'a> Interpreter<'a> { fn store_lvalue(&mut self, lvalue: HirLValue, rhs: Value) -> IResult<()> { match lvalue { - HirLValue::Ident(ident, typ) => { - self.mutate(ident.id, rhs, ident.location) - } + HirLValue::Ident(ident, typ) => self.mutate(ident.id, rhs, ident.location), HirLValue::Dereference { lvalue, element_type: _, location } => { match self.evaluate_lvalue(&lvalue)? { Value::Pointer(value) => { diff --git a/compiler/noirc_frontend/src/parser/parser/structs.rs b/compiler/noirc_frontend/src/parser/parser/structs.rs index 3055e9904df..9a3adf74d7f 100644 --- a/compiler/noirc_frontend/src/parser/parser/structs.rs +++ b/compiler/noirc_frontend/src/parser/parser/structs.rs @@ -36,7 +36,14 @@ pub(super) fn struct_definition() -> impl NoirParser { .then(fields) .validate(|((((attributes, is_comptime), name), generics), fields), span, emit| { let attributes = validate_secondary_attributes(attributes, span, emit); - TopLevelStatement::Struct(NoirStruct { name, attributes, generics, fields, span, is_comptime }) + TopLevelStatement::Struct(NoirStruct { + name, + attributes, + generics, + fields, + span, + is_comptime, + }) }) } From bc6b0d800bf7f04e717bde3a559db383b2adddb0 Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Mon, 15 Jul 2024 11:35:34 -0500 Subject: [PATCH 3/5] Format test --- .../comptime_trait_constraint/src/main.nr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr b/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr index c493b9c6978..6d3ba2bd60c 100644 --- a/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr +++ b/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr @@ -1,11 +1,12 @@ -use std::hash::{ Hash, Hasher }; +use std::hash::{Hash, Hasher}; trait TraitWithGenerics { fn foo(self) -> (A, B); } fn main() { - comptime { + comptime + { let constraint1 = quote { Default }.as_trait_constraint(); let constraint2 = quote { TraitWithGenerics }.as_trait_constraint(); From 97ece2adcc226164e7754c8435f2b8f1e8c1b28d Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Mon, 15 Jul 2024 12:30:23 -0500 Subject: [PATCH 4/5] Format stdlib --- noir_stdlib/src/meta/trait_constraint.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir_stdlib/src/meta/trait_constraint.nr b/noir_stdlib/src/meta/trait_constraint.nr index 002a3cf4e75..f0276608974 100644 --- a/noir_stdlib/src/meta/trait_constraint.nr +++ b/noir_stdlib/src/meta/trait_constraint.nr @@ -1,4 +1,4 @@ -use crate::hash::{ Hash, Hasher }; +use crate::hash::{Hash, Hasher}; use crate::cmp::Eq; impl Eq for TraitConstraint { From 585fa025bd0f7160fe9bfd1e7822022f38091e0f Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Mon, 15 Jul 2024 12:55:15 -0500 Subject: [PATCH 5/5] Remove println --- .../comptime_trait_constraint/src/main.nr | 3 --- 1 file changed, 3 deletions(-) diff --git a/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr b/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr index 6d3ba2bd60c..5c99f8c587e 100644 --- a/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr +++ b/test_programs/compile_success_empty/comptime_trait_constraint/src/main.nr @@ -30,13 +30,10 @@ comptime struct TestHasher { comptime impl Hasher for TestHasher { comptime fn finish(self) -> Field { - println(self.result); self.result } comptime fn write(&mut self, input: Field) { - println(self.result); self.result += input; - println(self.result); } }