Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,13 @@ impl Context {
let predicate_index =
self.acir_context.mul_var(index_var, self.current_side_effects_enabled_var)?;
let new_value = if let Some(store) = store_value {
let store_var = Some(self.convert_value(store, dfg).into_var()?);
let store_var = self.convert_value(store, dfg).into_var()?;
if self.acir_context.is_constant_one(&self.current_side_effects_enabled_var) {
store_var
Some(store_var)
} else {
let dummy = self.array_get(instruction, array, predicate_index, dfg)?;
let true_pred = self
.acir_context
.mul_var(store_var.unwrap(), self.current_side_effects_enabled_var)?;
let true_pred =
self.acir_context.mul_var(store_var, self.current_side_effects_enabled_var)?;
let one = self.acir_context.add_constant(FieldElement::one());
let not_pred =
self.acir_context.sub_var(one, self.current_side_effects_enabled_var)?;
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/ir/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<T> std::hash::Hash for Id<T> {

impl<T> PartialOrd for Id<T> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.index.partial_cmp(&other.index)
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/opt/constant_folding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl Context {
fn resolve_instruction(
instruction_id: InstructionId,
dfg: &DataFlowGraph,
constrained_values: &mut HashMap<ValueId, ValueId>,
constrained_values: &HashMap<ValueId, ValueId>,
) -> Instruction {
let instruction = dfg[instruction_id].clone();

Expand Down
4 changes: 1 addition & 3 deletions compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,7 @@ impl<'a> FunctionContext<'a> {
) -> Values {
match expr {
// If we're constraining an equality to be true then constrain the two sides directly.
Expression::Binary(Binary { lhs, operator, rhs, .. })
if operator == &BinaryOpKind::Equal =>
{
Expression::Binary(Binary { lhs, operator: BinaryOpKind::Equal, rhs, .. }) => {
let lhs = self.codegen_non_tuple_expression(lhs);
let rhs = self.codegen_non_tuple_expression(rhs);
self.builder.set_location(location).insert_constrain(lhs, rhs, assert_message);
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/ast/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl PartialEq<Ident> for Ident {

impl PartialOrd for Ident {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.0.contents.partial_cmp(&other.0.contents)
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,13 @@ fn take_errors_filter_self_not_resolved(resolver: Resolver<'_>) -> Vec<ResolverE
resolver
.take_errors()
.iter()
.cloned()
.filter(|resolution_error| match resolution_error {
ResolverError::PathResolutionError(PathResolutionError::Unresolved(ident)) => {
&ident.0.contents != "Self"
}
_ => true,
})
.cloned()
.collect()
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ impl<'a> ModCollector<'a> {
};

// Parse the AST for the module we just found and then recursively look for it's defs
let ast = parse_file(&mut context.file_manager, child_file_id, errors);
let ast = parse_file(&context.file_manager, child_file_id, errors);

// Add module into def collector and get a ModuleId
if let Some(child_mod_id) =
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/hir/def_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl CrateDefMap {

// First parse the root file.
let root_file_id = context.crate_graph[crate_id].root_file_id;
let ast = parse_file(&mut context.file_manager, root_file_id, errors);
let ast = parse_file(&context.file_manager, root_file_id, errors);

#[cfg(feature = "aztec")]
let ast = aztec_library::transform(ast, &crate_id, context, errors);
Expand Down Expand Up @@ -237,7 +237,7 @@ pub struct Contract {

/// Given a FileId, fetch the File, from the FileManager and parse it's content
pub fn parse_file(
fm: &mut FileManager,
fm: &FileManager,
file_id: FileId,
all_errors: &mut Vec<FileDiagnostic>,
) -> ParsedModule {
Expand Down
5 changes: 1 addition & 4 deletions compiler/noirc_frontend/src/hir/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ pub fn type_check_func(interner: &mut NodeInterner, func_id: FuncId) -> Vec<Type
errors
}

fn function_info(
interner: &mut NodeInterner,
function_body_id: &ExprId,
) -> (noirc_errors::Span, bool) {
fn function_info(interner: &NodeInterner, function_body_id: &ExprId) -> (noirc_errors::Span, bool) {
let (expr_span, empty_function) =
if let HirExpression::Block(block) = interner.expression(function_body_id) {
let last_stmt = block.statements().last();
Expand Down