diff --git a/ast/src/ast.rs b/ast/src/ast.rs index f1fde50a9e..8506abf29d 100644 --- a/ast/src/ast.rs +++ b/ast/src/ast.rs @@ -159,7 +159,8 @@ impl<'ast> FromPest<'ast> for Expression<'ast> { type Rule = Rule; fn from_pest(pest: &mut Pairs<'ast, Rule>) -> Result> { - let pair = pest.peek().ok_or(::from_pest::ConversionError::NoMatch)?; + let mut clone = pest.clone(); + let pair = clone.next().ok_or(::from_pest::ConversionError::NoMatch)?; match pair.as_rule() { Rule::expression => { // Transfer iterated state to pest. diff --git a/compiler/src/expression/array/access.rs b/compiler/src/expression/array/access.rs index a192477390..f1a388d3c2 100644 --- a/compiler/src/expression/array/access.rs +++ b/compiler/src/expression/array/access.rs @@ -42,7 +42,7 @@ impl> ConstrainedProgram { function_scope.clone(), expected_type, array, - span.clone(), + span, )? { ConstrainedValue::Array(array) => array, value => return Err(ExpressionError::undefined_array(value.to_string(), span.to_owned())), diff --git a/compiler/src/expression/expression.rs b/compiler/src/expression/expression.rs index 1209b6715a..5298c3eb50 100644 --- a/compiler/src/expression/expression.rs +++ b/compiler/src/expression/expression.rs @@ -75,7 +75,7 @@ impl> ConstrainedProgram { expected_type, left_right.0, left_right.1, - span.clone(), + &span, )?; enforce_add(cs, resolved_left, resolved_right, &span) @@ -88,7 +88,7 @@ impl> ConstrainedProgram { expected_type, left_right.0, left_right.1, - span.clone(), + &span, )?; enforce_sub(cs, resolved_left, resolved_right, &span) @@ -101,7 +101,7 @@ impl> ConstrainedProgram { expected_type, left_right.0, left_right.1, - span.clone(), + &span, )?; enforce_mul(cs, resolved_left, resolved_right, &span) @@ -114,7 +114,7 @@ impl> ConstrainedProgram { expected_type, left_right.0, left_right.1, - span.clone(), + &span, )?; enforce_div(cs, resolved_left, resolved_right, &span) @@ -127,7 +127,7 @@ impl> ConstrainedProgram { expected_type, left_right.0, left_right.1, - span.clone(), + &span, )?; enforce_pow(cs, resolved_left, resolved_right, &span) @@ -146,7 +146,7 @@ impl> ConstrainedProgram { expected_type, left_right.0, left_right.1, - span.clone(), + &span, )?; Ok(enforce_or(cs, resolved_left, resolved_right, &span)?) @@ -159,7 +159,7 @@ impl> ConstrainedProgram { expected_type, left_right.0, left_right.1, - span.clone(), + &span, )?; Ok(enforce_and(cs, resolved_left, resolved_right, &span)?) @@ -172,7 +172,7 @@ impl> ConstrainedProgram { None, left_right.0, left_right.1, - span.clone(), + &span, )?; Ok(evaluate_eq(cs, resolved_left, resolved_right, &span)?) @@ -185,7 +185,7 @@ impl> ConstrainedProgram { None, left_right.0, left_right.1, - span.clone(), + &span, )?; Ok(evaluate_ge(cs, resolved_left, resolved_right, &span)?) @@ -198,7 +198,7 @@ impl> ConstrainedProgram { None, left_right.0, left_right.1, - span.clone(), + &span, )?; Ok(evaluate_gt(cs, resolved_left, resolved_right, &span)?) @@ -211,7 +211,7 @@ impl> ConstrainedProgram { None, left_right.0, left_right.1, - span.clone(), + &span, )?; Ok(evaluate_le(cs, resolved_left, resolved_right, &span)?) @@ -224,7 +224,7 @@ impl> ConstrainedProgram { None, left_right.0, left_right.1, - span.clone(), + &span, )?; Ok(evaluate_lt(cs, resolved_left, resolved_right, &span)?) @@ -239,7 +239,7 @@ impl> ConstrainedProgram { triplet.0, triplet.1, triplet.2, - span, + &span, ), // Arrays @@ -253,7 +253,7 @@ impl> ConstrainedProgram { expected_type, array_w_index.0, array_w_index.1, - span, + &span, ), // Tuples diff --git a/compiler/src/statement/assign/assign.rs b/compiler/src/statement/assign/assign.rs index f79f149ef5..0536775975 100644 --- a/compiler/src/statement/assign/assign.rs +++ b/compiler/src/statement/assign/assign.rs @@ -77,7 +77,7 @@ impl> ConstrainedProgram { file_scope, function_scope, indicator, - variable_name, + &variable_name, assignee_w_range_or_expression.1, new_value, span, diff --git a/compiler/src/statement/assign/assignee.rs b/compiler/src/statement/assign/assignee.rs index 895aa74191..13ba48f445 100644 --- a/compiler/src/statement/assign/assignee.rs +++ b/compiler/src/statement/assign/assignee.rs @@ -23,7 +23,7 @@ use snarkos_models::curves::{Field, PrimeField}; pub fn resolve_assignee(scope: &str, assignee: Assignee) -> String { match assignee { - Assignee::Identifier(name) => new_scope(scope, name.to_string()), + Assignee::Identifier(name) => new_scope(scope, &name.to_string()), Assignee::Array(array_w_index) => resolve_assignee(scope, array_w_index.0), Assignee::Tuple(tuple, _index) => resolve_assignee(scope, *tuple), Assignee::CircuitField(circuit_name, _member) => resolve_assignee(scope, *circuit_name),