diff --git a/docs/docs/noir/standard_library/fmtstr.md b/docs/docs/noir/standard_library/fmtstr.md index 293793e23ff..394c824e516 100644 --- a/docs/docs/noir/standard_library/fmtstr.md +++ b/docs/docs/noir/standard_library/fmtstr.md @@ -10,4 +10,14 @@ title: fmtstr #include_code quoted_contents noir_stdlib/src/meta/format_string.nr rust -Returns the format string contents (that is, without the leading and trailing double quotes) as a `Quoted` value. \ No newline at end of file +Returns the format string contents (that is, without the leading and trailing double quotes) as a `Quoted` value. + +### as_quoted_str + +#include_code as_quoted_str noir_stdlib/src/meta/format_string.nr rust + +Returns the format string contents (with the leading and trailing double quotes) as a `Quoted` string literal (not a format string literal). + +Example: + +#include_code as_quoted_str_test test_programs/compile_success_empty/comptime_fmt_strings/src/main.nr rust diff --git a/noir_stdlib/src/meta/format_string.nr b/noir_stdlib/src/meta/format_string.nr index 5e639dc278e..b6c681f26aa 100644 --- a/noir_stdlib/src/meta/format_string.nr +++ b/noir_stdlib/src/meta/format_string.nr @@ -1,6 +1,16 @@ +use super::ctstring::AsCtString; + impl fmtstr { + /// Returns the format string contents (that is, without the leading and trailing double quotes) as a `Quoted` value. #[builtin(fmtstr_quoted_contents)] // docs:start:quoted_contents pub comptime fn quoted_contents(self) -> Quoted {} // docs:end:quoted_contents + + /// Returns the format string contents (with the leading and trailing double quotes) as a `Quoted` string literal (not a format string literal). + // docs:start:as_quoted_str + pub comptime fn as_quoted_str(self) -> Quoted { + // docs:end:as_quoted_str + self.as_ctstring().as_quoted_str() + } } diff --git a/test_programs/compile_success_empty/comptime_fmt_strings/src/main.nr b/test_programs/compile_success_empty/comptime_fmt_strings/src/main.nr index e82c0b52ed2..a409e58e320 100644 --- a/test_programs/compile_success_empty/comptime_fmt_strings/src/main.nr +++ b/test_programs/compile_success_empty/comptime_fmt_strings/src/main.nr @@ -15,6 +15,14 @@ fn main() { // Mainly test fmtstr::quoted_contents call!(glue(quote { hello }, quote { world })); + + // docs:start:as_quoted_str_test + comptime { + let x = 1; + let f: str<_> = f"x = {x}".as_quoted_str!(); + assert_eq(f, "x = 0x01"); + } + // docs:end:as_quoted_str_test } comptime fn glue(x: Quoted, y: Quoted) -> Quoted { diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/arithmetic_generics/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/arithmetic_generics/execute__tests__expanded.snap index d01c2a5b091..646872a18c2 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/arithmetic_generics/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/arithmetic_generics/execute__tests__expanded.snap @@ -24,8 +24,8 @@ fn split_first(array: [T; N]) -> (T, [T; N - 1]) { fn push(array: [Field; N], element: Field) -> [Field; N + 1] { let mut result: [Field; N + 1] = std::mem::zeroed(); { - let i_3806: u32 = array.len(); - result[i_3806] = element; + let i_3809: u32 = array.len(); + result[i_3809] = element; }; for i in 0_u32..array.len() { result[i] = array[i]; diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/assign_mutation_in_lvalue/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/assign_mutation_in_lvalue/execute__tests__expanded.snap index 186d8201c54..cf6ecee2e85 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/assign_mutation_in_lvalue/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/assign_mutation_in_lvalue/execute__tests__expanded.snap @@ -10,11 +10,11 @@ fn main() { fn bug() { let mut a: ([Field; 2], Field) = ([1_Field, 2_Field], 3_Field); { - let i_3775: u32 = { + let i_3778: u32 = { a = ([4_Field, 5_Field], 6_Field); 1_u32 }; - a.0[i_3775] = 7_Field; + a.0[i_3778] = 7_Field; }; assert(a == ([4_Field, 7_Field], 6_Field)); } diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/comptime_fmt_strings/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/comptime_fmt_strings/execute__tests__expanded.snap index 20efd61fa79..bb0ff1f4611 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/comptime_fmt_strings/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/comptime_fmt_strings/execute__tests__expanded.snap @@ -7,6 +7,7 @@ fn main() { assert(s1 == "x is 4, fake interpolation: {y}, y is 5"); assert(s2 == "\0\0\0\0"); { hello_world() }; + () } comptime fn glue(x: Quoted, y: Quoted) -> Quoted { diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/numeric_generics/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/numeric_generics/execute__tests__expanded.snap index 5ecef2e731d..292caa971bf 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/numeric_generics/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/numeric_generics/execute__tests__expanded.snap @@ -27,8 +27,8 @@ impl MyStruct { fn insert(mut self, index: Field, elem: Field) -> Self { assert((index as u64) < (S as u64)); { - let i_3789: u32 = index as u32; - self.data[i_3789] = elem; + let i_3792: u32 = index as u32; + self.data[i_3792] = elem; }; self } diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/numeric_generics_explicit/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/numeric_generics_explicit/execute__tests__expanded.snap index 147a1ff0fb4..dc6ee92dcca 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/numeric_generics_explicit/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/numeric_generics_explicit/execute__tests__expanded.snap @@ -36,8 +36,8 @@ impl MyStruct { fn insert(mut self, index: Field, elem: Field) -> Self { assert((index as u32) < S); { - let i_3807: u32 = index as u32; - self.data[i_3807] = elem; + let i_3810: u32 = index as u32; + self.data[i_3810] = elem; }; self } diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/regression_bignum/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/regression_bignum/execute__tests__expanded.snap index 477104a2f9c..06fee173067 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/regression_bignum/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/regression_bignum/execute__tests__expanded.snap @@ -53,8 +53,8 @@ unconstrained fn shl(shift: u32) -> [u64; 6] { result[num_shifted_limbs] = 1_u64 << limb_shift; for i in 1_u32..6_u32 - num_shifted_limbs { { - let i_3796: u32 = i + num_shifted_limbs; - result[i_3796] = 0_u64; + let i_3799: u32 = i + num_shifted_limbs; + result[i_3799] = 0_u64; } } result diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/serialize_1/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/serialize_1/execute__tests__expanded.snap index 476ae4e6705..d4e5349aa6b 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/serialize_1/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/serialize_1/execute__tests__expanded.snap @@ -25,8 +25,8 @@ where } for i in 0_u32..b.len() { { - let i_3798: u32 = i + a.len(); - array[i_3798] = b[i]; + let i_3801: u32 = i + a.len(); + array[i_3801] = b[i]; } } array diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_empty/serialize_4/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/compile_success_empty/serialize_4/execute__tests__expanded.snap index c96f5bcdbc2..7dabd0a0450 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_empty/serialize_4/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_empty/serialize_4/execute__tests__expanded.snap @@ -25,8 +25,8 @@ where } for i in 0_u32..b.len() { { - let i_3798: u32 = i + a.len(); - array[i_3798] = b[i]; + let i_3801: u32 = i + a.len(); + array[i_3801] = b[i]; } } array diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/aes128_encrypt/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/aes128_encrypt/execute__tests__expanded.snap index 9269901c5b7..502d6371692 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/aes128_encrypt/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/aes128_encrypt/execute__tests__expanded.snap @@ -18,8 +18,8 @@ unconstrained fn decode_hex(s: str) -> [u8; M] { for i in 0_u32..N { if (i % 2_u32) != 0_u32 { continue; }; { - let i_3790: u32 = i / 2_u32; - result[i_3790] = + let i_3793: u32 = i / 2_u32; + result[i_3793] = (decode_ascii(as_bytes[i]) * 16_u8) + decode_ascii(as_bytes[i + 1_u32]); } } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/array_dedup_regression/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/array_dedup_regression/execute__tests__expanded.snap index 72d3a5f1b94..ed044c2c9f8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/array_dedup_regression/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/array_dedup_regression/execute__tests__expanded.snap @@ -7,8 +7,8 @@ unconstrained fn main(x: u32) { for i in 0_u32..5_u32 { let mut a2: [Field; 5] = [1_Field, 2_Field, 3_Field, 4_Field, 5_Field]; { - let i_3777: u32 = x + i; - a2[i_3777] = 128_Field; + let i_3780: u32 = x + i; + a2[i_3780] = 128_Field; }; println(a2); if i != 0_u32 { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/array_dynamic_blackbox_input/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/array_dynamic_blackbox_input/execute__tests__expanded.snap index 8d7b1453e17..d3b629cb4fb 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/array_dynamic_blackbox_input/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/array_dynamic_blackbox_input/execute__tests__expanded.snap @@ -17,12 +17,12 @@ fn compute_root(leaf: [u8; 32], path: [u8; 64], _index: u32, root: [u8; 32]) { let b: u32 = if is_right { 0_u32 } else { 32_u32 }; for j in 0_u32..32_u32 { { - let i_3791: u32 = j + a; - hash_input[i_3791] = current[j]; + let i_3794: u32 = j + a; + hash_input[i_3794] = current[j]; }; { - let i_3792: u32 = j + b; - hash_input[i_3792] = path[offset + j]; + let i_3795: u32 = j + b; + hash_input[i_3795] = path[offset + j]; } } current = std::hash::blake3(hash_input); diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/array_dynamic_nested_blackbox_input/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/array_dynamic_nested_blackbox_input/execute__tests__expanded.snap index a7938de491d..46d27e8fb90 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/array_dynamic_nested_blackbox_input/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/array_dynamic_nested_blackbox_input/execute__tests__expanded.snap @@ -14,13 +14,13 @@ struct Foo { fn main(mut x: [Foo; 3], y: pub u32, hash_result: pub [u8; 32]) { { - let i_3776: u32 = y - 1_u32; - x[i_3776].bar.inner = [106_u8, 107_u8, 10_u8]; + let i_3779: u32 = y - 1_u32; + x[i_3779].bar.inner = [106_u8, 107_u8, 10_u8]; }; let mut hash_input: [u8; 3] = x[y - 1_u32].bar.inner; { - let i_3778: u32 = y - 1_u32; - hash_input[i_3778] = 0_u8; + let i_3781: u32 = y - 1_u32; + hash_input[i_3781] = 0_u8; }; let hash: [u8; 32] = std::hash::blake3(hash_input); assert(hash == hash_result); diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_cow/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_cow/execute__tests__expanded.snap index a96a2d4580c..0d9623cdac3 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_cow/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_cow/execute__tests__expanded.snap @@ -22,8 +22,8 @@ fn modify_in_inlined_constrained(original: [Field; 5], index: u32) -> ExecutionR modified[index] = 27_Field; let modified_once: [Field; 5] = modified; { - let i_3788: u32 = index + 1_u32; - modified[i_3788] = 27_Field; + let i_3791: u32 = index + 1_u32; + modified[i_3791] = 27_Field; }; ExecutionResult { original: original, modified_once: modified_once, modified_twice: modified } } @@ -33,8 +33,8 @@ unconstrained fn modify_in_unconstrained(original: [Field; 5], index: u32) -> Ex modified[index] = 27_Field; let modified_once: [Field; 5] = modified; { - let i_3791: u32 = index + 1_u32; - modified[i_3791] = 27_Field; + let i_3794: u32 = index + 1_u32; + modified[i_3794] = 27_Field; }; ExecutionResult { original: original, modified_once: modified_once, modified_twice: modified } } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_cow_regression/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_cow_regression/execute__tests__expanded.snap index 5daeea28ff4..faa3b6658a6 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/brillig_cow_regression/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/brillig_cow_regression/execute__tests__expanded.snap @@ -149,33 +149,33 @@ unconstrained fn main(kernel_data: DataToHash) -> pub [Field; 2] { let mut offset: u32 = 0_u32; for j in 0_u32..MAX_NOTE_HASHES_PER_TX { { - let i_3800: u32 = offset + j; - tx_effects_hash_inputs[i_3800] = new_note_hashes[j]; + let i_3803: u32 = offset + j; + tx_effects_hash_inputs[i_3803] = new_note_hashes[j]; } } offset = offset + MAX_NOTE_HASHES_PER_TX; for j in 0_u32..MAX_NULLIFIERS_PER_TX { { - let i_3802: u32 = offset + j; - tx_effects_hash_inputs[i_3802] = new_nullifiers[j]; + let i_3805: u32 = offset + j; + tx_effects_hash_inputs[i_3805] = new_nullifiers[j]; } } offset = offset + MAX_NULLIFIERS_PER_TX; for j in 0_u32..MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX { { - let i_3804: u32 = offset + (j * 2_u32); - tx_effects_hash_inputs[i_3804] = public_data_update_requests[j].leaf_slot; + let i_3807: u32 = offset + (j * 2_u32); + tx_effects_hash_inputs[i_3807] = public_data_update_requests[j].leaf_slot; }; { - let i_3805: u32 = (offset + (j * 2_u32)) + 1_u32; - tx_effects_hash_inputs[i_3805] = public_data_update_requests[j].new_value; + let i_3808: u32 = (offset + (j * 2_u32)) + 1_u32; + tx_effects_hash_inputs[i_3808] = public_data_update_requests[j].new_value; } } offset = offset + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * 2_u32); for j in 0_u32..MAX_L2_TO_L1_MSGS_PER_TX { { - let i_3807: u32 = offset + j; - tx_effects_hash_inputs[i_3807] = l2ToL1Msgs[j]; + let i_3810: u32 = offset + j; + tx_effects_hash_inputs[i_3810] = l2ToL1Msgs[j]; } } offset = offset + MAX_L2_TO_L1_MSGS_PER_TX; @@ -185,21 +185,21 @@ unconstrained fn main(kernel_data: DataToHash) -> pub [Field; 2] { let new_contracts: [NewContractData; 1] = kernel_data.new_contracts; tx_effects_hash_inputs[offset] = new_contracts[0_u32].contract_address; { - let i_3810: u32 = offset + 1_u32; - tx_effects_hash_inputs[i_3810] = new_contracts[0_u32].portal_contract_address; + let i_3813: u32 = offset + 1_u32; + tx_effects_hash_inputs[i_3813] = new_contracts[0_u32].portal_contract_address; }; offset = offset + (MAX_NEW_CONTRACTS_PER_TX * 2_u32); for j in 0_u32..NUM_FIELDS_PER_SHA256 { { - let i_3812: u32 = offset + j; - tx_effects_hash_inputs[i_3812] = encryptedLogsHash[j]; + let i_3815: u32 = offset + j; + tx_effects_hash_inputs[i_3815] = encryptedLogsHash[j]; } } offset = offset + (NUM_ENCRYPTED_LOGS_HASHES_PER_TX * NUM_FIELDS_PER_SHA256); for j in 0_u32..NUM_FIELDS_PER_SHA256 { { - let i_3814: u32 = offset + j; - tx_effects_hash_inputs[i_3814] = unencryptedLogsHash[j]; + let i_3817: u32 = offset + j; + tx_effects_hash_inputs[i_3817] = unencryptedLogsHash[j]; } } offset = offset + (NUM_UNENCRYPTED_LOGS_HASHES_PER_TX * NUM_FIELDS_PER_SHA256); @@ -209,8 +209,8 @@ unconstrained fn main(kernel_data: DataToHash) -> pub [Field; 2] { let input_as_bytes: [u8; 32] = tx_effects_hash_inputs[offset].to_be_bytes(); for byte_index in 0_u32..32_u32 { { - let i_3819: u32 = (offset * 32_u32) + byte_index; - hash_input_flattened[i_3819] = input_as_bytes[byte_index]; + let i_3822: u32 = (offset * 32_u32) + byte_index; + hash_input_flattened[i_3822] = input_as_bytes[byte_index]; } } } @@ -219,11 +219,11 @@ unconstrained fn main(kernel_data: DataToHash) -> pub [Field; 2] { tx_effects_hash_inputs[TX_EFFECT_HASH_FULL_FIELDS + log_field_index].to_be_bytes(); for byte_index in 0_u32..16_u32 { { - let i_3823: u32 = ( + let i_3826: u32 = ( (TX_EFFECT_HASH_FULL_FIELDS * 32_u32) + (log_field_index * 16_u32) ) + byte_index; - hash_input_flattened[i_3823] = input_as_bytes[byte_index]; + hash_input_flattened[i_3826] = input_as_bytes[byte_index]; } } } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/conditional_1/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/conditional_1/execute__tests__expanded.snap index 51fc07f270e..c1aac492159 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/conditional_1/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/conditional_1/execute__tests__expanded.snap @@ -27,8 +27,8 @@ fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]) { if i_u32 == a { for j in 0_u32..4_u32 { { - let i_3789: u32 = i + j; - data[i_3789] = c[(4_u32 - 1_u32) - j]; + let i_3792: u32 = i + j; + data[i_3792] = c[(4_u32 - 1_u32) - j]; }; for k in 0_u32..4_u32 { ba = ba + data[k]; diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/databus_two_calldata/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/databus_two_calldata/execute__tests__expanded.snap index b9af547e8da..5a9cc61c4ae 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/databus_two_calldata/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/databus_two_calldata/execute__tests__expanded.snap @@ -9,8 +9,8 @@ fn main(mut x: [u32; 4], y: [u32; 3], z: [u32; 4]) -> return_data [u32; 4] { result[idx] = y[idx] + z[idx]; } { - let i_3779: u32 = x[3_u32]; - result[i_3779] = z[x[3_u32]]; + let i_3782: u32 = x[3_u32]; + result[i_3782] = z[x[3_u32]]; }; result } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/encrypted_log_regression/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/encrypted_log_regression/execute__tests__expanded.snap index 552f33c75e5..c6d6ba0ddf4 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/encrypted_log_regression/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/encrypted_log_regression/execute__tests__expanded.snap @@ -39,15 +39,15 @@ fn compute_encrypted_log( if flag { for i in 0_u32..EPH_PK_SIZE { { - let i_3792: u32 = offset + i; - encrypted_bytes[i_3792] = eph_pk_bytes[i]; + let i_3795: u32 = offset + i; + encrypted_bytes[i_3795] = eph_pk_bytes[i]; } } offset = offset + EPH_PK_SIZE; for i in 0_u32..HEADER_SIZE { { - let i_3794: u32 = offset + i; - encrypted_bytes[i_3794] = incoming_header_ciphertext[i]; + let i_3797: u32 = offset + i; + encrypted_bytes[i_3797] = incoming_header_ciphertext[i]; } } offset = offset + HEADER_SIZE; @@ -56,8 +56,8 @@ fn compute_encrypted_log( assert(size == incoming_body_ciphertext.len(), "ciphertext length mismatch"); for i in 0_u32..size { { - let i_3797: u32 = offset + i; - encrypted_bytes[i_3797] = incoming_body_ciphertext[i]; + let i_3800: u32 = offset + i; + encrypted_bytes[i_3800] = incoming_body_ciphertext[i]; } } }; diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/nested_array_dynamic/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/nested_array_dynamic/execute__tests__expanded.snap index 4f0c24c5098..30ce9b6c60c 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/nested_array_dynamic/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/nested_array_dynamic/execute__tests__expanded.snap @@ -35,13 +35,13 @@ fn main(mut x: [Foo; 4], y: pub u32) { assert(x[3_u32].a == 50_Field); if y == 2_u32 { { - let i_3775: u32 = y - 1_u32; - x[i_3775].b = [50_Field, 51_Field, 52_Field]; + let i_3778: u32 = y - 1_u32; + x[i_3778].b = [50_Field, 51_Field, 52_Field]; } } else { { - let i_3776: u32 = y - 1_u32; - x[i_3776].b = [100_Field, 101_Field, 102_Field]; + let i_3779: u32 = y - 1_u32; + x[i_3779].b = [100_Field, 101_Field, 102_Field]; } }; assert(x[2_u32].b == [100_Field, 101_Field, 102_Field]); @@ -60,39 +60,39 @@ fn main(mut x: [Foo; 4], y: pub u32) { assert(foo_parents[1_u32].foos[1_u32].b == [5_Field, 6_Field, 21_Field]); if y == 2_u32 { { - let i_3780: u32 = y - 2_u32; - let i_3781: u32 = y - 2_u32; - foo_parents[i_3780].foos[i_3781].b = [10_Field, 9_Field, 8_Field]; + let i_3783: u32 = y - 2_u32; + let i_3784: u32 = y - 2_u32; + foo_parents[i_3783].foos[i_3784].b = [10_Field, 9_Field, 8_Field]; } } else { { - let i_3782: u32 = y - 2_u32; - let i_3783: u32 = y - 2_u32; - foo_parents[i_3782].foos[i_3783].b = [20_Field, 19_Field, 18_Field]; + let i_3785: u32 = y - 2_u32; + let i_3786: u32 = y - 2_u32; + foo_parents[i_3785].foos[i_3786].b = [20_Field, 19_Field, 18_Field]; } }; assert(foo_parents[1_u32].foos[1_u32].b == [20_Field, 19_Field, 18_Field]); assert(foo_parents[1_u32].foos[1_u32].b[2_u32] == 18_Field); if y == 3_u32 { - { - let i_3784: u32 = y - 2_u32; - let i_3785: u32 = y - 2_u32; - let i_3786: u32 = y - 1_u32; - foo_parents[i_3784].foos[i_3785].b[i_3786] = 5000_Field; - } - } else { { let i_3787: u32 = y - 2_u32; let i_3788: u32 = y - 2_u32; let i_3789: u32 = y - 1_u32; - foo_parents[i_3787].foos[i_3788].b[i_3789] = 1000_Field; + foo_parents[i_3787].foos[i_3788].b[i_3789] = 5000_Field; + } + } else { + { + let i_3790: u32 = y - 2_u32; + let i_3791: u32 = y - 2_u32; + let i_3792: u32 = y - 1_u32; + foo_parents[i_3790].foos[i_3791].b[i_3792] = 1000_Field; } }; assert(foo_parents[1_u32].foos[1_u32].b[2_u32] == 5000_Field); { - let i_3790: u32 = y - 2_u32; - let i_3791: u32 = y - 3_u32; - foo_parents[i_3790].foos[i_3791].b = foo_parents[y - 2_u32].foos[y - 2_u32].b; + let i_3793: u32 = y - 2_u32; + let i_3794: u32 = y - 3_u32; + foo_parents[i_3793].foos[i_3794].b = foo_parents[y - 2_u32].foos[y - 2_u32].b; }; assert(foo_parents[1_u32].foos[0_u32].b == [20_Field, 19_Field, 5000_Field]); } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/nested_array_in_slice/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/nested_array_in_slice/execute__tests__expanded.snap index 9b930783b6b..569057eeb48 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/nested_array_in_slice/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/nested_array_in_slice/execute__tests__expanded.snap @@ -48,25 +48,25 @@ fn main(y: u32) { assert(x[y].bar.inner == [109_Field, 110_Field, 111_Field]); if y != 2_u32 { { - let i_3779: u32 = y - 2_u32; - x[i_3779].a = 50_Field; + let i_3782: u32 = y - 2_u32; + x[i_3782].a = 50_Field; } } else { { - let i_3780: u32 = y - 2_u32; - x[i_3780].a = 100_Field; + let i_3783: u32 = y - 2_u32; + x[i_3783].a = 100_Field; } }; assert(x[y - 2_u32].a == 50_Field); if y == 2_u32 { { - let i_3781: u32 = y - 1_u32; - x[i_3781].b = [50_Field, 51_Field, 52_Field]; + let i_3784: u32 = y - 1_u32; + x[i_3784].b = [50_Field, 51_Field, 52_Field]; } } else { { - let i_3782: u32 = y - 1_u32; - x[i_3782].b = [100_Field, 101_Field, 102_Field]; + let i_3785: u32 = y - 1_u32; + x[i_3785].b = [100_Field, 101_Field, 102_Field]; } }; assert(x[2_u32].b == [100_Field, 101_Field, 102_Field]); diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/ram_blowup_regression/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/ram_blowup_regression/execute__tests__expanded.snap index f1261ce5c28..217d1389967 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/ram_blowup_regression/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/ram_blowup_regression/execute__tests__expanded.snap @@ -29,8 +29,8 @@ fn main(tx_effects_hash_input: [Field; 256]) -> pub Field { let input_as_bytes: [u8; 32] = tx_effects_hash_input[offset].to_be_bytes(); for byte_index in 0_u32..32_u32 { { - let i_3790: u32 = (offset * 32_u32) + byte_index; - hash_input_flattened[i_3790] = input_as_bytes[byte_index]; + let i_3793: u32 = (offset * 32_u32) + byte_index; + hash_input_flattened[i_3793] = input_as_bytes[byte_index]; } } } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_1144_1169_2399_6609/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_1144_1169_2399_6609/execute__tests__expanded.snap index 40f9238d5e5..7092f305c0e 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_1144_1169_2399_6609/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_1144_1169_2399_6609/execute__tests__expanded.snap @@ -36,12 +36,12 @@ fn compact_decode(input: [u8; N], length: Field) -> ([U4; 16], Field if (i as u32) < (length as u32) { let x: u8 = input[i]; { - let i_3801: u32 = (2_u32 * i) - 1_u32; - nibble[i_3801] = U4::from_u8(x >> 4_u8); + let i_3804: u32 = (2_u32 * i) - 1_u32; + nibble[i_3804] = U4::from_u8(x >> 4_u8); }; { - let i_3802: u32 = 2_u32 * i; - nibble[i_3802] = U4::from_u8(x & 15_u8); + let i_3805: u32 = 2_u32 * i; + nibble[i_3805] = U4::from_u8(x & 15_u8); } } } @@ -50,12 +50,12 @@ fn compact_decode(input: [u8; N], length: Field) -> ([U4; 16], Field if (i as u32) < ((length as u32) - 1_u32) { let x: u8 = input[i + 1_u32]; { - let i_3805: u32 = 2_u32 * i; - nibble[i_3805] = U4::from_u8(x >> 4_u8); + let i_3808: u32 = 2_u32 * i; + nibble[i_3808] = U4::from_u8(x >> 4_u8); }; { - let i_3806: u32 = (2_u32 * i) + 1_u32; - nibble[i_3806] = U4::from_u8(x & 15_u8); + let i_3809: u32 = (2_u32 * i) + 1_u32; + nibble[i_3809] = U4::from_u8(x & 15_u8); } } } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_6674_1/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_6674_1/execute__tests__expanded.snap index 461f1906327..e0c263504ba 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_6674_1/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_6674_1/execute__tests__expanded.snap @@ -16,8 +16,8 @@ impl BoundedVec4 { pub fn push(&mut self, elem: Field) { { - let i_3795: u32 = self.len; - self.storage[i_3795] = elem; + let i_3798: u32 = self.len; + self.storage[i_3798] = elem; }; self.len = self.len + 1_u32; } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_6674_2/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_6674_2/execute__tests__expanded.snap index 44843924fb8..5e63ec4c284 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_6674_2/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_6674_2/execute__tests__expanded.snap @@ -16,8 +16,8 @@ impl BoundedVec4 { pub fn push(&mut self, elem: Field) { { - let i_3795: u32 = self.len; - self.storage[i_3795] = elem; + let i_3798: u32 = self.len; + self.storage[i_3798] = elem; }; self.len = self.len + 1_u32; } diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/regression_capacity_tracker/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/regression_capacity_tracker/execute__tests__expanded.snap index 7e536a0a4a5..09ecd73c799 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/regression_capacity_tracker/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/regression_capacity_tracker/execute__tests__expanded.snap @@ -8,13 +8,13 @@ fn main(expected: pub Field, first: Field, input: [Field; 20]) { assert(hasher_slice[0_u32] == expected); if (expected as u32) > 10_u32 { { - let i_3777: u32 = (expected - 10_Field) as u32; - hasher_slice[i_3777] = 100_Field; + let i_3780: u32 = (expected - 10_Field) as u32; + hasher_slice[i_3780] = 100_Field; } } else { { - let i_3778: u32 = expected as u32; - hasher_slice[i_3778] = 100_Field; + let i_3781: u32 = expected as u32; + hasher_slice[i_3781] = 100_Field; } }; assert(hasher_slice[0_u32] == expected); diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/slice_dynamic_index/execute__tests__expanded.snap b/tooling/nargo_cli/tests/snapshots/execution_success/slice_dynamic_index/execute__tests__expanded.snap index 03570abd474..b76fff51d79 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/slice_dynamic_index/execute__tests__expanded.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/slice_dynamic_index/execute__tests__expanded.snap @@ -36,8 +36,8 @@ fn dynamic_slice_index_set_if(mut slice: [Field], x: u32, y: u32) { assert(slice[x] == 4_Field); slice[x] = slice[x] - 2_Field; { - let i_3821: u32 = x - 1_u32; - slice[i_3821] = slice[x]; + let i_3824: u32 = x - 1_u32; + slice[i_3824] = slice[x]; } } else { slice[x] = 0_Field; @@ -56,8 +56,8 @@ fn dynamic_slice_index_set_else(mut slice: [Field], x: u32, y: u32) { assert(slice[x] == 4_Field); slice[x] = slice[x] - 2_Field; { - let i_3822: u32 = x - 1_u32; - slice[i_3822] = slice[x]; + let i_3825: u32 = x - 1_u32; + slice[i_3825] = slice[x]; } } else { slice[x] = 0_Field;