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
7 changes: 0 additions & 7 deletions compiler/noirc_frontend/src/elaborator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ pub struct Elaborator<'context> {

file: FileId,

in_unconstrained_fn: bool,
nested_loops: usize,

/// Contains a mapping of the current struct or functions's generics to
Expand Down Expand Up @@ -173,7 +172,6 @@ impl<'context> Elaborator<'context> {
interner: &mut context.def_interner,
def_maps: &mut context.def_maps,
file: FileId::dummy(),
in_unconstrained_fn: false,
nested_loops: 0,
generics: Vec::new(),
lambda_stack: Vec::new(),
Expand Down Expand Up @@ -317,10 +315,6 @@ impl<'context> Elaborator<'context> {

self.trait_bounds = func_meta.trait_constraints.clone();

if self.interner.function_modifiers(&id).is_unconstrained {
self.in_unconstrained_fn = true;
}

// Introduce all numeric generics into scope
for generic in &func_meta.all_generics {
if let Kind::Numeric(typ) = &generic.kind {
Expand Down Expand Up @@ -412,7 +406,6 @@ impl<'context> Elaborator<'context> {

self.trait_bounds.clear();
self.type_variables.clear();
self.in_unconstrained_fn = false;
self.interner.update_fn(id, hir_func);
self.current_function = old_function;
self.current_item = old_item;
Expand Down
5 changes: 4 additions & 1 deletion compiler/noirc_frontend/src/elaborator/statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ impl<'context> Elaborator<'context> {
}

fn elaborate_jump(&mut self, is_break: bool, span: noirc_errors::Span) -> (HirStatement, Type) {
if !self.in_unconstrained_fn {
let in_constrained_function = self
.current_function
.map_or(true, |func_id| !self.interner.function_modifiers(&func_id).is_unconstrained);
if in_constrained_function {
self.push_err(ResolverError::JumpInConstrainedFn { is_break, span });
}
if self.nested_loops == 0 {
Expand Down