diff --git a/acvm-repo/acvm/tests/solver.proptest-regressions b/acvm-repo/acvm/tests/solver.proptest-regressions index d5b09c8c009..748c9c7a027 100644 --- a/acvm-repo/acvm/tests/solver.proptest-regressions +++ b/acvm-repo/acvm/tests/solver.proptest-regressions @@ -17,3 +17,4 @@ cc 4fc0bd347d9f4967801e2e30c746d2f6c012882911f72e7e816d350a742ced28 # shrinks to cc 04d8571793600c2023d7aba2d1dd8f0e2c82b6010130d95a193df02b07977712 # shrinks to inputs_distinct_inputs = ([], [(0, true)]) cc dbc57772b9450371db70f8aa06d10502bb1aef030448c6df467465937bc8916a # shrinks to inputs_distinct_inputs = ([(295, false), (0, false), (0, false), (0, false), (0, false), (0, false)], [(295, false), (0, false), (328, false), (237, true), (484, true), (69, false)]) cc ef68d2dc6f0d366dd69edf8eec02a7b9cd7d6888983cea45496516b6effca813 # shrinks to inputs_distinct_inputs = ([(40, false), (471, false), (56, false), (35, false), (104, false), (232, false), (252, false), (131, false), (437, true), (354, false), (235, false), (316, true), (364, true), (242, false), (436, true), (298, true), (360, true), (174, true), (295, false), (250, true), (178, true), (426, false), (78, false), (217, true), (296, true), (371, false), (349, true), (445, false), (221, false), (409, false), (59, false), (511, true), (482, false)], [(136, true), (228, true), (193, true), (190, true), (15, false), (399, false), (54, false), (195, true), (258, true), (99, false), (83, false), (383, true), (456, true), (409, true), (347, false), (183, false), (371, true), (410, true), (439, true), (175, true), (445, false), (165, false), (70, false), (2⁴×22, true), (339, true), (161, true), (313, false), (2⁴×23, true), (275, true), (278, true), (294, true), (284, true), (262, false)]) +cc ff78ae2090837bce192e5793754b9143500f70cdc7c71dc196106f9b2a36186c # shrinks to x = (11511220462188010364630447054930908966505262974220186213005541104952868383229, false), y = (7441439834137017688138027683185021846617790109711995169214836794920459176455, false), z = (-7131467151439280878007322057486113659135907187574829308381607284375377895255, false), use_constant_xy = false, use_constant_yz = false diff --git a/noir_stdlib/src/convert.nr b/noir_stdlib/src/convert.nr index ece2d6ef95b..85a1c838acd 100644 --- a/noir_stdlib/src/convert.nr +++ b/noir_stdlib/src/convert.nr @@ -28,17 +28,36 @@ where // docs:start:from-impls // Unsigned integers +impl From for u16 { + fn from(value: u8) -> u16 { + value as u16 + } +} + impl From for u32 { fn from(value: u8) -> u32 { value as u32 } } +impl From for u32 { + fn from(value: u16) -> u32 { + value as u32 + } +} + impl From for u64 { fn from(value: u8) -> u64 { value as u64 } } + +impl From for u64 { + fn from(value: u16) -> u64 { + value as u64 + } +} + impl From for u64 { fn from(value: u32) -> u64 { value as u64 @@ -50,6 +69,13 @@ impl From for u128 { value as u128 } } + +impl From for u128 { + fn from(value: u16) -> u128 { + value as u128 + } +} + impl From for u128 { fn from(value: u32) -> u128 { value as u128 @@ -66,6 +92,13 @@ impl From for Field { value as Field } } + +impl From for Field { + fn from(value: u16) -> Field { + value as Field + } +} + impl From for Field { fn from(value: u32) -> Field { value as Field @@ -85,17 +118,36 @@ impl From for Field { // Signed integers +impl From for i16 { + fn from(value: i8) -> i16 { + value as i16 + } +} + impl From for i32 { fn from(value: i8) -> i32 { value as i32 } } +impl From for i32 { + fn from(value: i16) -> i32 { + value as i32 + } +} + impl From for i64 { fn from(value: i8) -> i64 { value as i64 } } + +impl From for i64 { + fn from(value: i16) -> i64 { + value as i64 + } +} + impl From for i64 { fn from(value: i32) -> i64 { value as i64 @@ -108,6 +160,11 @@ impl From for u8 { value as u8 } } +impl From for u16 { + fn from(value: bool) -> u16 { + value as u16 + } +} impl From for u32 { fn from(value: bool) -> u32 { value as u32 @@ -118,11 +175,21 @@ impl From for u64 { value as u64 } } +impl From for u128 { + fn from(value: bool) -> u128 { + value as u128 + } +} impl From for i8 { fn from(value: bool) -> i8 { value as i8 } } +impl From for i16 { + fn from(value: bool) -> i16 { + value as i16 + } +} impl From for i32 { fn from(value: bool) -> i32 { value as i32 diff --git a/tooling/nargo_cli/build.rs b/tooling/nargo_cli/build.rs index 61d88d951b2..3a075c43e31 100644 --- a/tooling/nargo_cli/build.rs +++ b/tooling/nargo_cli/build.rs @@ -210,7 +210,7 @@ const IGNORED_NARGO_EXPAND_COMPILE_SUCCESS_EMPTY_TESTS: [&str; 13] = [ /// These tests are ignored because of existing bugs in `nargo expand`. /// As the bugs are fixed these tests should be removed from this list. -const IGNORED_NARGO_EXPAND_COMPILE_SUCCESS_NO_BUG_TESTS: [&str; 12] = [ +const IGNORED_NARGO_EXPAND_COMPILE_SUCCESS_NO_BUG_TESTS: [&str; 13] = [ "noirc_frontend_tests_arithmetic_generics_checked_casts_do_not_prevent_canonicalization", "noirc_frontend_tests_check_trait_as_type_as_fn_parameter", "noirc_frontend_tests_check_trait_as_type_as_two_fn_parameters", @@ -226,6 +226,8 @@ const IGNORED_NARGO_EXPAND_COMPILE_SUCCESS_NO_BUG_TESTS: [&str; 12] = [ // "noirc_frontend_tests_traits_as_trait_path_called_multiple_times_for_different_t_2", // This creates a struct at comptime which, expanded, gives a visibility error "noirc_frontend_tests_visibility_visibility_bug_inside_comptime", + // bug + "noirc_frontend_tests_traits_associated_constant_sum_of_other_constants_3", ]; const IGNORED_NARGO_EXPAND_COMPILE_SUCCESS_WITH_BUG_TESTS: [&str; 1] = 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 646872a18c2..4c71b503157 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_3809: u32 = array.len(); - result[i_3809] = element; + let i_3842: u32 = array.len(); + result[i_3842] = 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 cf6ecee2e85..c040142ec7a 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_3778: u32 = { + let i_3811: u32 = { a = ([4_Field, 5_Field], 6_Field); 1_u32 }; - a.0[i_3778] = 7_Field; + a.0[i_3811] = 7_Field; }; assert(a == ([4_Field, 7_Field], 6_Field)); } 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 292caa971bf..74d940f775d 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_3792: u32 = index as u32; - self.data[i_3792] = elem; + let i_3825: u32 = index as u32; + self.data[i_3825] = 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 dc6ee92dcca..0f7fade4686 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_3810: u32 = index as u32; - self.data[i_3810] = elem; + let i_3843: u32 = index as u32; + self.data[i_3843] = 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 06fee173067..8dcc3b5f93b 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_3799: u32 = i + num_shifted_limbs; - result[i_3799] = 0_u64; + let i_3832: u32 = i + num_shifted_limbs; + result[i_3832] = 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 d4e5349aa6b..8476e6a6424 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_3801: u32 = i + a.len(); - array[i_3801] = b[i]; + let i_3834: u32 = i + a.len(); + array[i_3834] = 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 7dabd0a0450..e1ef52bbebc 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_3801: u32 = i + a.len(); - array[i_3801] = b[i]; + let i_3834: u32 = i + a.len(); + array[i_3834] = b[i]; } } array diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index 8db37d24dbc..b90bc537723 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -64,7 +64,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "vZNNjoQgEIXvwtoFPwrqVSYTg4odEoKGhkkmxrsPoHTrgs6kF715BZTvS1WsWsEoenfrpJ7mO2i/VtAbqZS8dWoeuJWz9q/rVoB07awRwj+BU967Fm6EtqDVTqkC/HDl4kf3hesYLTc+Cwsg9OijB05SiXDaiqcb5q2I0sOM6qe9uvpR3s9Ygw4AqxF9EEhzIeAXFUBaJUQ4ZxkkzyCsbA4EYRQ/CAi/VwWD8K1OGCQnRp1j0A92grKd/PevYpIjvJqrJs0VhvgyV9/+xgdpLpsACGh932XUKiqNyqLWUZuoCO4B7QHvYfejMvS8hbKM5L0Sx5ZNTg+npbO/S8qktVzMPIjRGRHKijlf6B8=", + "debug_symbols": "vZNNjoQgEIXvUmsX/CioV5lMDCp2SAgaWieZGO8+gNKtCzqTXvTmFVC+L1WxaoVetsutUWYY71B/rdBapbW6NXrsxKxG417XLYN4bWYrpXuCU965JmGlmaE2i9YZ/Ai9hI/ukzAhzsK6LMpAmt5FBxyUlv60ZU83SlsxY4cZl097cfXjtJ/zCh8AXmL2INDqQiAvKkCsiAh/TjJompFzSg5EzvPiQcDkvSo4Qm91whE9McoUg32wE5zs5L9/ldAU4dVcVXGuCCKXufp2N9Epe9kEoFBXGeRBi6AsKA9aBq2CYrQHvAeyh92Pc9/z5suySrRaHls2LKY7Ld38O8VMXMvJjp3sFyt9WSHnCv0D", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_add(y as u8) as i8\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_add(y as u16) as i16\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_add(y as u32) as i32\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_add(y as u64) as i64\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_sub(y as u8) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_sub(y as u16) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_sub(y as u32) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_sub(y as u64) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_mul(y as u8) as i8\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_mul(y as u16) as i16\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_mul(y as u32) as i32\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_mul(y as u64) as i64\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_0.snap index 8db37d24dbc..b90bc537723 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_0.snap @@ -64,7 +64,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "vZNNjoQgEIXvwtoFPwrqVSYTg4odEoKGhkkmxrsPoHTrgs6kF715BZTvS1WsWsEoenfrpJ7mO2i/VtAbqZS8dWoeuJWz9q/rVoB07awRwj+BU967Fm6EtqDVTqkC/HDl4kf3hesYLTc+Cwsg9OijB05SiXDaiqcb5q2I0sOM6qe9uvpR3s9Ygw4AqxF9EEhzIeAXFUBaJUQ4ZxkkzyCsbA4EYRQ/CAi/VwWD8K1OGCQnRp1j0A92grKd/PevYpIjvJqrJs0VhvgyV9/+xgdpLpsACGh932XUKiqNyqLWUZuoCO4B7QHvYfejMvS8hbKM5L0Sx5ZNTg+npbO/S8qktVzMPIjRGRHKijlf6B8=", + "debug_symbols": "vZNNjoQgEIXvUmsX/CioV5lMDCp2SAgaWieZGO8+gNKtCzqTXvTmFVC+L1WxaoVetsutUWYY71B/rdBapbW6NXrsxKxG417XLYN4bWYrpXuCU965JmGlmaE2i9YZ/Ai9hI/ukzAhzsK6LMpAmt5FBxyUlv60ZU83SlsxY4cZl097cfXjtJ/zCh8AXmL2INDqQiAvKkCsiAh/TjJompFzSg5EzvPiQcDkvSo4Qm91whE9McoUg32wE5zs5L9/ldAU4dVcVXGuCCKXufp2N9Epe9kEoFBXGeRBi6AsKA9aBq2CYrQHvAeyh92Pc9/z5suySrRaHls2LKY7Ld38O8VMXMvJjp3sFyt9WSHnCv0D", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_add(y as u8) as i8\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_add(y as u16) as i16\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_add(y as u32) as i32\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_add(y as u64) as i64\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_sub(y as u8) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_sub(y as u16) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_sub(y as u32) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_sub(y as u64) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_mul(y as u8) as i8\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_mul(y as u16) as i16\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_mul(y as u32) as i32\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_mul(y as u64) as i64\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index 8db37d24dbc..b90bc537723 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -64,7 +64,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "vZNNjoQgEIXvwtoFPwrqVSYTg4odEoKGhkkmxrsPoHTrgs6kF715BZTvS1WsWsEoenfrpJ7mO2i/VtAbqZS8dWoeuJWz9q/rVoB07awRwj+BU967Fm6EtqDVTqkC/HDl4kf3hesYLTc+Cwsg9OijB05SiXDaiqcb5q2I0sOM6qe9uvpR3s9Ygw4AqxF9EEhzIeAXFUBaJUQ4ZxkkzyCsbA4EYRQ/CAi/VwWD8K1OGCQnRp1j0A92grKd/PevYpIjvJqrJs0VhvgyV9/+xgdpLpsACGh932XUKiqNyqLWUZuoCO4B7QHvYfejMvS8hbKM5L0Sx5ZNTg+npbO/S8qktVzMPIjRGRHKijlf6B8=", + "debug_symbols": "vZNNjoQgEIXvUmsX/CioV5lMDCp2SAgaWieZGO8+gNKtCzqTXvTmFVC+L1WxaoVetsutUWYY71B/rdBapbW6NXrsxKxG417XLYN4bWYrpXuCU965JmGlmaE2i9YZ/Ai9hI/ukzAhzsK6LMpAmt5FBxyUlv60ZU83SlsxY4cZl097cfXjtJ/zCh8AXmL2INDqQiAvKkCsiAh/TjJompFzSg5EzvPiQcDkvSo4Qm91whE9McoUg32wE5zs5L9/ldAU4dVcVXGuCCKXufp2N9Epe9kEoFBXGeRBi6AsKA9aBq2CYrQHvAeyh92Pc9/z5suySrRaHls2LKY7Ld38O8VMXMvJjp3sFyt9WSHnCv0D", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_add(y as u8) as i8\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_add(y as u16) as i16\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_add(y as u32) as i32\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_add(y as u64) as i64\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_sub(y as u8) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_sub(y as u16) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_sub(y as u32) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_sub(y as u64) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_mul(y as u8) as i8\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_mul(y as u16) as i16\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_mul(y as u32) as i32\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_mul(y as u64) as i64\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 1256d49e4c4..4d5d90bfb15 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -53,10 +53,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 32 }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(1), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(4), rhs: Relative(1) }, Cast { destination: Relative(1), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Sub, lhs: Relative(5), rhs: Relative(1) }, Cast { destination: Relative(4), source: Relative(2), bit_size: Integer(U32) }, Cast { destination: Relative(1), source: Relative(4), bit_size: Field }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(1), location: 31 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 37 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "vZPNjoMgEIDfZc4e+KkgvErTNNRiQ0LQUN1kY3z3Haq2eqDZ9NALH4jzDYSZEa72MtzOLjTtHfRxhEt03rvb2be16V0b8OsIJA1UgT4UwHBRIugMBloiOOgKcQCtEOUMMUOCpgRZLVQzOUmcpgLWXOc+WptSbZLjkToTbehBh8H7An6MHx4/3TsTHuxNxF002nBForBx3qbZVLyiST6UCrEE0+oVXu7jaT5eSkUXgayoeBq42hnYmxMQUa6KNM86eN7B5UEtCi4Fexoo++wUkpCPbiIJ3ziqnEN88SY0e5P/virjOcO7ulJrXTHCdnV1wpWpXdy12ZRM0ZmLt8uyGUK92e1/u3VnbdMutrW9DtEm06ZXcTxyVnB5mlK2Pw==", + "debug_symbols": "vZPNjoMgEIDfZc4e+FFRXqVpDCo2JAQN1U02xnffoWqrB5pND73wgTjfgM7M0Op6ulXGdf0d5GWG2htrza2yfaNG0zt8OgMJAy1BpgkwXGQIuoKBFAgOskCkIEtEtiJfIUBSgiw2lis5CVyWBPZc1ei1DqkOyfFIg/LajSDdZG0CP8pOj5fug3IPjsrjLhq1a5Eo7IzVYbYkr2gSD6V5vgXT4hWeneNpPF6Ikm4CUdD8aeDlycDenIDk2a4I86iDxx2p4GxTpCLNngbKPjuFIOSjmwjCD44i5si/eBMavcl//yrjMcO7uir3umKEnerqiivVGH9qsyWYvFG11duym1xz2B1/h31nb9PB941uJ6+D6dCrOF7wI3JxXUK2Pw==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_0.snap index 1256d49e4c4..4d5d90bfb15 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_0.snap @@ -53,10 +53,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 32 }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(1), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(4), rhs: Relative(1) }, Cast { destination: Relative(1), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Sub, lhs: Relative(5), rhs: Relative(1) }, Cast { destination: Relative(4), source: Relative(2), bit_size: Integer(U32) }, Cast { destination: Relative(1), source: Relative(4), bit_size: Field }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(1), location: 31 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 37 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "vZPNjoMgEIDfZc4e+KkgvErTNNRiQ0LQUN1kY3z3Haq2eqDZ9NALH4jzDYSZEa72MtzOLjTtHfRxhEt03rvb2be16V0b8OsIJA1UgT4UwHBRIugMBloiOOgKcQCtEOUMMUOCpgRZLVQzOUmcpgLWXOc+WptSbZLjkToTbehBh8H7An6MHx4/3TsTHuxNxF002nBForBx3qbZVLyiST6UCrEE0+oVXu7jaT5eSkUXgayoeBq42hnYmxMQUa6KNM86eN7B5UEtCi4Fexoo++wUkpCPbiIJ3ziqnEN88SY0e5P/virjOcO7ulJrXTHCdnV1wpWpXdy12ZRM0ZmLt8uyGUK92e1/u3VnbdMutrW9DtEm06ZXcTxyVnB5mlK2Pw==", + "debug_symbols": "vZPNjoMgEIDfZc4e+FFRXqVpDCo2JAQN1U02xnffoWqrB5pND73wgTjfgM7M0Op6ulXGdf0d5GWG2htrza2yfaNG0zt8OgMJAy1BpgkwXGQIuoKBFAgOskCkIEtEtiJfIUBSgiw2lis5CVyWBPZc1ei1DqkOyfFIg/LajSDdZG0CP8pOj5fug3IPjsrjLhq1a5Eo7IzVYbYkr2gSD6V5vgXT4hWeneNpPF6Ikm4CUdD8aeDlycDenIDk2a4I86iDxx2p4GxTpCLNngbKPjuFIOSjmwjCD44i5si/eBMavcl//yrjMcO7uir3umKEnerqiivVGH9qsyWYvFG11duym1xz2B1/h31nb9PB941uJ6+D6dCrOF7wI3JxXUK2Pw==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 1256d49e4c4..4d5d90bfb15 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_4_sub/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -53,10 +53,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 32 }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(1), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(4), rhs: Relative(1) }, Cast { destination: Relative(1), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Sub, lhs: Relative(5), rhs: Relative(1) }, Cast { destination: Relative(4), source: Relative(2), bit_size: Integer(U32) }, Cast { destination: Relative(1), source: Relative(4), bit_size: Field }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(1), location: 31 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 37 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "vZPNjoMgEIDfZc4e+KkgvErTNNRiQ0LQUN1kY3z3Haq2eqDZ9NALH4jzDYSZEa72MtzOLjTtHfRxhEt03rvb2be16V0b8OsIJA1UgT4UwHBRIugMBloiOOgKcQCtEOUMMUOCpgRZLVQzOUmcpgLWXOc+WptSbZLjkToTbehBh8H7An6MHx4/3TsTHuxNxF002nBForBx3qbZVLyiST6UCrEE0+oVXu7jaT5eSkUXgayoeBq42hnYmxMQUa6KNM86eN7B5UEtCi4Fexoo++wUkpCPbiIJ3ziqnEN88SY0e5P/virjOcO7ulJrXTHCdnV1wpWpXdy12ZRM0ZmLt8uyGUK92e1/u3VnbdMutrW9DtEm06ZXcTxyVnB5mlK2Pw==", + "debug_symbols": "vZPNjoMgEIDfZc4e+FFRXqVpDCo2JAQN1U02xnffoWqrB5pND73wgTjfgM7M0Op6ulXGdf0d5GWG2htrza2yfaNG0zt8OgMJAy1BpgkwXGQIuoKBFAgOskCkIEtEtiJfIUBSgiw2lis5CVyWBPZc1ei1DqkOyfFIg/LajSDdZG0CP8pOj5fug3IPjsrjLhq1a5Eo7IzVYbYkr2gSD6V5vgXT4hWeneNpPF6Ikm4CUdD8aeDlycDenIDk2a4I86iDxx2p4GxTpCLNngbKPjuFIOSjmwjCD44i5si/eBMavcl//yrjMcO7uir3umKEnerqiivVGH9qsyWYvFG11duym1xz2B1/h31nb9PB941uJ6+D6dCrOF7wI3JxXUK2Pw==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index a9d7be9aef7..9a4e94829e8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -62,10 +62,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "pZNNjoQgEIXvwtoFvyp9lcnEoGKHhKChdZKJ8e5Tgtq6wEXPph5Qvi+URc2o1fX0rIzr+hd6fM2o9sZa86xs36jR9A5O5yVD+7YavdZwhE55cA3Kazeih5uszdCPslP46DUoF3RUHrI4Q9q1oADsjNXrasnebpy2Eso3M2HlYRdXP0n7JePFBpCsoAeByQuB3twAl2xHwJonGSzNYAWXG4IV+ZtA6Ie3EPyzSig+MUSKkacZnOR7Q2BZpiq566g4OprjVEfv/HL3U0z+6RcX/zfsVGP8ZQYQRQ/48SxEHqIIMQ+xCLEMUYZIcBQSJdoJ+EsQAMBDICJKHqWIUq5dAZVRKd6UrLqsBXmjaqu3yewm15wGdfwd9sw+yoPvG91OXq8FhRyU+Ac=", + "debug_symbols": "pZPLjoQgEEX/hbULnir9K5OJQcUOCUFD6yQT479PCeroAhfdm3t5eE8oKzWjVtfTszKu61/o8TWj2htrzbOyfaNG0zs4nZcM7dtq9FrDETrdQ2pQXrsRPdxkbYZ+lJ3CR69BueCj8nCLM6RdCw7Azli9rpbsP43TUUL5FiasPOLimifpvGS82ACSFfQgMHkh0JsX4JLtCFjzJIOlGbxgdEPwgouDQOibrxD8vUooPjFEipGnGYIc/1MQQVKV3HVUHB3Ncaqjd3m55ykmH+bFJf8NO9UYf5kBRNEDKmZBeVARNA9aBC2DyqAERyPRYpxAvgQDgAQT0fJoRbRy7Qq4jE7x5mT1ZS3IG1VbvU1mN7nmNKjj77Df7KM8+L7R7eT1WlC4gxL/AA==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_0.snap index a9d7be9aef7..9a4e94829e8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_0.snap @@ -62,10 +62,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "pZNNjoQgEIXvwtoFvyp9lcnEoGKHhKChdZKJ8e5Tgtq6wEXPph5Qvi+URc2o1fX0rIzr+hd6fM2o9sZa86xs36jR9A5O5yVD+7YavdZwhE55cA3Kazeih5uszdCPslP46DUoF3RUHrI4Q9q1oADsjNXrasnebpy2Eso3M2HlYRdXP0n7JePFBpCsoAeByQuB3twAl2xHwJonGSzNYAWXG4IV+ZtA6Ie3EPyzSig+MUSKkacZnOR7Q2BZpiq566g4OprjVEfv/HL3U0z+6RcX/zfsVGP8ZQYQRQ/48SxEHqIIMQ+xCLEMUYZIcBQSJdoJ+EsQAMBDICJKHqWIUq5dAZVRKd6UrLqsBXmjaqu3yewm15wGdfwd9sw+yoPvG91OXq8FhRyU+Ac=", + "debug_symbols": "pZPLjoQgEEX/hbULnir9K5OJQcUOCUFD6yQT479PCeroAhfdm3t5eE8oKzWjVtfTszKu61/o8TWj2htrzbOyfaNG0zs4nZcM7dtq9FrDETrdQ2pQXrsRPdxkbYZ+lJ3CR69BueCj8nCLM6RdCw7Azli9rpbsP43TUUL5FiasPOLimifpvGS82ACSFfQgMHkh0JsX4JLtCFjzJIOlGbxgdEPwgouDQOibrxD8vUooPjFEipGnGYIc/1MQQVKV3HVUHB3Ncaqjd3m55ykmH+bFJf8NO9UYf5kBRNEDKmZBeVARNA9aBC2DyqAERyPRYpxAvgQDgAQT0fJoRbRy7Qq4jE7x5mT1ZS3IG1VbvU1mN7nmNKjj77Df7KM8+L7R7eT1WlC4gxL/AA==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index a9d7be9aef7..9a4e94829e8 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -62,10 +62,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "pZNNjoQgEIXvwtoFvyp9lcnEoGKHhKChdZKJ8e5Tgtq6wEXPph5Qvi+URc2o1fX0rIzr+hd6fM2o9sZa86xs36jR9A5O5yVD+7YavdZwhE55cA3Kazeih5uszdCPslP46DUoF3RUHrI4Q9q1oADsjNXrasnebpy2Eso3M2HlYRdXP0n7JePFBpCsoAeByQuB3twAl2xHwJonGSzNYAWXG4IV+ZtA6Ie3EPyzSig+MUSKkacZnOR7Q2BZpiq566g4OprjVEfv/HL3U0z+6RcX/zfsVGP8ZQYQRQ/48SxEHqIIMQ+xCLEMUYZIcBQSJdoJ+EsQAMBDICJKHqWIUq5dAZVRKd6UrLqsBXmjaqu3yewm15wGdfwd9sw+yoPvG91OXq8FhRyU+Ac=", + "debug_symbols": "pZPLjoQgEEX/hbULnir9K5OJQcUOCUFD6yQT479PCeroAhfdm3t5eE8oKzWjVtfTszKu61/o8TWj2htrzbOyfaNG0zs4nZcM7dtq9FrDETrdQ2pQXrsRPdxkbYZ+lJ3CR69BueCj8nCLM6RdCw7Azli9rpbsP43TUUL5FiasPOLimifpvGS82ACSFfQgMHkh0JsX4JLtCFjzJIOlGbxgdEPwgouDQOibrxD8vUooPjFEipGnGYIc/1MQQVKV3HVUHB3Ncaqjd3m55ykmH+bFJf8NO9UYf5kBRNEDKmZBeVARNA9aBC2DyqAERyPRYpxAvgQDgAQT0fJoRbRy7Qq4jE7x5mT1ZS3IG1VbvU1mN7nmNKjj77Df7KM8+L7R7eT1WlC4gxL/AA==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index b8f23aefdf1..c17583bee76 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 36 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(3), rhs: Relative(3) }, Cast { destination: Relative(4), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(3), source: Relative(4), bit_size: Field }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 26 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Cast { destination: Relative(3), source: Relative(2), bit_size: Integer(U1) }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U1, lhs: Relative(1), rhs: Relative(2) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 1 }, JumpIf { condition: Relative(3), location: 35 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(2) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 41 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "pZPNjsIgFEbf5a674LcUXsUYgxUNCaENtpNMTN99QKi2C1w4Gw6UfodLbnjAxZzn28n663AHdXjAOVjn7O3khl5PdvDx6wNQGrAAxRrAHSgeIUGJBgjKwBkEVBdBM1gGz2hByQiR0WVEC0YNUFSIC0khLWSJy9LAWtdpCsaksjaFxvJHHYyfQPnZuQZ+tJufP91H7Z+cdIi70Wj8JTIKr9aZNFuadxrVo5iwEsa0e8X5Po/reUmZKAJJBXkZqNwZyIcKUEdXRZyzqoPWHVQwWRRUtG8DJl9Wwdl3NyFo4+A1R1t3MNyuDYnTrnaTTx3lr462qNbRT3m55gnC/8zzXf4YV7q3YfcYl2QKVp+dKcvr7PvN7vQ7rjvrYx7D0JvLHEwybV50HA+0bRg+Lum0Pw==", + "debug_symbols": "pZPNjoMgFEbf5a5Z8CvKq0yahlrakBA0VCeZNL77QEFHF3TR2XBA/I4XyX3C1Vzm+9n62/AA9fWES7DO2fvZDb2e7ODj0yfgNBAJiiMgLSgR0YGSCCjOIBkUVBvBMniGyGhAdREyo82IFoIRMFxICmkhK+SJy4Jgres8BWNSWbtCY/mjDsZPoPzsHIJv7ebXS49R+xcnHeJuNBp/jYzCm3UmzRb0l8b1KKG8hAlrt7g45kk93zEui6Bjkm4G1h0M9E0FuGWrIs551cHqDi4ZLQouudgMhH5YheCfnYTinUPUHE3dIcj2PwURpHaSdzcqthttcO1G3+W7NU8x+WdeHPKnuNK9DYdmXJIpWH1xpixvs+93u9PPuO6szTyGoTfXOZhk2nV0HL9Ygzg5Lelrvw==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_0.snap index b8f23aefdf1..c17583bee76 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_0.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 36 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(3), rhs: Relative(3) }, Cast { destination: Relative(4), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(3), source: Relative(4), bit_size: Field }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 26 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Cast { destination: Relative(3), source: Relative(2), bit_size: Integer(U1) }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U1, lhs: Relative(1), rhs: Relative(2) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 1 }, JumpIf { condition: Relative(3), location: 35 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(2) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 41 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "pZPNjsIgFEbf5a674LcUXsUYgxUNCaENtpNMTN99QKi2C1w4Gw6UfodLbnjAxZzn28n663AHdXjAOVjn7O3khl5PdvDx6wNQGrAAxRrAHSgeIUGJBgjKwBkEVBdBM1gGz2hByQiR0WVEC0YNUFSIC0khLWSJy9LAWtdpCsaksjaFxvJHHYyfQPnZuQZ+tJufP91H7Z+cdIi70Wj8JTIKr9aZNFuadxrVo5iwEsa0e8X5Po/reUmZKAJJBXkZqNwZyIcKUEdXRZyzqoPWHVQwWRRUtG8DJl9Wwdl3NyFo4+A1R1t3MNyuDYnTrnaTTx3lr462qNbRT3m55gnC/8zzXf4YV7q3YfcYl2QKVp+dKcvr7PvN7vQ7rjvrYx7D0JvLHEwybV50HA+0bRg+Lum0Pw==", + "debug_symbols": "pZPNjoMgFEbf5a5Z8CvKq0yahlrakBA0VCeZNL77QEFHF3TR2XBA/I4XyX3C1Vzm+9n62/AA9fWES7DO2fvZDb2e7ODj0yfgNBAJiiMgLSgR0YGSCCjOIBkUVBvBMniGyGhAdREyo82IFoIRMFxICmkhK+SJy4Jgres8BWNSWbtCY/mjDsZPoPzsHIJv7ebXS49R+xcnHeJuNBp/jYzCm3UmzRb0l8b1KKG8hAlrt7g45kk93zEui6Bjkm4G1h0M9E0FuGWrIs551cHqDi4ZLQouudgMhH5YheCfnYTinUPUHE3dIcj2PwURpHaSdzcqthttcO1G3+W7NU8x+WdeHPKnuNK9DYdmXJIpWH1xpixvs+93u9PPuO6szTyGoTfXOZhk2nV0HL9Ygzg5Lelrvw==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index b8f23aefdf1..c17583bee76 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_5_over/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 36 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(3), rhs: Relative(3) }, Cast { destination: Relative(4), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(3), source: Relative(4), bit_size: Field }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 26 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Cast { destination: Relative(3), source: Relative(2), bit_size: Integer(U1) }, Cast { destination: Relative(1), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(2), source: Relative(1), bit_size: Integer(U1) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 0 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U1, lhs: Relative(1), rhs: Relative(2) }, Const { destination: Relative(1), bit_size: Integer(U1), value: 1 }, JumpIf { condition: Relative(3), location: 35 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(2) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 41 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "pZPNjsIgFEbf5a674LcUXsUYgxUNCaENtpNMTN99QKi2C1w4Gw6UfodLbnjAxZzn28n663AHdXjAOVjn7O3khl5PdvDx6wNQGrAAxRrAHSgeIUGJBgjKwBkEVBdBM1gGz2hByQiR0WVEC0YNUFSIC0khLWSJy9LAWtdpCsaksjaFxvJHHYyfQPnZuQZ+tJufP91H7Z+cdIi70Wj8JTIKr9aZNFuadxrVo5iwEsa0e8X5Po/reUmZKAJJBXkZqNwZyIcKUEdXRZyzqoPWHVQwWRRUtG8DJl9Wwdl3NyFo4+A1R1t3MNyuDYnTrnaTTx3lr462qNbRT3m55gnC/8zzXf4YV7q3YfcYl2QKVp+dKcvr7PvN7vQ7rjvrYx7D0JvLHEwybV50HA+0bRg+Lum0Pw==", + "debug_symbols": "pZPNjoMgFEbf5a5Z8CvKq0yahlrakBA0VCeZNL77QEFHF3TR2XBA/I4XyX3C1Vzm+9n62/AA9fWES7DO2fvZDb2e7ODj0yfgNBAJiiMgLSgR0YGSCCjOIBkUVBvBMniGyGhAdREyo82IFoIRMFxICmkhK+SJy4Jgres8BWNSWbtCY/mjDsZPoPzsHIJv7ebXS49R+xcnHeJuNBp/jYzCm3UmzRb0l8b1KKG8hAlrt7g45kk93zEui6Bjkm4G1h0M9E0FuGWrIs551cHqDi4ZLQouudgMhH5YheCfnYTinUPUHE3dIcj2PwURpHaSdzcqthttcO1G3+W7NU8x+WdeHPKnuNK9DYdmXJIpWH1xpixvs+93u9PPuO6szTyGoTfXOZhk2nV0HL9Ygzg5Lelrvw==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index 0a082758f1e..e91ac6f45a6 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -510,10 +510,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tZndbttIDEbfxde5GJLz21dZLAo3dYsARhK4SYFF0XdfzQyPkxaQm8rt1XcSaY4lUpRk+Nvu4+HD8+f3d/efHr7s3v3zbffhdHc83n1+f3y43T/dPdwv//32/WbHn++fTofD8q/dq+3Lqsf96XD/tHt3/3w83uy+7o/PY6cvj/v7kU/707I13OwO9x+XXISf7o6HTt9vXlaH9aWSiy+WIufl6c3rVZqvV41b1iufr3bl529bH4X1sWxZnzPri25Yb4X1VuuG9dHM10fbcvwxV9aXtmk9/YvN1tbLBUEpjQ6UKvmssPajQi5cwyEnHJ3XJXqpEZEraenJSytFNx5HCWH1ON5aD7U1xaWWBKUlr+r5c0vyuqBZpKnNXl3VP59FuVSKaucbS6gpbpRoeCVJq5J2oRqS40s56lpf31ZPWx1xlavrqXqxFPF1PdcldvUl/ovjeFtffyF5W181X93X35hXCVuGLZ0vjrw6bHrh+swvT6CsefXWZZee4SHml3rGUjZKor2S1FWJ/s1hS8LzMG16nmfheZbNNqwv5/eRElc/366/edrbb55xXVKvHnb7Ezdx+xM38Sh/87oqxc5P1S3XRQtMadOwYX1t+br1kftMTVveE9v5amhpy3tea3x+a1veM0Xi+SqQ9OOd8t/lr/3t3emH70Y70eXGebMTmxGX1i+RZuRl5RJlRp27tBEaxi4qM3TsojYjzl3SjDx3KTPq3KWNsDB2MZmhYxezGXHukmbkuUuZUecubURcLEvf42JZRiTqjMWyNCPGGYtFFk3MnsWzeraZKXiKp3qaZ/R0X+qHtZQ8Fc/q2Wbm4Cme6mme0TN5ui9333IWuXq2mSV4iqd6mmf0TJ7Z032ljnKUNqL62VY/2+pnW/1sq59t9bOtXr3q1ateverVa+5ri69/Y2rqaZ7RM3lmz+JZPdtMCQEQwAsowYAIJCADBaiA90UkAAJgFq+lSAQSkIECVMA7JBoAARTArPOqlD4iI72wogWogNdWLAACKGBABBKA2bzGYhWgypEqR6ocFTAgAgnIAOZIlSNVTlQ5UeVElRP9S/Qv0T+GSpgqYawkUeVMlTNVzlQ5U+VM/zL9y/SP+RIGTJgw6SPWe9JHbCRVLlS5UOVClQtVLvSv0L9C/xg2YdqEcZNKlStVrlS5UuVKlSv9q/Sv0T/mThg8YfKkUeVGlRtVblS5UeXm/dMQAAEUMCACXmUNGShABbzKKgEQQAEDIoC5z1/rWTy9yipeZdUACKCAARFIQAYKgFm9ymoBEEABAyKQgAwUoALd3B+JY/7Gc1OA/iTsz84+fxMikIAMFKACzaHP3wQBMCfMCXPCnDAnzAlzwpwxZ8wZc8acMWfMGXPGnDFnzAVzwVwwF8wFc5/AUbE+gRMwF8wFc8VcMVfMFXPFXDnmyjFXzBVzxdwwN8wNc8PcMDfMDXPD3DA3N1sIgAAKGBCBBGSgABXALH7VmQiAWTALZsEsmAWzYBbMyjErx6yY+wyOz+ozOAGzYlbMilkxG2bDbJiNYzaO2TAbZsNsmA1zxBwxM4PGDBozaMygMYPGDBozaMygMYPGDBozaMygMYPGDBozaGMGrUM395feMYMdxgyOd2MBlE0GRDYloJtzhwJUNjWHMYN9+ZjBAcomA6Iv7zM4IbOpABxz4ZjHDJYO3dw6KGBABBKQgQJUoDmMGRyAuWFumBvmhrlhbpgb5ubmGAIggAIGRCABGShABTALZsEsmAWzYBbMglkwC2bBrJgVs2JWzIpZMStmxayYFfOYwf7l9uv+dLf/cDx8mb+xfXq+v331k9vTf49s4Ue5x9PD7eHj8+nQv4KObcuX0v8B", + "debug_symbols": "tZndbttIDEbfxde5GJLzu6+yWBRu6hYBjCRwkwKLou++mhke1y0gNyu3V99JpDmWSFGS4a+7D4f3r5/ePTx+fPq8++vvr7v3p4fj8eHTu+PT/f7l4elx+e/Xb3c7/nz3cjocln/tLrYvq573p8Pjy+6vx9fj8W73ZX98HTt9ft4/jnzZn5at4W53ePyw5CL8+HA8dPp29311WF8qufhiKXJent68XqX5etW4Zb3y+Wo3fv629VFYH8uW9TmzvuiG9VZYb7VuWB/NfH20Lccfc2V9aZvW07/YbG29XBGU0uhAqZLPCms/KuTKNRxywtF5XaJXTqSYnisR01khuvE4Sgirx/HWeqitKa61JJxP5KKeP7ckrwuaRZra7OKq/vksyrVSVDvfWEJNcaNEw4UkrUrauiTJ+WSSJFnr69vqaasjrnJzPVWvliJe1nNdYjdf4r84jrf19ReSt/VV8819/R/zKmHLsKVzSfPqsOmV6zN/fwJlzau3Lrv2DA8xf69nLGWjJNqFpK5K9E8OWxKeh2nT8zwLz7NstmF9Ob+PlLj6+Xb7zdPefvOM65J687Db77iJ2++4iUf5k9dVKXZ+qm65LlpgSpuGDetry7etj3Szpi3viS3yntzSlve81vj81ra8Z4rE81Ug6cc75T/LX/v7h9MP3412osuN824nNiMuV8gSaUZeVi5RZtS5SxuhYeyiMkPHLmoz4twlzchzlzKjzl3aCAtjF5MZOnYxmxHnLmlGnruUGXXu0kbExbL0PS6W5fqNOmOxLM2IccZikUUTs2fxrJ5tZgqe4qme5hk93Zf6YS0lT8WzeraZOXiKp3qaZ/RMnu7L3becRa6ebWYJnuKpnuYZPZNn9nRfqaMcpY2ofrbVz7b62VY/2+pnW/1sq1evevWqV6969Zr72uLr35iaeppn9Eye2bN4Vs82U0IABPACSjAgAgnIQAEq4H0RCYAAmMVrKRKBBGSgABXwDokGQAAFMOu8KqWPyEgvrGgBKuC1FQuAAAoYEIEEYDavsVgFqHKkypEqRwUMiEACMoA5UuVIlRNVTlQ5UeVE/xL9S/SPoRKmShgrSVQ5U+VMlTNVzlQ5079M/zL9Y76EARMmTPqI9Z70ERtJlQtVLlS5UOVClQv9K/Sv0D+GTZg2YdykUuVKlStVrlS5UuVK/yr9a/SPuRMGT5g8aVS5UeVGlRtVblS5ef80BEAABQyIgFdZQwYKUAGvskoABFDAgAhg7vPXehZPr7KKV1k1AAIoYEAEEpCBAmBWr7JaAARQwIAIJCADBahAN/dH4pi/8dwUoD8J+7Ozz9+ECCQgAwWoQHPo8zdBAMwJc8KcMCfMCXPCnDBnzBlzxpwxZ8wZc8acMWfMGXPBXDAXzAVzwdwncFSsT+AEzAVzwVwxV8wVc8VcMVeOuXLMFXPFXDE3zA1zw9wwN8wNc8PcMDfMzc0WAiCAAgZEIAEZKEAFMItfdSYCYBbMglkwC2bBLJgFs3LMyjEr5j6D47P6DE7ArJgVs2JWzIbZMBtm45iNYzbMhtkwG2bDHDFHzMygMYPGDBozaMygMYPGDBozaMygMYPGDBozaMygMYPGDNqYQevQzf2ld8xghzGD491YAGWTAZFNCejm3KEAlU3NYcxgXz5mcICyyYDoy/sMTshsKgDHXDjmMYOlQze3DgoYEIEEZKAAFWgOYwYHYG6YG+aGuWFumBvmhrm5OYYACKCAARFIQAYKUAHMglkwC2bBLJgFs2AWzIJZMCtmxayYFbNiVsyKWTErZsU8ZrB/uf2yPz3s3x8Pn+dvbB9fH+8vfnJ7+feZLfwo93x6uj98eD0d+lfQsW35Uvof", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_0.snap index 0a082758f1e..e91ac6f45a6 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_0.snap @@ -510,10 +510,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tZndbttIDEbfxde5GJLz21dZLAo3dYsARhK4SYFF0XdfzQyPkxaQm8rt1XcSaY4lUpRk+Nvu4+HD8+f3d/efHr7s3v3zbffhdHc83n1+f3y43T/dPdwv//32/WbHn++fTofD8q/dq+3Lqsf96XD/tHt3/3w83uy+7o/PY6cvj/v7kU/707I13OwO9x+XXISf7o6HTt9vXlaH9aWSiy+WIufl6c3rVZqvV41b1iufr3bl529bH4X1sWxZnzPri25Yb4X1VuuG9dHM10fbcvwxV9aXtmk9/YvN1tbLBUEpjQ6UKvmssPajQi5cwyEnHJ3XJXqpEZEraenJSytFNx5HCWH1ON5aD7U1xaWWBKUlr+r5c0vyuqBZpKnNXl3VP59FuVSKaucbS6gpbpRoeCVJq5J2oRqS40s56lpf31ZPWx1xlavrqXqxFPF1PdcldvUl/ovjeFtffyF5W181X93X35hXCVuGLZ0vjrw6bHrh+swvT6CsefXWZZee4SHml3rGUjZKor2S1FWJ/s1hS8LzMG16nmfheZbNNqwv5/eRElc/366/edrbb55xXVKvHnb7Ezdx+xM38Sh/87oqxc5P1S3XRQtMadOwYX1t+br1kftMTVveE9v5amhpy3tea3x+a1veM0Xi+SqQ9OOd8t/lr/3t3emH70Y70eXGebMTmxGX1i+RZuRl5RJlRp27tBEaxi4qM3TsojYjzl3SjDx3KTPq3KWNsDB2MZmhYxezGXHukmbkuUuZUecubURcLEvf42JZRiTqjMWyNCPGGYtFFk3MnsWzeraZKXiKp3qaZ/R0X+qHtZQ8Fc/q2Wbm4Cme6mme0TN5ui9333IWuXq2mSV4iqd6mmf0TJ7Z032ljnKUNqL62VY/2+pnW/1sq59t9bOtXr3q1ateverVa+5ri69/Y2rqaZ7RM3lmz+JZPdtMCQEQwAsowYAIJCADBaiA90UkAAJgFq+lSAQSkIECVMA7JBoAARTArPOqlD4iI72wogWogNdWLAACKGBABBKA2bzGYhWgypEqR6ocFTAgAgnIAOZIlSNVTlQ5UeVElRP9S/Qv0T+GSpgqYawkUeVMlTNVzlQ5U+VM/zL9y/SP+RIGTJgw6SPWe9JHbCRVLlS5UOVClQtVLvSv0L9C/xg2YdqEcZNKlStVrlS5UuVKlSv9q/Sv0T/mThg8YfKkUeVGlRtVblS5UeXm/dMQAAEUMCACXmUNGShABbzKKgEQQAEDIoC5z1/rWTy9yipeZdUACKCAARFIQAYKgFm9ymoBEEABAyKQgAwUoALd3B+JY/7Gc1OA/iTsz84+fxMikIAMFKACzaHP3wQBMCfMCXPCnDAnzAlzwpwxZ8wZc8acMWfMGXPGnDFnzAVzwVwwF8wFc5/AUbE+gRMwF8wFc8VcMVfMFXPFXDnmyjFXzBVzxdwwN8wNc8PcMDfMDXPD3DA3N1sIgAAKGBCBBGSgABXALH7VmQiAWTALZsEsmAWzYBbMyjErx6yY+wyOz+ozOAGzYlbMilkxG2bDbJiNYzaO2TAbZsNsmA1zxBwxM4PGDBozaMygMYPGDBozaMygMYPGDBozaMygMYPGDBozaGMGrUM395feMYMdxgyOd2MBlE0GRDYloJtzhwJUNjWHMYN9+ZjBAcomA6Iv7zM4IbOpABxz4ZjHDJYO3dw6KGBABBKQgQJUoDmMGRyAuWFumBvmhrlhbpgb5ubmGAIggAIGRCABGShABTALZsEsmAWzYBbMglkwC2bBrJgVs2JWzIpZMStmxayYFfOYwf7l9uv+dLf/cDx8mb+xfXq+v331k9vTf49s4Ue5x9PD7eHj8+nQv4KObcuX0v8B", + "debug_symbols": "tZndbttIDEbfxde5GJLzu6+yWBRu6hYBjCRwkwKLou++mhke1y0gNyu3V99JpDmWSFGS4a+7D4f3r5/ePTx+fPq8++vvr7v3p4fj8eHTu+PT/f7l4elx+e/Xb3c7/nz3cjocln/tLrYvq573p8Pjy+6vx9fj8W73ZX98HTt9ft4/jnzZn5at4W53ePyw5CL8+HA8dPp29311WF8qufhiKXJent68XqX5etW4Zb3y+Wo3fv629VFYH8uW9TmzvuiG9VZYb7VuWB/NfH20Lccfc2V9aZvW07/YbG29XBGU0uhAqZLPCms/KuTKNRxywtF5XaJXTqSYnisR01khuvE4Sgirx/HWeqitKa61JJxP5KKeP7ckrwuaRZra7OKq/vksyrVSVDvfWEJNcaNEw4UkrUrauiTJ+WSSJFnr69vqaasjrnJzPVWvliJe1nNdYjdf4r84jrf19ReSt/VV8819/R/zKmHLsKVzSfPqsOmV6zN/fwJlzau3Lrv2DA8xf69nLGWjJNqFpK5K9E8OWxKeh2nT8zwLz7NstmF9Ob+PlLj6+Xb7zdPefvOM65J687Db77iJ2++4iUf5k9dVKXZ+qm65LlpgSpuGDetry7etj3Szpi3viS3yntzSlve81vj81ra8Z4rE81Ug6cc75T/LX/v7h9MP3412osuN824nNiMuV8gSaUZeVi5RZtS5SxuhYeyiMkPHLmoz4twlzchzlzKjzl3aCAtjF5MZOnYxmxHnLmlGnruUGXXu0kbExbL0PS6W5fqNOmOxLM2IccZikUUTs2fxrJ5tZgqe4qme5hk93Zf6YS0lT8WzeraZOXiKp3qaZ/RMnu7L3becRa6ebWYJnuKpnuYZPZNn9nRfqaMcpY2ofrbVz7b62VY/2+pnW/1sq1evevWqV6969Zr72uLr35iaeppn9Eye2bN4Vs82U0IABPACSjAgAgnIQAEq4H0RCYAAmMVrKRKBBGSgABXwDokGQAAFMOu8KqWPyEgvrGgBKuC1FQuAAAoYEIEEYDavsVgFqHKkypEqRwUMiEACMoA5UuVIlRNVTlQ5UeVE/xL9S/SPoRKmShgrSVQ5U+VMlTNVzlQ5079M/zL9Y76EARMmTPqI9Z70ERtJlQtVLlS5UOVClQv9K/Sv0D+GTZg2YdykUuVKlStVrlS5UuVK/yr9a/SPuRMGT5g8aVS5UeVGlRtVblS5ef80BEAABQyIgFdZQwYKUAGvskoABFDAgAhg7vPXehZPr7KKV1k1AAIoYEAEEpCBAmBWr7JaAARQwIAIJCADBahAN/dH4pi/8dwUoD8J+7Ozz9+ECCQgAwWoQHPo8zdBAMwJc8KcMCfMCXPCnDBnzBlzxpwxZ8wZc8acMWfMGXPBXDAXzAVzwdwncFSsT+AEzAVzwVwxV8wVc8VcMVeOuXLMFXPFXDE3zA1zw9wwN8wNc8PcMDfMzc0WAiCAAgZEIAEZKEAFMItfdSYCYBbMglkwC2bBLJgFs3LMyjEr5j6D47P6DE7ArJgVs2JWzIbZMBtm45iNYzbMhtkwG2bDHDFHzMygMYPGDBozaMygMYPGDBozaMygMYPGDBozaMygMYPGDNqYQevQzf2ld8xghzGD491YAGWTAZFNCejm3KEAlU3NYcxgXz5mcICyyYDoy/sMTshsKgDHXDjmMYOlQze3DgoYEIEEZKAAFWgOYwYHYG6YG+aGuWFumBvmhrm5OYYACKCAARFIQAYKUAHMglkwC2bBLJgFs2AWzIJZMCtmxayYFbNiVsyKWTErZsU8ZrB/uf2yPz3s3x8Pn+dvbB9fH+8vfnJ7+feZLfwo93x6uj98eD0d+lfQsW35Uvof", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index 0a082758f1e..e91ac6f45a6 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -510,10 +510,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tZndbttIDEbfxde5GJLz21dZLAo3dYsARhK4SYFF0XdfzQyPkxaQm8rt1XcSaY4lUpRk+Nvu4+HD8+f3d/efHr7s3v3zbffhdHc83n1+f3y43T/dPdwv//32/WbHn++fTofD8q/dq+3Lqsf96XD/tHt3/3w83uy+7o/PY6cvj/v7kU/707I13OwO9x+XXISf7o6HTt9vXlaH9aWSiy+WIufl6c3rVZqvV41b1iufr3bl529bH4X1sWxZnzPri25Yb4X1VuuG9dHM10fbcvwxV9aXtmk9/YvN1tbLBUEpjQ6UKvmssPajQi5cwyEnHJ3XJXqpEZEraenJSytFNx5HCWH1ON5aD7U1xaWWBKUlr+r5c0vyuqBZpKnNXl3VP59FuVSKaucbS6gpbpRoeCVJq5J2oRqS40s56lpf31ZPWx1xlavrqXqxFPF1PdcldvUl/ovjeFtffyF5W181X93X35hXCVuGLZ0vjrw6bHrh+swvT6CsefXWZZee4SHml3rGUjZKor2S1FWJ/s1hS8LzMG16nmfheZbNNqwv5/eRElc/366/edrbb55xXVKvHnb7Ezdx+xM38Sh/87oqxc5P1S3XRQtMadOwYX1t+br1kftMTVveE9v5amhpy3tea3x+a1veM0Xi+SqQ9OOd8t/lr/3t3emH70Y70eXGebMTmxGX1i+RZuRl5RJlRp27tBEaxi4qM3TsojYjzl3SjDx3KTPq3KWNsDB2MZmhYxezGXHukmbkuUuZUecubURcLEvf42JZRiTqjMWyNCPGGYtFFk3MnsWzeraZKXiKp3qaZ/R0X+qHtZQ8Fc/q2Wbm4Cme6mme0TN5ui9333IWuXq2mSV4iqd6mmf0TJ7Z032ljnKUNqL62VY/2+pnW/1sq59t9bOtXr3q1ateverVa+5ri69/Y2rqaZ7RM3lmz+JZPdtMCQEQwAsowYAIJCADBaiA90UkAAJgFq+lSAQSkIECVMA7JBoAARTArPOqlD4iI72wogWogNdWLAACKGBABBKA2bzGYhWgypEqR6ocFTAgAgnIAOZIlSNVTlQ5UeVElRP9S/Qv0T+GSpgqYawkUeVMlTNVzlQ5U+VM/zL9y/SP+RIGTJgw6SPWe9JHbCRVLlS5UOVClQtVLvSv0L9C/xg2YdqEcZNKlStVrlS5UuVKlSv9q/Sv0T/mThg8YfKkUeVGlRtVblS5UeXm/dMQAAEUMCACXmUNGShABbzKKgEQQAEDIoC5z1/rWTy9yipeZdUACKCAARFIQAYKgFm9ymoBEEABAyKQgAwUoALd3B+JY/7Gc1OA/iTsz84+fxMikIAMFKACzaHP3wQBMCfMCXPCnDAnzAlzwpwxZ8wZc8acMWfMGXPGnDFnzAVzwVwwF8wFc5/AUbE+gRMwF8wFc8VcMVfMFXPFXDnmyjFXzBVzxdwwN8wNc8PcMDfMDXPD3DA3N1sIgAAKGBCBBGSgABXALH7VmQiAWTALZsEsmAWzYBbMyjErx6yY+wyOz+ozOAGzYlbMilkxG2bDbJiNYzaO2TAbZsNsmA1zxBwxM4PGDBozaMygMYPGDBozaMygMYPGDBozaMygMYPGDBozaGMGrUM395feMYMdxgyOd2MBlE0GRDYloJtzhwJUNjWHMYN9+ZjBAcomA6Iv7zM4IbOpABxz4ZjHDJYO3dw6KGBABBKQgQJUoDmMGRyAuWFumBvmhrlhbpgb5ubmGAIggAIGRCABGShABTALZsEsmAWzYBbMglkwC2bBrJgVs2JWzIpZMStmxayYFfOYwf7l9uv+dLf/cDx8mb+xfXq+v331k9vTf49s4Ue5x9PD7eHj8+nQv4KObcuX0v8B", + "debug_symbols": "tZndbttIDEbfxde5GJLzu6+yWBRu6hYBjCRwkwKLou++mhke1y0gNyu3V99JpDmWSFGS4a+7D4f3r5/ePTx+fPq8++vvr7v3p4fj8eHTu+PT/f7l4elx+e/Xb3c7/nz3cjocln/tLrYvq573p8Pjy+6vx9fj8W73ZX98HTt9ft4/jnzZn5at4W53ePyw5CL8+HA8dPp29311WF8qufhiKXJent68XqX5etW4Zb3y+Wo3fv629VFYH8uW9TmzvuiG9VZYb7VuWB/NfH20Lccfc2V9aZvW07/YbG29XBGU0uhAqZLPCms/KuTKNRxywtF5XaJXTqSYnisR01khuvE4Sgirx/HWeqitKa61JJxP5KKeP7ckrwuaRZra7OKq/vksyrVSVDvfWEJNcaNEw4UkrUrauiTJ+WSSJFnr69vqaasjrnJzPVWvliJe1nNdYjdf4r84jrf19ReSt/VV8819/R/zKmHLsKVzSfPqsOmV6zN/fwJlzau3Lrv2DA8xf69nLGWjJNqFpK5K9E8OWxKeh2nT8zwLz7NstmF9Ob+PlLj6+Xb7zdPefvOM65J687Db77iJ2++4iUf5k9dVKXZ+qm65LlpgSpuGDetry7etj3Szpi3viS3yntzSlve81vj81ra8Z4rE81Ug6cc75T/LX/v7h9MP3412osuN824nNiMuV8gSaUZeVi5RZtS5SxuhYeyiMkPHLmoz4twlzchzlzKjzl3aCAtjF5MZOnYxmxHnLmlGnruUGXXu0kbExbL0PS6W5fqNOmOxLM2IccZikUUTs2fxrJ5tZgqe4qme5hk93Zf6YS0lT8WzeraZOXiKp3qaZ/RMnu7L3becRa6ebWYJnuKpnuYZPZNn9nRfqaMcpY2ofrbVz7b62VY/2+pnW/1sq1evevWqV6969Zr72uLr35iaeppn9Eye2bN4Vs82U0IABPACSjAgAgnIQAEq4H0RCYAAmMVrKRKBBGSgABXwDokGQAAFMOu8KqWPyEgvrGgBKuC1FQuAAAoYEIEEYDavsVgFqHKkypEqRwUMiEACMoA5UuVIlRNVTlQ5UeVE/xL9S/SPoRKmShgrSVQ5U+VMlTNVzlQ5079M/zL9Y76EARMmTPqI9Z70ERtJlQtVLlS5UOVClQv9K/Sv0D+GTZg2YdykUuVKlStVrlS5UuVK/yr9a/SPuRMGT5g8aVS5UeVGlRtVblS5ef80BEAABQyIgFdZQwYKUAGvskoABFDAgAhg7vPXehZPr7KKV1k1AAIoYEAEEpCBAmBWr7JaAARQwIAIJCADBahAN/dH4pi/8dwUoD8J+7Ozz9+ECCQgAwWoQHPo8zdBAMwJc8KcMCfMCXPCnDBnzBlzxpwxZ8wZc8acMWfMGXPBXDAXzAVzwdwncFSsT+AEzAVzwVwxV8wVc8VcMVeOuXLMFXPFXDE3zA1zw9wwN8wNc8PcMDfMzc0WAiCAAgZEIAEZKEAFMItfdSYCYBbMglkwC2bBLJgFs3LMyjEr5j6D47P6DE7ArJgVs2JWzIbZMBtm45iNYzbMhtkwG2bDHDFHzMygMYPGDBozaMygMYPGDBozaMygMYPGDBozaMygMYPGDNqYQevQzf2ld8xghzGD491YAGWTAZFNCejm3KEAlU3NYcxgXz5mcICyyYDoy/sMTshsKgDHXDjmMYOlQze3DgoYEIEEZKAAFWgOYwYHYG6YG+aGuWFumBvmhrm5OYYACKCAARFIQAYKUAHMglkwC2bBLJgFs2AWzIJZMCtmxayYFbNiVsyKWTErZsU8ZrB/uf2yPz3s3x8Pn+dvbB9fH+8vfnJ7+feZLfwo93x6uj98eD0d+lfQsW35Uvof", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 20914a50c34..602e4414c2b 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -90,10 +90,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 12 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(5), offset_address: Relative(6) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Cast { destination: Direct(32839), source: Direct(32839), bit_size: Integer(U32) }, Cast { destination: Direct(32840), source: Direct(32840), bit_size: Integer(U32) }, Cast { destination: Direct(32841), source: Direct(32841), bit_size: Integer(U32) }, Cast { destination: Direct(32842), source: Direct(32842), bit_size: Integer(U32) }, Cast { destination: Direct(32843), source: Direct(32843), bit_size: Integer(U32) }, Cast { destination: Direct(32844), source: Direct(32844), bit_size: Integer(U32) }, Cast { destination: Direct(32845), source: Direct(32845), bit_size: Integer(U32) }, Cast { destination: Direct(32846), source: Direct(32846), bit_size: Integer(U32) }, Cast { destination: Direct(32847), source: Direct(32847), bit_size: Integer(U32) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(1) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(1), source: Relative(5) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32841 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(2) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(2), source: Relative(5) }, Mov { destination: Relative(3), source: Direct(32846) }, Mov { destination: Relative(4), source: Direct(32847) }, Call { location: 60 }, Call { location: 61 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 59 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 52 }, Return, Return, Call { location: 338 }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(7) }, Load { destination: Relative(8), source_pointer: Relative(9) }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 1 }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 72 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(3), location: 310 }, Jump { location: 75 }, Load { destination: Relative(5), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(9) }, JumpIf { condition: Relative(11), location: 80 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, Const { destination: Relative(5), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(12), location: 85 }, Call { location: 344 }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 88 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 274 }, Jump { location: 91 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3814912846 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(13), location: 97 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(11), bit_size: Field, value: 2 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 102 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(13), location: 231 }, Jump { location: 105 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 41472 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(13), location: 111 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 115 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(12) }, JumpIf { condition: Relative(8), location: 177 }, Jump { location: 118 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 11539 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 124 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(8) } }, Load { destination: Relative(4), source_pointer: Relative(1) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, Not { destination: Relative(6), source: Relative(6), bit_size: U1 }, JumpIf { condition: Relative(6), location: 130 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(4) }, Load { destination: Relative(4), source_pointer: Relative(2) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U32, lhs: Relative(6), rhs: Relative(4) }, Not { destination: Relative(8), source: Relative(8), bit_size: U1 }, JumpIf { condition: Relative(8), location: 138 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(4) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 0 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(5), location: 147 }, Jump { location: 146 }, Return, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(3) }, Load { destination: Relative(6), source_pointer: Relative(11) }, Load { destination: Relative(8), source_pointer: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(8) }, Not { destination: Relative(12), source: Relative(12), bit_size: U1 }, JumpIf { condition: Relative(12), location: 156 }, Call { location: 347 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(8) }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 160 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(8), location: 166 }, Jump { location: 163 }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(5) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, Load { destination: Relative(8), source_pointer: Relative(12) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(8), rhs: Relative(6) }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(4) }, JumpIf { condition: Relative(8), location: 174 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(8) }, Jump { location: 160 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(13), source_pointer: Relative(15) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(13), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 192 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(13) }, JumpIf { condition: Relative(18), location: 192 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(15) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 196 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(13) }, Mov { destination: Relative(8), source: Relative(9) }, Jump { location: 199 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(8), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 205 }, Jump { location: 202 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(8) }, Jump { location: 115 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 210 }, Call { location: 344 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(7) }, JumpIf { condition: Relative(14), location: 213 }, Call { location: 353 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(13) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(13) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(13), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 223 }, Call { location: 356 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(15), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, JumpIf { condition: Relative(15), location: 227 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(10) }, Mov { destination: Relative(8), source: Relative(11) }, Jump { location: 199 }, Load { destination: Relative(14), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(3) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(3) }, Load { destination: Relative(16), source_pointer: Relative(18) }, BinaryIntOp { destination: Relative(17), op: Mul, bit_size: U32, lhs: Relative(15), rhs: Relative(16) }, Const { destination: Relative(19), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(16) }, JumpIf { condition: Relative(18), location: 246 }, BinaryIntOp { destination: Relative(21), op: Div, bit_size: U32, lhs: Relative(17), rhs: Relative(16) }, BinaryIntOp { destination: Relative(20), op: Equals, bit_size: U32, lhs: Relative(21), rhs: Relative(15) }, JumpIf { condition: Relative(20), location: 246 }, Call { location: 350 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(17) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, JumpIf { condition: Relative(16), location: 250 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(15) }, Cast { destination: Relative(14), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Add, lhs: Relative(14), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(14), op: Sub, lhs: Relative(15), rhs: Relative(11) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(15), source: Relative(16), bit_size: Field }, Mov { destination: Relative(13), source: Relative(9) }, Jump { location: 258 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 264 }, Jump { location: 261 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(13) }, Jump { location: 102 }, Load { destination: Relative(14), source_pointer: Relative(6) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Mul, lhs: Relative(16), rhs: Relative(15) }, Cast { destination: Relative(17), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(16), source: Relative(17), bit_size: Field }, Cast { destination: Relative(14), source: Relative(16), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(10) }, Mov { destination: Relative(13), source: Relative(14) }, Jump { location: 258 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Cast { destination: Relative(12), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Mul, lhs: Relative(12), rhs: Relative(12) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(11), source_pointer: Relative(15) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Mul, lhs: Relative(13), rhs: Relative(14) }, Cast { destination: Relative(14), source: Relative(15), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 297 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(11) }, JumpIf { condition: Relative(18), location: 297 }, Call { location: 350 }, Cast { destination: Relative(11), source: Relative(15), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Add, lhs: Relative(11), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(11), op: Sub, lhs: Relative(14), rhs: Relative(13) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Add, lhs: Relative(12), rhs: Relative(13) }, Cast { destination: Relative(13), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(13), bit_size: Field }, Cast { destination: Relative(11), source: Relative(12), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(11) }, Jump { location: 88 }, Load { destination: Relative(3), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U32, lhs: Relative(3), rhs: Relative(3) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 319 }, BinaryIntOp { destination: Relative(15), op: Div, bit_size: U32, lhs: Relative(11), rhs: Relative(3) }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, JumpIf { condition: Relative(14), location: 319 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(5) }, Load { destination: Relative(12), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(13), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 330 }, BinaryIntOp { destination: Relative(17), op: Div, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(11) }, JumpIf { condition: Relative(16), location: 330 }, Call { location: 350 }, BinaryIntOp { destination: Relative(11), op: Sub, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 334 }, Call { location: 356 }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(3) }, Jump { location: 72 }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 343 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 7233212735005103307 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 14225679739041873922 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 2920182694213909827 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZnRbts8DIXfxde9kESJkvoqw1CkbToECNIia3/gR9F3H4/l42QDnGVyezN+acQjWqQozXkfHrf3bz/udoen55/D7bf34f642+93P+72zw+b193zwf76Pjj8o3G49TeDpma0mTyaHIbbYMa+EzP2XTSTmynN1NEU00pmfDOhGWkmNmMOejNUG5LN2JBiRpqJzaRmtBmbqN4M3tlQ7wCI0QMQZQBkQiHUCbwj2IReAHCPAAxOAAy2mHxwBE8IBCFgoTIgEZSQCYVQJxBH8AQoF4AQIiERlJAJhVAniHSPHBM5JnJMwuxYw+QJgSCESEgEJeQJlDpqXgG5UI7ReUwh1GlMdgRPCATq5EjIU3ZQWAFZRmmNgOJqAB3kFAXWQAjQQZZLIighEwqhTlAdwROgjDBQmQ0iIRGUAB0rpDCW6AiJf8EYBWRCIdQJUKINPCEQMHsGREIiQLkAMqEQoGwpCKjnBp4QCDKFOtbzCImghEyYdkoYq9cBTEdGEEIkoE14gBIywXQkAOoE0RE8IRCEEAmJAGUBZEIh1AlQ8w2gjBVDzQvWBzUvWATUfETMqPkGaGcIVX1rMgGNUSIAY0ZAA8RqoOYjlFHzDeoEqPnRPVMnt/YX0EXT+AeTSXgalHyCMEq+gckkDB776QiegJ6K2FHyipBR8godlHwDU1Y8Okq+QSGYsmIKlHwDTwgEIURCIigByljLCmXEg02QLR5xppw9wBNMOQvAlHMCREIi6HgeCPYJ7LgpYCGigEAQQiQkghIyoRAQHoSxJxp4ApQLQAiRkAhKyIRCqBOgx+MpsUlGGyYrk42TRRl/fNwMPIXvXo/bLQ7hs2PZDuuXzXF7eB1uD2/7/c3w32b/Ng76+bI5jPZ1c7Rvbcm3h0ezJvi0229BHzcnb7fsak17crbWPLunq/2Dk8k/uNjjj53W/GPu8Velfw4d/pLpL6X0+CsXX7Rn/SK2/+gfVTv8k2f8SXrmT4Xxp9KTP3WMX510+OfA+suxJ/6cWX+59MxfXJn8i++pnyJcv9K1/qUyfzW4Dv8aK/1T7fGvzF+tPfvPbtncwIY9K2i38rkF2X28SyG6WSH17KISGUJJXVnEkT35l5Xz9/mHdf5zFyil5/nrfApUV7r8/ezfVcU+rNtFp/m7/DXMXTBolz93sYqsm7/P35d1/vMpqnUxf7hBL7fxuY3k4k9LKPV3iXSpE2k6tSJNyyJ66Tow91O7GZzamZ0NfXFk59Y/TPbLItcuapAliUt5TXNe0+LpgP/aLG4smTtblbML2h8hoH0tL0WR+YBw1ukWRWR1Xv8hjhQ7Hya4M5G0KHKhSKNXHjeGZelhLt0651tb9Iv9Kpb1ea2fkNfk1ue1fkZe6yfkNcmX5lV4Dkfpuc2d1YUs3uWSrq6LlC8uZTzPx7JIWV0Xf4njurr4i8h1daH+S+sC71eaQO65X0UtK/25krEu3i80rb4fqH7C/UDz6rq6Po4L94N/EFm+H1y9qMv3g3zp3jm/vrGL7+KK5osnYtTTDok5d4pEORMpiyLxK7dZ8CwOe6Xe8zJrfhkSul4mnM3/h/93+7R52B1/+9XvA0rH3eZ+v50+Pr0dHs6+ff3/hd/wV8OX4/PD9vHtuIXS6adDe735zXZGqt/xw5t9EHvLLlHw0eOjHRqSyvcPhPIL", + "debug_symbols": "tZnRThs9EIXfJde5sD322OZVKoQChCpSFFAKv/QL8e6ds96zSZE2Tb1w0/lCPMeznvHY3byvHrf3bz/vdoen51+rmx/vq/vjbr/f/bzbPz9sXnfPB/vr+8rhH42rG79eaWpGm8mDyWF1E8zYd2LGvotmcjOlmTqYYlrJjG8mNCPNxGbMQderakOyGRtSzEgzsZnUjDZjE9X1yjsb6h0AMXoAogyATCiEOoJ3BJvQCwDuEYDBCYDBFpMPjuAJgSAELFQGJIISMqEQ6gjiCJ4A5QIQQiQkghIyoRDqCJHukWMix0SOSZgda5g8IRCEEAmJoIQ8glJHzSsgF8oxOo0phDqOyY7gCYFAnRwJecwOCisgyyitAVBcDaCDnKLAGggBOshySQQlZEIh1BGqI3gClBEGKrNBJCSCEqBjhRSGEh0g8S8Yo4BMKIQ6Akq0gScEAmbPgEhIBCgXQCYUApQtBQH13MATAkHGUId6HiARlJAJ404JQ/U6gOnIAEKIBLQJD1BCJpiOBEAdITqCJwSCECIhEaAsgEwohDoCar4BlLFiqHnB+qDmBYuAmo+IGTXfAO0MoapvTSagMUoEYMwAaIBYDdR8hDJqvkEdATU/uGfq5Nb+ArpoGv5gMglPg5JPEEbJNzCZhMFDPx3AE9BTETtKXhEySl6hg5JvYMqKR0fJNygEU1ZMgZJv4AmBIIRISAQlQBlrWaGMeLAJssUjzpSzB3iCKWcBmHJOgEhIBB3OA8E+gR02BSxEFBAIQoiERFBCJhQCwoMw9kQDT4ByAQghEhJBCZlQCHUE9Hg8JTbJYMNoZbRxtCjjj4/1iqfw3etxu8UhfHYs22H9sjluD6+rm8Pbfr9e/bfZvw2Dfr1sDoN93RztW1vy7eHRrAk+7fZb0Mf65O3mXa1pj87Wmif3dLV/cDL6Bxd7/LHTmn/MPf6q9M+hw18y/aWUHn/l4ov2rF/E9h/8o2qHf/KMP0nP/Kkw/lR68qeO8auTDv8cWH859sSfM+svl575iyujf/E99VOE61e61r9U5q8G1+FfY6V/qj3+lfmrtWf/2S2bG9iwZwXtVj61ILuPdylENymknl1UIkMoqSuLOLJH/7Jw/j7/sMx/6gKl9Dx/nU6B6kqXv5/8u6rYh2W76DR/l7+GqQsG7fLnLlaRZfP3+fuyzH86RbXO5g836Pk2PrWRXPxpCaX+KZEudSJNp1akaV5ELxzHWabzOMc0SdjZ0BdHdm75w2Q/L3LtogaZk7iU1zTlNc2eDvivzezGkqmzVTm7oH0KAe1rfimKTAeEs043KyKL8/oPcaTY+TDBnYmkWRG9dOebFjX5s/Pq08NcunVOt7boZ/tVLMvzWr8gr8ktz2v9irzWL8hrkm/Nq/AcjtJzmzurC5m9yyVdXBcpX1zKeJ6PeZGyuC7+Esd1dfEXkevqQv231gXer4yr0XO/iloW+vMBYp29X2hafD9Q/YL7gebFdXV9HBfuB/8gMn8/uHpR5+8H+dK9c3p9Yxff2RXNF0/EqKcdEnPuFIlyJlJmReJ3brPgeY23V+o9L7OmlyGh62XC2fyf/G/t0+Zhd/zjV78PKB13m/v9dvz49HZ4OPv29f8XfsNfDV+Ozw/bx7fjFkqnnw7t9eYPOx9TvcUPb/ZB7C27RMFHj492aEgqtx8I5Tc=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_0.snap index 20914a50c34..602e4414c2b 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_0.snap @@ -90,10 +90,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 12 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(5), offset_address: Relative(6) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Cast { destination: Direct(32839), source: Direct(32839), bit_size: Integer(U32) }, Cast { destination: Direct(32840), source: Direct(32840), bit_size: Integer(U32) }, Cast { destination: Direct(32841), source: Direct(32841), bit_size: Integer(U32) }, Cast { destination: Direct(32842), source: Direct(32842), bit_size: Integer(U32) }, Cast { destination: Direct(32843), source: Direct(32843), bit_size: Integer(U32) }, Cast { destination: Direct(32844), source: Direct(32844), bit_size: Integer(U32) }, Cast { destination: Direct(32845), source: Direct(32845), bit_size: Integer(U32) }, Cast { destination: Direct(32846), source: Direct(32846), bit_size: Integer(U32) }, Cast { destination: Direct(32847), source: Direct(32847), bit_size: Integer(U32) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(1) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(1), source: Relative(5) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32841 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(2) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(2), source: Relative(5) }, Mov { destination: Relative(3), source: Direct(32846) }, Mov { destination: Relative(4), source: Direct(32847) }, Call { location: 60 }, Call { location: 61 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 59 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 52 }, Return, Return, Call { location: 338 }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(7) }, Load { destination: Relative(8), source_pointer: Relative(9) }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 1 }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 72 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(3), location: 310 }, Jump { location: 75 }, Load { destination: Relative(5), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(9) }, JumpIf { condition: Relative(11), location: 80 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, Const { destination: Relative(5), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(12), location: 85 }, Call { location: 344 }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 88 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 274 }, Jump { location: 91 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3814912846 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(13), location: 97 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(11), bit_size: Field, value: 2 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 102 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(13), location: 231 }, Jump { location: 105 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 41472 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(13), location: 111 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 115 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(12) }, JumpIf { condition: Relative(8), location: 177 }, Jump { location: 118 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 11539 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 124 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(8) } }, Load { destination: Relative(4), source_pointer: Relative(1) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, Not { destination: Relative(6), source: Relative(6), bit_size: U1 }, JumpIf { condition: Relative(6), location: 130 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(4) }, Load { destination: Relative(4), source_pointer: Relative(2) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U32, lhs: Relative(6), rhs: Relative(4) }, Not { destination: Relative(8), source: Relative(8), bit_size: U1 }, JumpIf { condition: Relative(8), location: 138 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(4) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 0 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(5), location: 147 }, Jump { location: 146 }, Return, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(3) }, Load { destination: Relative(6), source_pointer: Relative(11) }, Load { destination: Relative(8), source_pointer: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(8) }, Not { destination: Relative(12), source: Relative(12), bit_size: U1 }, JumpIf { condition: Relative(12), location: 156 }, Call { location: 347 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(8) }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 160 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(8), location: 166 }, Jump { location: 163 }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(5) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, Load { destination: Relative(8), source_pointer: Relative(12) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(8), rhs: Relative(6) }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(4) }, JumpIf { condition: Relative(8), location: 174 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(8) }, Jump { location: 160 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(13), source_pointer: Relative(15) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(13), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 192 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(13) }, JumpIf { condition: Relative(18), location: 192 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(15) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 196 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(13) }, Mov { destination: Relative(8), source: Relative(9) }, Jump { location: 199 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(8), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 205 }, Jump { location: 202 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(8) }, Jump { location: 115 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 210 }, Call { location: 344 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(7) }, JumpIf { condition: Relative(14), location: 213 }, Call { location: 353 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(13) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(13) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(13), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 223 }, Call { location: 356 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(15), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, JumpIf { condition: Relative(15), location: 227 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(10) }, Mov { destination: Relative(8), source: Relative(11) }, Jump { location: 199 }, Load { destination: Relative(14), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(3) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(3) }, Load { destination: Relative(16), source_pointer: Relative(18) }, BinaryIntOp { destination: Relative(17), op: Mul, bit_size: U32, lhs: Relative(15), rhs: Relative(16) }, Const { destination: Relative(19), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(16) }, JumpIf { condition: Relative(18), location: 246 }, BinaryIntOp { destination: Relative(21), op: Div, bit_size: U32, lhs: Relative(17), rhs: Relative(16) }, BinaryIntOp { destination: Relative(20), op: Equals, bit_size: U32, lhs: Relative(21), rhs: Relative(15) }, JumpIf { condition: Relative(20), location: 246 }, Call { location: 350 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(17) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, JumpIf { condition: Relative(16), location: 250 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(15) }, Cast { destination: Relative(14), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Add, lhs: Relative(14), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(14), op: Sub, lhs: Relative(15), rhs: Relative(11) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(15), source: Relative(16), bit_size: Field }, Mov { destination: Relative(13), source: Relative(9) }, Jump { location: 258 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 264 }, Jump { location: 261 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(13) }, Jump { location: 102 }, Load { destination: Relative(14), source_pointer: Relative(6) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Mul, lhs: Relative(16), rhs: Relative(15) }, Cast { destination: Relative(17), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(16), source: Relative(17), bit_size: Field }, Cast { destination: Relative(14), source: Relative(16), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(10) }, Mov { destination: Relative(13), source: Relative(14) }, Jump { location: 258 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Cast { destination: Relative(12), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Mul, lhs: Relative(12), rhs: Relative(12) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(11), source_pointer: Relative(15) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Mul, lhs: Relative(13), rhs: Relative(14) }, Cast { destination: Relative(14), source: Relative(15), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 297 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(11) }, JumpIf { condition: Relative(18), location: 297 }, Call { location: 350 }, Cast { destination: Relative(11), source: Relative(15), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Add, lhs: Relative(11), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(11), op: Sub, lhs: Relative(14), rhs: Relative(13) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Add, lhs: Relative(12), rhs: Relative(13) }, Cast { destination: Relative(13), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(13), bit_size: Field }, Cast { destination: Relative(11), source: Relative(12), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(11) }, Jump { location: 88 }, Load { destination: Relative(3), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U32, lhs: Relative(3), rhs: Relative(3) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 319 }, BinaryIntOp { destination: Relative(15), op: Div, bit_size: U32, lhs: Relative(11), rhs: Relative(3) }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, JumpIf { condition: Relative(14), location: 319 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(5) }, Load { destination: Relative(12), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(13), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 330 }, BinaryIntOp { destination: Relative(17), op: Div, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(11) }, JumpIf { condition: Relative(16), location: 330 }, Call { location: 350 }, BinaryIntOp { destination: Relative(11), op: Sub, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 334 }, Call { location: 356 }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(3) }, Jump { location: 72 }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 343 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 7233212735005103307 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 14225679739041873922 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 2920182694213909827 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZnRbts8DIXfxde9kESJkvoqw1CkbToECNIia3/gR9F3H4/l42QDnGVyezN+acQjWqQozXkfHrf3bz/udoen55/D7bf34f642+93P+72zw+b193zwf76Pjj8o3G49TeDpma0mTyaHIbbYMa+EzP2XTSTmynN1NEU00pmfDOhGWkmNmMOejNUG5LN2JBiRpqJzaRmtBmbqN4M3tlQ7wCI0QMQZQBkQiHUCbwj2IReAHCPAAxOAAy2mHxwBE8IBCFgoTIgEZSQCYVQJxBH8AQoF4AQIiERlJAJhVAniHSPHBM5JnJMwuxYw+QJgSCESEgEJeQJlDpqXgG5UI7ReUwh1GlMdgRPCATq5EjIU3ZQWAFZRmmNgOJqAB3kFAXWQAjQQZZLIighEwqhTlAdwROgjDBQmQ0iIRGUAB0rpDCW6AiJf8EYBWRCIdQJUKINPCEQMHsGREIiQLkAMqEQoGwpCKjnBp4QCDKFOtbzCImghEyYdkoYq9cBTEdGEEIkoE14gBIywXQkAOoE0RE8IRCEEAmJAGUBZEIh1AlQ8w2gjBVDzQvWBzUvWATUfETMqPkGaGcIVX1rMgGNUSIAY0ZAA8RqoOYjlFHzDeoEqPnRPVMnt/YX0EXT+AeTSXgalHyCMEq+gckkDB776QiegJ6K2FHyipBR8godlHwDU1Y8Okq+QSGYsmIKlHwDTwgEIURCIigByljLCmXEg02QLR5xppw9wBNMOQvAlHMCREIi6HgeCPYJ7LgpYCGigEAQQiQkghIyoRAQHoSxJxp4ApQLQAiRkAhKyIRCqBOgx+MpsUlGGyYrk42TRRl/fNwMPIXvXo/bLQ7hs2PZDuuXzXF7eB1uD2/7/c3w32b/Ng76+bI5jPZ1c7Rvbcm3h0ezJvi0229BHzcnb7fsak17crbWPLunq/2Dk8k/uNjjj53W/GPu8Velfw4d/pLpL6X0+CsXX7Rn/SK2/+gfVTv8k2f8SXrmT4Xxp9KTP3WMX510+OfA+suxJ/6cWX+59MxfXJn8i++pnyJcv9K1/qUyfzW4Dv8aK/1T7fGvzF+tPfvPbtncwIY9K2i38rkF2X28SyG6WSH17KISGUJJXVnEkT35l5Xz9/mHdf5zFyil5/nrfApUV7r8/ezfVcU+rNtFp/m7/DXMXTBolz93sYqsm7/P35d1/vMpqnUxf7hBL7fxuY3k4k9LKPV3iXSpE2k6tSJNyyJ66Tow91O7GZzamZ0NfXFk59Y/TPbLItcuapAliUt5TXNe0+LpgP/aLG4smTtblbML2h8hoH0tL0WR+YBw1ukWRWR1Xv8hjhQ7Hya4M5G0KHKhSKNXHjeGZelhLt0651tb9Iv9Kpb1ea2fkNfk1ue1fkZe6yfkNcmX5lV4Dkfpuc2d1YUs3uWSrq6LlC8uZTzPx7JIWV0Xf4njurr4i8h1daH+S+sC71eaQO65X0UtK/25krEu3i80rb4fqH7C/UDz6rq6Po4L94N/EFm+H1y9qMv3g3zp3jm/vrGL7+KK5osnYtTTDok5d4pEORMpiyLxK7dZ8CwOe6Xe8zJrfhkSul4mnM3/h/93+7R52B1/+9XvA0rH3eZ+v50+Pr0dHs6+ff3/hd/wV8OX4/PD9vHtuIXS6adDe735zXZGqt/xw5t9EHvLLlHw0eOjHRqSyvcPhPIL", + "debug_symbols": "tZnRThs9EIXfJde5sD322OZVKoQChCpSFFAKv/QL8e6ds96zSZE2Tb1w0/lCPMeznvHY3byvHrf3bz/vdoen51+rmx/vq/vjbr/f/bzbPz9sXnfPB/vr+8rhH42rG79eaWpGm8mDyWF1E8zYd2LGvotmcjOlmTqYYlrJjG8mNCPNxGbMQderakOyGRtSzEgzsZnUjDZjE9X1yjsb6h0AMXoAogyATCiEOoJ3BJvQCwDuEYDBCYDBFpMPjuAJgSAELFQGJIISMqEQ6gjiCJ4A5QIQQiQkghIyoRDqCJHukWMix0SOSZgda5g8IRCEEAmJoIQ8glJHzSsgF8oxOo0phDqOyY7gCYFAnRwJecwOCisgyyitAVBcDaCDnKLAGggBOshySQQlZEIh1BGqI3gClBEGKrNBJCSCEqBjhRSGEh0g8S8Yo4BMKIQ6Akq0gScEAmbPgEhIBCgXQCYUApQtBQH13MATAkHGUId6HiARlJAJ404JQ/U6gOnIAEKIBLQJD1BCJpiOBEAdITqCJwSCECIhEaAsgEwohDoCar4BlLFiqHnB+qDmBYuAmo+IGTXfAO0MoapvTSagMUoEYMwAaIBYDdR8hDJqvkEdATU/uGfq5Nb+ArpoGv5gMglPg5JPEEbJNzCZhMFDPx3AE9BTETtKXhEySl6hg5JvYMqKR0fJNygEU1ZMgZJv4AmBIIRISAQlQBlrWaGMeLAJssUjzpSzB3iCKWcBmHJOgEhIBB3OA8E+gR02BSxEFBAIQoiERFBCJhQCwoMw9kQDT4ByAQghEhJBCZlQCHUE9Hg8JTbJYMNoZbRxtCjjj4/1iqfw3etxu8UhfHYs22H9sjluD6+rm8Pbfr9e/bfZvw2Dfr1sDoN93RztW1vy7eHRrAk+7fZb0Mf65O3mXa1pj87Wmif3dLV/cDL6Bxd7/LHTmn/MPf6q9M+hw18y/aWUHn/l4ov2rF/E9h/8o2qHf/KMP0nP/Kkw/lR68qeO8auTDv8cWH859sSfM+svl575iyujf/E99VOE61e61r9U5q8G1+FfY6V/qj3+lfmrtWf/2S2bG9iwZwXtVj61ILuPdylENymknl1UIkMoqSuLOLJH/7Jw/j7/sMx/6gKl9Dx/nU6B6kqXv5/8u6rYh2W76DR/l7+GqQsG7fLnLlaRZfP3+fuyzH86RbXO5g836Pk2PrWRXPxpCaX+KZEudSJNp1akaV5ELxzHWabzOMc0SdjZ0BdHdm75w2Q/L3LtogaZk7iU1zTlNc2eDvivzezGkqmzVTm7oH0KAe1rfimKTAeEs043KyKL8/oPcaTY+TDBnYmkWRG9dOebFjX5s/Pq08NcunVOt7boZ/tVLMvzWr8gr8ktz2v9irzWL8hrkm/Nq/AcjtJzmzurC5m9yyVdXBcpX1zKeJ6PeZGyuC7+Esd1dfEXkevqQv231gXer4yr0XO/iloW+vMBYp29X2hafD9Q/YL7gebFdXV9HBfuB/8gMn8/uHpR5+8H+dK9c3p9Yxff2RXNF0/EqKcdEnPuFIlyJlJmReJ3brPgeY23V+o9L7OmlyGh62XC2fyf/G/t0+Zhd/zjV78PKB13m/v9dvz49HZ4OPv29f8XfsNfDV+Ozw/bx7fjFkqnnw7t9eYPOx9TvcUPb/ZB7C27RMFHj492aEgqtx8I5Tc=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 20914a50c34..602e4414c2b 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/a_6_array/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -90,10 +90,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 12 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(5), offset_address: Relative(6) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Cast { destination: Direct(32839), source: Direct(32839), bit_size: Integer(U32) }, Cast { destination: Direct(32840), source: Direct(32840), bit_size: Integer(U32) }, Cast { destination: Direct(32841), source: Direct(32841), bit_size: Integer(U32) }, Cast { destination: Direct(32842), source: Direct(32842), bit_size: Integer(U32) }, Cast { destination: Direct(32843), source: Direct(32843), bit_size: Integer(U32) }, Cast { destination: Direct(32844), source: Direct(32844), bit_size: Integer(U32) }, Cast { destination: Direct(32845), source: Direct(32845), bit_size: Integer(U32) }, Cast { destination: Direct(32846), source: Direct(32846), bit_size: Integer(U32) }, Cast { destination: Direct(32847), source: Direct(32847), bit_size: Integer(U32) }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32836 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(1) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(1), source: Relative(5) }, Const { destination: Relative(2), bit_size: Integer(U32), value: 32841 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 5 }, Mov { destination: Relative(5), source: Direct(1) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 6 }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Relative(7) }, IndirectConst { destination_pointer: Relative(5), bit_size: Integer(U32), value: 1 }, BinaryIntOp { destination: Relative(7), op: Add, bit_size: U32, lhs: Relative(5), rhs: Direct(2) }, Mov { destination: Direct(32771), source: Relative(2) }, Mov { destination: Direct(32772), source: Relative(7) }, Mov { destination: Direct(32773), source: Relative(6) }, Call { location: 49 }, Mov { destination: Relative(2), source: Relative(5) }, Mov { destination: Relative(3), source: Direct(32846) }, Mov { destination: Relative(4), source: Direct(32847) }, Call { location: 60 }, Call { location: 61 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32848 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, BinaryIntOp { destination: Direct(32775), op: Add, bit_size: U32, lhs: Direct(32771), rhs: Direct(32773) }, Mov { destination: Direct(32776), source: Direct(32771) }, Mov { destination: Direct(32777), source: Direct(32772) }, BinaryIntOp { destination: Direct(32778), op: Equals, bit_size: U32, lhs: Direct(32776), rhs: Direct(32775) }, JumpIf { condition: Direct(32778), location: 59 }, Load { destination: Direct(32774), source_pointer: Direct(32776) }, Store { destination_pointer: Direct(32777), source: Direct(32774) }, BinaryIntOp { destination: Direct(32776), op: Add, bit_size: U32, lhs: Direct(32776), rhs: Direct(2) }, BinaryIntOp { destination: Direct(32777), op: Add, bit_size: U32, lhs: Direct(32777), rhs: Direct(2) }, Jump { location: 52 }, Return, Return, Call { location: 338 }, Mov { destination: Relative(6), source: Direct(1) }, BinaryIntOp { destination: Direct(1), op: Add, bit_size: U32, lhs: Direct(1), rhs: Direct(2) }, Const { destination: Relative(7), bit_size: Integer(U32), value: 5 }, BinaryIntOp { destination: Relative(9), op: Add, bit_size: U32, lhs: Relative(2), rhs: Relative(7) }, Load { destination: Relative(8), source_pointer: Relative(9) }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(9), bit_size: Integer(U32), value: 0 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 1 }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 72 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(3), location: 310 }, Jump { location: 75 }, Load { destination: Relative(5), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(9) }, JumpIf { condition: Relative(11), location: 80 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, Const { destination: Relative(5), bit_size: Integer(U32), value: 2 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(12), location: 85 }, Call { location: 344 }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 88 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 274 }, Jump { location: 91 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3814912846 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(13), location: 97 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(11), bit_size: Field, value: 2 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 3 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 102 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(13), location: 231 }, Jump { location: 105 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 41472 }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(11) }, JumpIf { condition: Relative(13), location: 111 }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(14) } }, Store { destination_pointer: Relative(6), source: Relative(8) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 1 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 115 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(12) }, JumpIf { condition: Relative(8), location: 177 }, Jump { location: 118 }, Load { destination: Relative(4), source_pointer: Relative(6) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 11539 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(5) }, JumpIf { condition: Relative(6), location: 124 }, Const { destination: Relative(8), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(8) } }, Load { destination: Relative(4), source_pointer: Relative(1) }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(6), op: Equals, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, Not { destination: Relative(6), source: Relative(6), bit_size: U1 }, JumpIf { condition: Relative(6), location: 130 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(4) }, Load { destination: Relative(4), source_pointer: Relative(2) }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U32, lhs: Relative(6), rhs: Relative(4) }, Not { destination: Relative(8), source: Relative(8), bit_size: U1 }, JumpIf { condition: Relative(8), location: 138 }, Call { location: 347 }, BinaryIntOp { destination: Relative(4), op: Add, bit_size: U32, lhs: Relative(4), rhs: Direct(2) }, Store { destination_pointer: Relative(2), source: Relative(4) }, Const { destination: Relative(4), bit_size: Integer(U1), value: 0 }, Mov { destination: Relative(3), source: Relative(9) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(3), rhs: Relative(7) }, JumpIf { condition: Relative(5), location: 147 }, Jump { location: 146 }, Return, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(3) }, Load { destination: Relative(6), source_pointer: Relative(11) }, Load { destination: Relative(8), source_pointer: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(8) }, Not { destination: Relative(12), source: Relative(12), bit_size: U1 }, JumpIf { condition: Relative(12), location: 156 }, Call { location: 347 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(8), rhs: Direct(2) }, Store { destination_pointer: Relative(1), source: Relative(8) }, Mov { destination: Relative(5), source: Relative(9) }, Jump { location: 160 }, BinaryIntOp { destination: Relative(8), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(8), location: 166 }, Jump { location: 163 }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(5) }, Jump { location: 143 }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(12), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, Load { destination: Relative(8), source_pointer: Relative(12) }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(8), rhs: Relative(6) }, BinaryIntOp { destination: Relative(8), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(4) }, JumpIf { condition: Relative(8), location: 174 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(8) }, Jump { location: 160 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(13), source_pointer: Relative(15) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(13), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 192 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(13) }, JumpIf { condition: Relative(18), location: 192 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(15) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 196 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(13) }, Mov { destination: Relative(8), source: Relative(9) }, Jump { location: 199 }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(8), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 205 }, Jump { location: 202 }, BinaryIntOp { destination: Relative(8), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(8) }, Jump { location: 115 }, Load { destination: Relative(11), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, BinaryIntOp { destination: Relative(14), op: LessThanEquals, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, JumpIf { condition: Relative(14), location: 210 }, Call { location: 344 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(7) }, JumpIf { condition: Relative(14), location: 213 }, Call { location: 353 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(13) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(13) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(13), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 223 }, Call { location: 356 }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(15), op: LessThanEquals, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, JumpIf { condition: Relative(15), location: 227 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(8), rhs: Relative(10) }, Mov { destination: Relative(8), source: Relative(11) }, Jump { location: 199 }, Load { destination: Relative(14), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(16), rhs: Relative(3) }, Load { destination: Relative(15), source_pointer: Relative(17) }, BinaryIntOp { destination: Relative(17), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(18), op: Add, bit_size: U32, lhs: Relative(17), rhs: Relative(3) }, Load { destination: Relative(16), source_pointer: Relative(18) }, BinaryIntOp { destination: Relative(17), op: Mul, bit_size: U32, lhs: Relative(15), rhs: Relative(16) }, Const { destination: Relative(19), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(16) }, JumpIf { condition: Relative(18), location: 246 }, BinaryIntOp { destination: Relative(21), op: Div, bit_size: U32, lhs: Relative(17), rhs: Relative(16) }, BinaryIntOp { destination: Relative(20), op: Equals, bit_size: U32, lhs: Relative(21), rhs: Relative(15) }, JumpIf { condition: Relative(20), location: 246 }, Call { location: 350 }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(17) }, BinaryIntOp { destination: Relative(16), op: LessThanEquals, bit_size: U32, lhs: Relative(14), rhs: Relative(15) }, JumpIf { condition: Relative(16), location: 250 }, Call { location: 344 }, Store { destination_pointer: Relative(6), source: Relative(15) }, Cast { destination: Relative(14), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Add, lhs: Relative(14), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(14), op: Sub, lhs: Relative(15), rhs: Relative(11) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(15), source: Relative(16), bit_size: Field }, Mov { destination: Relative(13), source: Relative(9) }, Jump { location: 258 }, BinaryIntOp { destination: Relative(14), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 264 }, Jump { location: 261 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(13) }, Jump { location: 102 }, Load { destination: Relative(14), source_pointer: Relative(6) }, Cast { destination: Relative(16), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Mul, lhs: Relative(16), rhs: Relative(15) }, Cast { destination: Relative(17), source: Relative(14), bit_size: Integer(U32) }, Cast { destination: Relative(16), source: Relative(17), bit_size: Field }, Cast { destination: Relative(14), source: Relative(16), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(14) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(10) }, Mov { destination: Relative(13), source: Relative(14) }, Jump { location: 258 }, Load { destination: Relative(11), source_pointer: Relative(6) }, Cast { destination: Relative(12), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Mul, lhs: Relative(12), rhs: Relative(12) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(1), rhs: Direct(2) }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(14), rhs: Relative(3) }, Load { destination: Relative(11), source_pointer: Relative(15) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Field }, BinaryFieldOp { destination: Relative(15), op: Mul, lhs: Relative(13), rhs: Relative(14) }, Cast { destination: Relative(14), source: Relative(15), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryIntOp { destination: Relative(15), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(16), op: Add, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, Load { destination: Relative(14), source_pointer: Relative(16) }, BinaryIntOp { destination: Relative(15), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(14) }, Const { destination: Relative(17), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(14) }, JumpIf { condition: Relative(16), location: 297 }, BinaryIntOp { destination: Relative(19), op: Div, bit_size: U32, lhs: Relative(15), rhs: Relative(14) }, BinaryIntOp { destination: Relative(18), op: Equals, bit_size: U32, lhs: Relative(19), rhs: Relative(11) }, JumpIf { condition: Relative(18), location: 297 }, Call { location: 350 }, Cast { destination: Relative(11), source: Relative(15), bit_size: Field }, BinaryFieldOp { destination: Relative(14), op: Add, lhs: Relative(11), rhs: Relative(4) }, BinaryFieldOp { destination: Relative(11), op: Sub, lhs: Relative(14), rhs: Relative(13) }, Cast { destination: Relative(14), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(14), bit_size: Field }, BinaryFieldOp { destination: Relative(11), op: Add, lhs: Relative(12), rhs: Relative(13) }, Cast { destination: Relative(13), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(13), bit_size: Field }, Cast { destination: Relative(11), source: Relative(12), bit_size: Integer(U32) }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(11), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(10) }, Mov { destination: Relative(3), source: Relative(11) }, Jump { location: 88 }, Load { destination: Relative(3), source_pointer: Relative(6) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U32, lhs: Relative(3), rhs: Relative(3) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 319 }, BinaryIntOp { destination: Relative(15), op: Div, bit_size: U32, lhs: Relative(11), rhs: Relative(3) }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(3) }, JumpIf { condition: Relative(14), location: 319 }, Call { location: 350 }, BinaryIntOp { destination: Relative(13), op: Add, bit_size: U32, lhs: Relative(2), rhs: Direct(2) }, BinaryIntOp { destination: Relative(14), op: Add, bit_size: U32, lhs: Relative(13), rhs: Relative(5) }, Load { destination: Relative(12), source_pointer: Relative(14) }, BinaryIntOp { destination: Relative(13), op: Mul, bit_size: U32, lhs: Relative(11), rhs: Relative(12) }, Const { destination: Relative(15), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Equals, bit_size: U32, lhs: Relative(15), rhs: Relative(12) }, JumpIf { condition: Relative(14), location: 330 }, BinaryIntOp { destination: Relative(17), op: Div, bit_size: U32, lhs: Relative(13), rhs: Relative(12) }, BinaryIntOp { destination: Relative(16), op: Equals, bit_size: U32, lhs: Relative(17), rhs: Relative(11) }, JumpIf { condition: Relative(16), location: 330 }, Call { location: 350 }, BinaryIntOp { destination: Relative(11), op: Sub, bit_size: U32, lhs: Relative(3), rhs: Relative(13) }, BinaryIntOp { destination: Relative(12), op: LessThanEquals, bit_size: U32, lhs: Relative(13), rhs: Relative(3) }, JumpIf { condition: Relative(12), location: 334 }, Call { location: 356 }, Store { destination_pointer: Relative(6), source: Relative(11) }, BinaryIntOp { destination: Relative(3), op: Add, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, Mov { destination: Relative(5), source: Relative(3) }, Jump { location: 72 }, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 343 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 12049594436772143978 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 7233212735005103307 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 14225679739041873922 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 2920182694213909827 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZnRbts8DIXfxde9kESJkvoqw1CkbToECNIia3/gR9F3H4/l42QDnGVyezN+acQjWqQozXkfHrf3bz/udoen55/D7bf34f642+93P+72zw+b193zwf76Pjj8o3G49TeDpma0mTyaHIbbYMa+EzP2XTSTmynN1NEU00pmfDOhGWkmNmMOejNUG5LN2JBiRpqJzaRmtBmbqN4M3tlQ7wCI0QMQZQBkQiHUCbwj2IReAHCPAAxOAAy2mHxwBE8IBCFgoTIgEZSQCYVQJxBH8AQoF4AQIiERlJAJhVAniHSPHBM5JnJMwuxYw+QJgSCESEgEJeQJlDpqXgG5UI7ReUwh1GlMdgRPCATq5EjIU3ZQWAFZRmmNgOJqAB3kFAXWQAjQQZZLIighEwqhTlAdwROgjDBQmQ0iIRGUAB0rpDCW6AiJf8EYBWRCIdQJUKINPCEQMHsGREIiQLkAMqEQoGwpCKjnBp4QCDKFOtbzCImghEyYdkoYq9cBTEdGEEIkoE14gBIywXQkAOoE0RE8IRCEEAmJAGUBZEIh1AlQ8w2gjBVDzQvWBzUvWATUfETMqPkGaGcIVX1rMgGNUSIAY0ZAA8RqoOYjlFHzDeoEqPnRPVMnt/YX0EXT+AeTSXgalHyCMEq+gckkDB776QiegJ6K2FHyipBR8godlHwDU1Y8Okq+QSGYsmIKlHwDTwgEIURCIigByljLCmXEg02QLR5xppw9wBNMOQvAlHMCREIi6HgeCPYJ7LgpYCGigEAQQiQkghIyoRAQHoSxJxp4ApQLQAiRkAhKyIRCqBOgx+MpsUlGGyYrk42TRRl/fNwMPIXvXo/bLQ7hs2PZDuuXzXF7eB1uD2/7/c3w32b/Ng76+bI5jPZ1c7Rvbcm3h0ezJvi0229BHzcnb7fsak17crbWPLunq/2Dk8k/uNjjj53W/GPu8Velfw4d/pLpL6X0+CsXX7Rn/SK2/+gfVTv8k2f8SXrmT4Xxp9KTP3WMX510+OfA+suxJ/6cWX+59MxfXJn8i++pnyJcv9K1/qUyfzW4Dv8aK/1T7fGvzF+tPfvPbtncwIY9K2i38rkF2X28SyG6WSH17KISGUJJXVnEkT35l5Xz9/mHdf5zFyil5/nrfApUV7r8/ezfVcU+rNtFp/m7/DXMXTBolz93sYqsm7/P35d1/vMpqnUxf7hBL7fxuY3k4k9LKPV3iXSpE2k6tSJNyyJ66Tow91O7GZzamZ0NfXFk59Y/TPbLItcuapAliUt5TXNe0+LpgP/aLG4smTtblbML2h8hoH0tL0WR+YBw1ukWRWR1Xv8hjhQ7Hya4M5G0KHKhSKNXHjeGZelhLt0651tb9Iv9Kpb1ea2fkNfk1ue1fkZe6yfkNcmX5lV4Dkfpuc2d1YUs3uWSrq6LlC8uZTzPx7JIWV0Xf4njurr4i8h1daH+S+sC71eaQO65X0UtK/25krEu3i80rb4fqH7C/UDz6rq6Po4L94N/EFm+H1y9qMv3g3zp3jm/vrGL7+KK5osnYtTTDok5d4pEORMpiyLxK7dZ8CwOe6Xe8zJrfhkSul4mnM3/h/93+7R52B1/+9XvA0rH3eZ+v50+Pr0dHs6+ff3/hd/wV8OX4/PD9vHtuIXS6adDe735zXZGqt/xw5t9EHvLLlHw0eOjHRqSyvcPhPIL", + "debug_symbols": "tZnRThs9EIXfJde5sD322OZVKoQChCpSFFAKv/QL8e6ds96zSZE2Tb1w0/lCPMeznvHY3byvHrf3bz/vdoen51+rmx/vq/vjbr/f/bzbPz9sXnfPB/vr+8rhH42rG79eaWpGm8mDyWF1E8zYd2LGvotmcjOlmTqYYlrJjG8mNCPNxGbMQderakOyGRtSzEgzsZnUjDZjE9X1yjsb6h0AMXoAogyATCiEOoJ3BJvQCwDuEYDBCYDBFpMPjuAJgSAELFQGJIISMqEQ6gjiCJ4A5QIQQiQkghIyoRDqCJHukWMix0SOSZgda5g8IRCEEAmJoIQ8glJHzSsgF8oxOo0phDqOyY7gCYFAnRwJecwOCisgyyitAVBcDaCDnKLAGggBOshySQQlZEIh1BGqI3gClBEGKrNBJCSCEqBjhRSGEh0g8S8Yo4BMKIQ6Akq0gScEAmbPgEhIBCgXQCYUApQtBQH13MATAkHGUId6HiARlJAJ404JQ/U6gOnIAEKIBLQJD1BCJpiOBEAdITqCJwSCECIhEaAsgEwohDoCar4BlLFiqHnB+qDmBYuAmo+IGTXfAO0MoapvTSagMUoEYMwAaIBYDdR8hDJqvkEdATU/uGfq5Nb+ArpoGv5gMglPg5JPEEbJNzCZhMFDPx3AE9BTETtKXhEySl6hg5JvYMqKR0fJNygEU1ZMgZJv4AmBIIRISAQlQBlrWaGMeLAJssUjzpSzB3iCKWcBmHJOgEhIBB3OA8E+gR02BSxEFBAIQoiERFBCJhQCwoMw9kQDT4ByAQghEhJBCZlQCHUE9Hg8JTbJYMNoZbRxtCjjj4/1iqfw3etxu8UhfHYs22H9sjluD6+rm8Pbfr9e/bfZvw2Dfr1sDoN93RztW1vy7eHRrAk+7fZb0Mf65O3mXa1pj87Wmif3dLV/cDL6Bxd7/LHTmn/MPf6q9M+hw18y/aWUHn/l4ov2rF/E9h/8o2qHf/KMP0nP/Kkw/lR68qeO8auTDv8cWH859sSfM+svl575iyujf/E99VOE61e61r9U5q8G1+FfY6V/qj3+lfmrtWf/2S2bG9iwZwXtVj61ILuPdylENymknl1UIkMoqSuLOLJH/7Jw/j7/sMx/6gKl9Dx/nU6B6kqXv5/8u6rYh2W76DR/l7+GqQsG7fLnLlaRZfP3+fuyzH86RbXO5g836Pk2PrWRXPxpCaX+KZEudSJNp1akaV5ELxzHWabzOMc0SdjZ0BdHdm75w2Q/L3LtogaZk7iU1zTlNc2eDvivzezGkqmzVTm7oH0KAe1rfimKTAeEs043KyKL8/oPcaTY+TDBnYmkWRG9dOebFjX5s/Pq08NcunVOt7boZ/tVLMvzWr8gr8ktz2v9irzWL8hrkm/Nq/AcjtJzmzurC5m9yyVdXBcpX1zKeJ6PeZGyuC7+Esd1dfEXkevqQv231gXer4yr0XO/iloW+vMBYp29X2hafD9Q/YL7gebFdXV9HBfuB/8gMn8/uHpR5+8H+dK9c3p9Yxff2RXNF0/EqKcdEnPuFIlyJlJmReJ3brPgeY23V+o9L7OmlyGh62XC2fyf/G/t0+Zhd/zjV78PKB13m/v9dvz49HZ4OPv29f8XfsNfDV+Ozw/bx7fjFkqnnw7t9eYPOx9TvcUPb/ZB7C27RMFHj492aEgqtx8I5Tc=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { 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 502d6371692..9a982e0ee41 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_3793: u32 = i / 2_u32; - result[i_3793] = + let i_3826: u32 = i / 2_u32; + result[i_3826] = (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 ed044c2c9f8..8575fe82c2e 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_3780: u32 = x + i; - a2[i_3780] = 128_Field; + let i_3813: u32 = x + i; + a2[i_3813] = 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 d3b629cb4fb..06545c1c8fa 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_3794: u32 = j + a; - hash_input[i_3794] = current[j]; + let i_3827: u32 = j + a; + hash_input[i_3827] = current[j]; }; { - let i_3795: u32 = j + b; - hash_input[i_3795] = path[offset + j]; + let i_3828: u32 = j + b; + hash_input[i_3828] = 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 46d27e8fb90..67fb150b951 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_3779: u32 = y - 1_u32; - x[i_3779].bar.inner = [106_u8, 107_u8, 10_u8]; + let i_3812: u32 = y - 1_u32; + x[i_3812].bar.inner = [106_u8, 107_u8, 10_u8]; }; let mut hash_input: [u8; 3] = x[y - 1_u32].bar.inner; { - let i_3781: u32 = y - 1_u32; - hash_input[i_3781] = 0_u8; + let i_3814: u32 = y - 1_u32; + hash_input[i_3814] = 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 0d9623cdac3..201759621fe 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_3791: u32 = index + 1_u32; - modified[i_3791] = 27_Field; + let i_3824: u32 = index + 1_u32; + modified[i_3824] = 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_3794: u32 = index + 1_u32; - modified[i_3794] = 27_Field; + let i_3827: u32 = index + 1_u32; + modified[i_3827] = 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 faa3b6658a6..976a5b93d0c 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_3803: u32 = offset + j; - tx_effects_hash_inputs[i_3803] = new_note_hashes[j]; + let i_3836: u32 = offset + j; + tx_effects_hash_inputs[i_3836] = new_note_hashes[j]; } } offset = offset + MAX_NOTE_HASHES_PER_TX; for j in 0_u32..MAX_NULLIFIERS_PER_TX { { - let i_3805: u32 = offset + j; - tx_effects_hash_inputs[i_3805] = new_nullifiers[j]; + let i_3838: u32 = offset + j; + tx_effects_hash_inputs[i_3838] = new_nullifiers[j]; } } offset = offset + MAX_NULLIFIERS_PER_TX; for j in 0_u32..MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX { { - let i_3807: u32 = offset + (j * 2_u32); - tx_effects_hash_inputs[i_3807] = public_data_update_requests[j].leaf_slot; + let i_3840: u32 = offset + (j * 2_u32); + tx_effects_hash_inputs[i_3840] = public_data_update_requests[j].leaf_slot; }; { - let i_3808: u32 = (offset + (j * 2_u32)) + 1_u32; - tx_effects_hash_inputs[i_3808] = public_data_update_requests[j].new_value; + let i_3841: u32 = (offset + (j * 2_u32)) + 1_u32; + tx_effects_hash_inputs[i_3841] = 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_3810: u32 = offset + j; - tx_effects_hash_inputs[i_3810] = l2ToL1Msgs[j]; + let i_3843: u32 = offset + j; + tx_effects_hash_inputs[i_3843] = 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_3813: u32 = offset + 1_u32; - tx_effects_hash_inputs[i_3813] = new_contracts[0_u32].portal_contract_address; + let i_3846: u32 = offset + 1_u32; + tx_effects_hash_inputs[i_3846] = 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_3815: u32 = offset + j; - tx_effects_hash_inputs[i_3815] = encryptedLogsHash[j]; + let i_3848: u32 = offset + j; + tx_effects_hash_inputs[i_3848] = 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_3817: u32 = offset + j; - tx_effects_hash_inputs[i_3817] = unencryptedLogsHash[j]; + let i_3850: u32 = offset + j; + tx_effects_hash_inputs[i_3850] = 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_3822: u32 = (offset * 32_u32) + byte_index; - hash_input_flattened[i_3822] = input_as_bytes[byte_index]; + let i_3855: u32 = (offset * 32_u32) + byte_index; + hash_input_flattened[i_3855] = 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_3826: u32 = ( + let i_3859: u32 = ( (TX_EFFECT_HASH_FULL_FIELDS * 32_u32) + (log_field_index * 16_u32) ) + byte_index; - hash_input_flattened[i_3826] = input_as_bytes[byte_index]; + hash_input_flattened[i_3859] = 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 c1aac492159..883ea927eaa 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_3792: u32 = i + j; - data[i_3792] = c[(4_u32 - 1_u32) - j]; + let i_3825: u32 = i + j; + data[i_3825] = 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 5a9cc61c4ae..19f9013ea21 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_3782: u32 = x[3_u32]; - result[i_3782] = z[x[3_u32]]; + let i_3815: u32 = x[3_u32]; + result[i_3815] = 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 c6d6ba0ddf4..dc8141c7a23 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_3795: u32 = offset + i; - encrypted_bytes[i_3795] = eph_pk_bytes[i]; + let i_3828: u32 = offset + i; + encrypted_bytes[i_3828] = eph_pk_bytes[i]; } } offset = offset + EPH_PK_SIZE; for i in 0_u32..HEADER_SIZE { { - let i_3797: u32 = offset + i; - encrypted_bytes[i_3797] = incoming_header_ciphertext[i]; + let i_3830: u32 = offset + i; + encrypted_bytes[i_3830] = 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_3800: u32 = offset + i; - encrypted_bytes[i_3800] = incoming_body_ciphertext[i]; + let i_3833: u32 = offset + i; + encrypted_bytes[i_3833] = 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 30ce9b6c60c..2143ebab75e 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_3778: u32 = y - 1_u32; - x[i_3778].b = [50_Field, 51_Field, 52_Field]; + let i_3811: u32 = y - 1_u32; + x[i_3811].b = [50_Field, 51_Field, 52_Field]; } } else { { - let i_3779: u32 = y - 1_u32; - x[i_3779].b = [100_Field, 101_Field, 102_Field]; + let i_3812: u32 = y - 1_u32; + x[i_3812].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_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]; + let i_3816: u32 = y - 2_u32; + let i_3817: u32 = y - 2_u32; + foo_parents[i_3816].foos[i_3817].b = [10_Field, 9_Field, 8_Field]; } } else { { - 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]; + let i_3818: u32 = y - 2_u32; + let i_3819: u32 = y - 2_u32; + foo_parents[i_3818].foos[i_3819].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_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] = 5000_Field; + let i_3820: u32 = y - 2_u32; + let i_3821: u32 = y - 2_u32; + let i_3822: u32 = y - 1_u32; + foo_parents[i_3820].foos[i_3821].b[i_3822] = 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; + let i_3823: u32 = y - 2_u32; + let i_3824: u32 = y - 2_u32; + let i_3825: u32 = y - 1_u32; + foo_parents[i_3823].foos[i_3824].b[i_3825] = 1000_Field; } }; assert(foo_parents[1_u32].foos[1_u32].b[2_u32] == 5000_Field); { - 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; + let i_3826: u32 = y - 2_u32; + let i_3827: u32 = y - 3_u32; + foo_parents[i_3826].foos[i_3827].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 569057eeb48..7381831cd26 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_3782: u32 = y - 2_u32; - x[i_3782].a = 50_Field; + let i_3815: u32 = y - 2_u32; + x[i_3815].a = 50_Field; } } else { { - let i_3783: u32 = y - 2_u32; - x[i_3783].a = 100_Field; + let i_3816: u32 = y - 2_u32; + x[i_3816].a = 100_Field; } }; assert(x[y - 2_u32].a == 50_Field); if y == 2_u32 { { - let i_3784: u32 = y - 1_u32; - x[i_3784].b = [50_Field, 51_Field, 52_Field]; + let i_3817: u32 = y - 1_u32; + x[i_3817].b = [50_Field, 51_Field, 52_Field]; } } else { { - let i_3785: u32 = y - 1_u32; - x[i_3785].b = [100_Field, 101_Field, 102_Field]; + let i_3818: u32 = y - 1_u32; + x[i_3818].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 217d1389967..20bc25ee9ab 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_3793: u32 = (offset * 32_u32) + byte_index; - hash_input_flattened[i_3793] = input_as_bytes[byte_index]; + let i_3826: u32 = (offset * 32_u32) + byte_index; + hash_input_flattened[i_3826] = 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 7092f305c0e..f7d6c3ae963 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_3804: u32 = (2_u32 * i) - 1_u32; - nibble[i_3804] = U4::from_u8(x >> 4_u8); + let i_3837: u32 = (2_u32 * i) - 1_u32; + nibble[i_3837] = U4::from_u8(x >> 4_u8); }; { - let i_3805: u32 = 2_u32 * i; - nibble[i_3805] = U4::from_u8(x & 15_u8); + let i_3838: u32 = 2_u32 * i; + nibble[i_3838] = 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_3808: u32 = 2_u32 * i; - nibble[i_3808] = U4::from_u8(x >> 4_u8); + let i_3841: u32 = 2_u32 * i; + nibble[i_3841] = U4::from_u8(x >> 4_u8); }; { - let i_3809: u32 = (2_u32 * i) + 1_u32; - nibble[i_3809] = U4::from_u8(x & 15_u8); + let i_3842: u32 = (2_u32 * i) + 1_u32; + nibble[i_3842] = 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 e0c263504ba..6d1439a38a5 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_3798: u32 = self.len; - self.storage[i_3798] = elem; + let i_3831: u32 = self.len; + self.storage[i_3831] = 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 5e63ec4c284..b3bf1c51261 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_3798: u32 = self.len; - self.storage[i_3798] = elem; + let i_3831: u32 = self.len; + self.storage[i_3831] = 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 09ecd73c799..750ffb7b276 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_3780: u32 = (expected - 10_Field) as u32; - hasher_slice[i_3780] = 100_Field; + let i_3813: u32 = (expected - 10_Field) as u32; + hasher_slice[i_3813] = 100_Field; } } else { { - let i_3781: u32 = expected as u32; - hasher_slice[i_3781] = 100_Field; + let i_3814: u32 = expected as u32; + hasher_slice[i_3814] = 100_Field; } }; assert(hasher_slice[0_u32] == expected); diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index 00e5bd35a29..57ce594ebbd 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -260,7 +260,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tdhNTuNAEAXgu3idRVdV/85VRiMUwKBIURKZBGmEuPt0u+qFsHBk2czG70GoD2PKGOWje+4fL68Pu8PL8a379fujexx2+/3u9WF/fNqed8dD/ezH56bDhw/noe/rp7qb1+vUaTv0h3P363DZ7zfd+3Z/Gb/o7bQ9jHneDvVVt+n6w3PNCr7s9n1rn5uvaTc9SgXDVMJ1PCyYZ+cWzLNkzIfJ7y/T89mXZEAORFdByjfBTwspFTIhZYpTQrhzDVxygqtYe54y4rQhyRcjJEW+CsTzzyIG+joLcmuvBcuUMPf3wZNX4t5GpOtGTG8k0eqVIF69EyQ/sBTkV2/F/fOYuRazr8f0Xsz+rSxaDCEshsj0YpTVi8Fu9WIw/cBiMK9ejPvnMXMxZl+PO4tR/utiXH8OubkU859Bt/NpyXy+zhdeOb/k+3vCvGdeNy+yZD56zGdaOR8XzAfCAt3uz6L5unS383/qR9un3fDtv7ZO6kJvOj8ew3iM4zGNxzwey3gkp0EarKHzpACpQEqQGqQIqcKqsCqsCqvCqrAqrAqrwqqwKqKKqCJVqX9fpCr13hSvETSiRtLIGmUM7zRIgzVU8e1c6qX0wTJaJstsWTSDsyRLthRL80Jo/x3WjJbJMlsWzegsyZItxdJbmhebV/2YLLNl0UzOkizZUiy9ZbA0L5mXzEvmZfOyedm8bF42L5uXzcvmZfOyeaV59ZlYmlevf2FLsfSWwTJaJstsWTTJORRCYRRB8SgBJaIklIwCmSATZIJMkAlyuyXEtRLbU7+VhJJRipV2c2ghFEYRFI8SUCAzZIbMkAWyQBbIAlkgC2SBLJAFskD2kD1kD9lD9pDb3STcSpOllYSSUYqVdktpIRRGERSPElAgB8gBcoAcIUfIEXKEHCFHyBFyhBwhR8gJcoKcICfICXK718S30uTQSkLJKMVKu+G0EAqjCIpHCSiQM+QMOUMukAvkArlALpAL5AK5QC6Qi8nsHAqhMIqgeJQmt0fm+3bYbR/3vb2r8HI5PN28yXD+e8IreBviNByf+ufL0LdH2/hafdj9Aw==", + "debug_symbols": "tdhNTuNAEAXgu3idRVdV/85VRiMUwKBIVhKZBGmEuPt0u+qFsHAU2czG70GoD2PKGOWje+4fz68Pu/3L4a379fujexx3w7B7fRgOT9vT7rCvn/343HT48OE09n39VHf1ep06bsd+f+p+7c/DsOnet8N5+qK343Y/5Wk71lfdpuv3zzUr+LIb+tY+N1/Tbn6UCoaphMt4WDDPzi2YZ8mYD7PfX+bnsy/JgByILoKUb4KfF1IqZELKFOeEcOMauOQEV7H2PGfEecMnYSN88l9Xgvj+s4iBvs6C3NprwTIn3Pv74NkrcWsj0mUj5jeSaPVKEK/eCZIfWAryq7fi9nncuRZ3X4/5vbj7t7JoMYSwGCLzi1FWLwa71YvB9AOLwbx6MW6fx52Lcff1uLEY5b8uxuXnkMgLnkHX82nJfL7MF145v+T7e8K8Z143L7JkPnrMZ1o5HxfMB8ICXe/Povm6dNfzf+pH26fd+O2/tk7qQm86Px3DdIzTMU3HPB3LdCSnQRqsofOkAKlASpAapAipwqqwKqwKq8KqsCqsCqvCqrAqooqoIlWpf0GkKvXeFK8RNKJG0sgaZQrvNEiDNVTx7VzqpfTBMlomy2xZNIOzJEu2FEvzQmj/HdaMlskyWxbN6CzJki3F0luaF5tX/Zgss2XRTM6SLNlSLL1lsDQvmZfMS+Zl87J52bxsXjYvm5fNy+Zl87J5pXn1mViaV69/YUux9JbBMlomy2xZNMk5FEJhFEHxKAEloiSUjAKZIBNkgkyQCXK7JcS1EttTv5WEklGKlXZzaCEURhEUjxJQIDNkhsyQBbJAFsgCWSALZIEskAWyQPaQPWQP2UP2kNvd1B721G4nkVYSSkYpVtotpYVQGEVQPEpAgRwgB8gBcoQcIUfIEXKEHCFHyBFyhBwhJ8gJcoKcICfI7V4T30qTQysJJaMUK+2G00IojCIoHiWgQM6QM+QMuUAukAvkArlALpAL5AK5QC4ms3MohMIoguJRmtweme/bcbd9HHp7V+HlvH+6epPh9PeIV/A2xHE8PPXP57Fvj7bptfqw+wc=", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_add(y as u8) as i8\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_add(y as u16) as i16\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_add(y as u32) as i32\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_add(y as u64) as i64\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_sub(y as u8) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_sub(y as u16) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_sub(y as u32) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_sub(y as u64) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_mul(y as u8) as i8\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_mul(y as u16) as i16\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_mul(y as u32) as i32\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_mul(y as u64) as i64\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_0.snap index 00e5bd35a29..57ce594ebbd 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_0.snap @@ -260,7 +260,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tdhNTuNAEAXgu3idRVdV/85VRiMUwKBIURKZBGmEuPt0u+qFsHBk2czG70GoD2PKGOWje+4fL68Pu8PL8a379fujexx2+/3u9WF/fNqed8dD/ezH56bDhw/noe/rp7qb1+vUaTv0h3P363DZ7zfd+3Z/Gb/o7bQ9jHneDvVVt+n6w3PNCr7s9n1rn5uvaTc9SgXDVMJ1PCyYZ+cWzLNkzIfJ7y/T89mXZEAORFdByjfBTwspFTIhZYpTQrhzDVxygqtYe54y4rQhyRcjJEW+CsTzzyIG+joLcmuvBcuUMPf3wZNX4t5GpOtGTG8k0eqVIF69EyQ/sBTkV2/F/fOYuRazr8f0Xsz+rSxaDCEshsj0YpTVi8Fu9WIw/cBiMK9ejPvnMXMxZl+PO4tR/utiXH8OubkU859Bt/NpyXy+zhdeOb/k+3vCvGdeNy+yZD56zGdaOR8XzAfCAt3uz6L5unS383/qR9un3fDtv7ZO6kJvOj8ew3iM4zGNxzwey3gkp0EarKHzpACpQEqQGqQIqcKqsCqsCqvCqrAqrAqrwqqwKqKKqCJVqX9fpCr13hSvETSiRtLIGmUM7zRIgzVU8e1c6qX0wTJaJstsWTSDsyRLthRL80Jo/x3WjJbJMlsWzegsyZItxdJbmhebV/2YLLNl0UzOkizZUiy9ZbA0L5mXzEvmZfOyedm8bF42L5uXzcvmZfOyeaV59ZlYmlevf2FLsfSWwTJaJstsWTTJORRCYRRB8SgBJaIklIwCmSATZIJMkAlyuyXEtRLbU7+VhJJRipV2c2ghFEYRFI8SUCAzZIbMkAWyQBbIAlkgC2SBLJAFskD2kD1kD9lD9pDb3STcSpOllYSSUYqVdktpIRRGERSPElAgB8gBcoAcIUfIEXKEHCFHyBFyhBwhR8gJcoKcICfICXK718S30uTQSkLJKMVKu+G0EAqjCIpHCSiQM+QMOUMukAvkArlALpAL5AK5QC6Qi8nsHAqhMIqgeJQmt0fm+3bYbR/3vb2r8HI5PN28yXD+e8IreBviNByf+ufL0LdH2/hafdj9Aw==", + "debug_symbols": "tdhNTuNAEAXgu3idRVdV/85VRiMUwKBIVhKZBGmEuPt0u+qFsHAU2czG70GoD2PKGOWje+4fz68Pu/3L4a379fujexx3w7B7fRgOT9vT7rCvn/343HT48OE09n39VHf1ep06bsd+f+p+7c/DsOnet8N5+qK343Y/5Wk71lfdpuv3zzUr+LIb+tY+N1/Tbn6UCoaphMt4WDDPzi2YZ8mYD7PfX+bnsy/JgByILoKUb4KfF1IqZELKFOeEcOMauOQEV7H2PGfEecMnYSN88l9Xgvj+s4iBvs6C3NprwTIn3Pv74NkrcWsj0mUj5jeSaPVKEK/eCZIfWAryq7fi9nncuRZ3X4/5vbj7t7JoMYSwGCLzi1FWLwa71YvB9AOLwbx6MW6fx52Lcff1uLEY5b8uxuXnkMgLnkHX82nJfL7MF145v+T7e8K8Z143L7JkPnrMZ1o5HxfMB8ICXe/Povm6dNfzf+pH26fd+O2/tk7qQm86Px3DdIzTMU3HPB3LdCSnQRqsofOkAKlASpAapAipwqqwKqwKq8KqsCqsCqvCqrAqooqoIlWpf0GkKvXeFK8RNKJG0sgaZQrvNEiDNVTx7VzqpfTBMlomy2xZNIOzJEu2FEvzQmj/HdaMlskyWxbN6CzJki3F0luaF5tX/Zgss2XRTM6SLNlSLL1lsDQvmZfMS+Zl87J52bxsXjYvm5fNy+Zl87J5pXn1mViaV69/YUux9JbBMlomy2xZNMk5FEJhFEHxKAEloiSUjAKZIBNkgkyQCXK7JcS1EttTv5WEklGKlXZzaCEURhEUjxJQIDNkhsyQBbJAFsgCWSALZIEskAWyQPaQPWQP2UP2kNvd1B721G4nkVYSSkYpVtotpYVQGEVQPEpAgRwgB8gBcoQcIUfIEXKEHCFHyBFyhBwhJ8gJcoKcICfI7V4T30qTQysJJaMUK+2G00IojCIoHiWgQM6QM+QMuUAukAvkArlALpAL5AK5QC4ms3MohMIoguJRmtweme/bcbd9HHp7V+HlvH+6epPh9PeIV/A2xHE8PPXP57Fvj7bptfqw+wc=", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_add(y as u8) as i8\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_add(y as u16) as i16\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_add(y as u32) as i32\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_add(y as u64) as i64\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_sub(y as u8) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_sub(y as u16) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_sub(y as u32) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_sub(y as u64) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_mul(y as u8) as i8\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_mul(y as u16) as i16\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_mul(y as u32) as i32\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_mul(y as u64) as i64\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index 00e5bd35a29..57ce594ebbd 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -260,7 +260,7 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tdhNTuNAEAXgu3idRVdV/85VRiMUwKBIURKZBGmEuPt0u+qFsHBk2czG70GoD2PKGOWje+4fL68Pu8PL8a379fujexx2+/3u9WF/fNqed8dD/ezH56bDhw/noe/rp7qb1+vUaTv0h3P363DZ7zfd+3Z/Gb/o7bQ9jHneDvVVt+n6w3PNCr7s9n1rn5uvaTc9SgXDVMJ1PCyYZ+cWzLNkzIfJ7y/T89mXZEAORFdByjfBTwspFTIhZYpTQrhzDVxygqtYe54y4rQhyRcjJEW+CsTzzyIG+joLcmuvBcuUMPf3wZNX4t5GpOtGTG8k0eqVIF69EyQ/sBTkV2/F/fOYuRazr8f0Xsz+rSxaDCEshsj0YpTVi8Fu9WIw/cBiMK9ejPvnMXMxZl+PO4tR/utiXH8OubkU859Bt/NpyXy+zhdeOb/k+3vCvGdeNy+yZD56zGdaOR8XzAfCAt3uz6L5unS383/qR9un3fDtv7ZO6kJvOj8ew3iM4zGNxzwey3gkp0EarKHzpACpQEqQGqQIqcKqsCqsCqvCqrAqrAqrwqqwKqKKqCJVqX9fpCr13hSvETSiRtLIGmUM7zRIgzVU8e1c6qX0wTJaJstsWTSDsyRLthRL80Jo/x3WjJbJMlsWzegsyZItxdJbmhebV/2YLLNl0UzOkizZUiy9ZbA0L5mXzEvmZfOyedm8bF42L5uXzcvmZfOyeaV59ZlYmlevf2FLsfSWwTJaJstsWTTJORRCYRRB8SgBJaIklIwCmSATZIJMkAlyuyXEtRLbU7+VhJJRipV2c2ghFEYRFI8SUCAzZIbMkAWyQBbIAlkgC2SBLJAFskD2kD1kD9lD9pDb3STcSpOllYSSUYqVdktpIRRGERSPElAgB8gBcoAcIUfIEXKEHCFHyBFyhBwhR8gJcoKcICfICXK718S30uTQSkLJKMVKu+G0EAqjCIpHCSiQM+QMOUMukAvkArlALpAL5AK5QC6Qi8nsHAqhMIqgeJQmt0fm+3bYbR/3vb2r8HI5PN28yXD+e8IreBviNByf+ufL0LdH2/hafdj9Aw==", + "debug_symbols": "tdhNTuNAEAXgu3idRVdV/85VRiMUwKBIVhKZBGmEuPt0u+qFsHAU2czG70GoD2PKGOWje+4fz68Pu/3L4a379fujexx3w7B7fRgOT9vT7rCvn/343HT48OE09n39VHf1ep06bsd+f+p+7c/DsOnet8N5+qK343Y/5Wk71lfdpuv3zzUr+LIb+tY+N1/Tbn6UCoaphMt4WDDPzi2YZ8mYD7PfX+bnsy/JgByILoKUb4KfF1IqZELKFOeEcOMauOQEV7H2PGfEecMnYSN88l9Xgvj+s4iBvs6C3NprwTIn3Pv74NkrcWsj0mUj5jeSaPVKEK/eCZIfWAryq7fi9nncuRZ3X4/5vbj7t7JoMYSwGCLzi1FWLwa71YvB9AOLwbx6MW6fx52Lcff1uLEY5b8uxuXnkMgLnkHX82nJfL7MF145v+T7e8K8Z143L7JkPnrMZ1o5HxfMB8ICXe/Povm6dNfzf+pH26fd+O2/tk7qQm86Px3DdIzTMU3HPB3LdCSnQRqsofOkAKlASpAapAipwqqwKqwKq8KqsCqsCqvCqrAqooqoIlWpf0GkKvXeFK8RNKJG0sgaZQrvNEiDNVTx7VzqpfTBMlomy2xZNIOzJEu2FEvzQmj/HdaMlskyWxbN6CzJki3F0luaF5tX/Zgss2XRTM6SLNlSLL1lsDQvmZfMS+Zl87J52bxsXjYvm5fNy+Zl87J5pXn1mViaV69/YUux9JbBMlomy2xZNMk5FEJhFEHxKAEloiSUjAKZIBNkgkyQCXK7JcS1EttTv5WEklGKlXZzaCEURhEUjxJQIDNkhsyQBbJAFsgCWSALZIEskAWyQPaQPWQP2UP2kNvd1B721G4nkVYSSkYpVtotpYVQGEVQPEpAgRwgB8gBcoQcIUfIEXKEHCFHyBFyhBwhJ8gJcoKcICfI7V4T30qTQysJJaMUK+2G00IojCIoHiWgQM6QM+QMuUAukAvkArlALpAL5AK5QC4ms3MohMIoguJRmtweme/bcbd9HHp7V+HlvH+6epPh9PeIV/A2xHE8PPXP57Fvj7bptfqw+wc=", "file_map": { "39": { "source": "use crate::convert::AsPrimitive;\n\n// docs:start:add-trait\npub trait Add {\n fn add(self, other: Self) -> Self;\n}\n// docs:end:add-trait\n\nimpl Add for Field {\n fn add(self, other: Field) -> Field {\n self + other\n }\n}\n\nimpl Add for u128 {\n fn add(self, other: u128) -> u128 {\n self + other\n }\n}\nimpl Add for u64 {\n fn add(self, other: u64) -> u64 {\n self + other\n }\n}\nimpl Add for u32 {\n fn add(self, other: u32) -> u32 {\n self + other\n }\n}\nimpl Add for u16 {\n fn add(self, other: u16) -> u16 {\n self + other\n }\n}\nimpl Add for u8 {\n fn add(self, other: u8) -> u8 {\n self + other\n }\n}\nimpl Add for u1 {\n fn add(self, other: u1) -> u1 {\n self + other\n }\n}\n\nimpl Add for i8 {\n fn add(self, other: i8) -> i8 {\n self + other\n }\n}\nimpl Add for i16 {\n fn add(self, other: i16) -> i16 {\n self + other\n }\n}\nimpl Add for i32 {\n fn add(self, other: i32) -> i32 {\n self + other\n }\n}\nimpl Add for i64 {\n fn add(self, other: i64) -> i64 {\n self + other\n }\n}\n\n// docs:start:sub-trait\npub trait Sub {\n fn sub(self, other: Self) -> Self;\n}\n// docs:end:sub-trait\n\nimpl Sub for Field {\n fn sub(self, other: Field) -> Field {\n self - other\n }\n}\n\nimpl Sub for u128 {\n fn sub(self, other: u128) -> u128 {\n self - other\n }\n}\nimpl Sub for u64 {\n fn sub(self, other: u64) -> u64 {\n self - other\n }\n}\nimpl Sub for u32 {\n fn sub(self, other: u32) -> u32 {\n self - other\n }\n}\nimpl Sub for u16 {\n fn sub(self, other: u16) -> u16 {\n self - other\n }\n}\nimpl Sub for u8 {\n fn sub(self, other: u8) -> u8 {\n self - other\n }\n}\nimpl Sub for u1 {\n fn sub(self, other: u1) -> u1 {\n self - other\n }\n}\n\nimpl Sub for i8 {\n fn sub(self, other: i8) -> i8 {\n self - other\n }\n}\nimpl Sub for i16 {\n fn sub(self, other: i16) -> i16 {\n self - other\n }\n}\nimpl Sub for i32 {\n fn sub(self, other: i32) -> i32 {\n self - other\n }\n}\nimpl Sub for i64 {\n fn sub(self, other: i64) -> i64 {\n self - other\n }\n}\n\n// docs:start:mul-trait\npub trait Mul {\n fn mul(self, other: Self) -> Self;\n}\n// docs:end:mul-trait\n\nimpl Mul for Field {\n fn mul(self, other: Field) -> Field {\n self * other\n }\n}\n\nimpl Mul for u128 {\n fn mul(self, other: u128) -> u128 {\n self * other\n }\n}\nimpl Mul for u64 {\n fn mul(self, other: u64) -> u64 {\n self * other\n }\n}\nimpl Mul for u32 {\n fn mul(self, other: u32) -> u32 {\n self * other\n }\n}\nimpl Mul for u16 {\n fn mul(self, other: u16) -> u16 {\n self * other\n }\n}\nimpl Mul for u8 {\n fn mul(self, other: u8) -> u8 {\n self * other\n }\n}\nimpl Mul for u1 {\n fn mul(self, other: u1) -> u1 {\n self * other\n }\n}\n\nimpl Mul for i8 {\n fn mul(self, other: i8) -> i8 {\n self * other\n }\n}\nimpl Mul for i16 {\n fn mul(self, other: i16) -> i16 {\n self * other\n }\n}\nimpl Mul for i32 {\n fn mul(self, other: i32) -> i32 {\n self * other\n }\n}\nimpl Mul for i64 {\n fn mul(self, other: i64) -> i64 {\n self * other\n }\n}\n\n// docs:start:div-trait\npub trait Div {\n fn div(self, other: Self) -> Self;\n}\n// docs:end:div-trait\n\nimpl Div for Field {\n fn div(self, other: Field) -> Field {\n self / other\n }\n}\n\nimpl Div for u128 {\n fn div(self, other: u128) -> u128 {\n self / other\n }\n}\nimpl Div for u64 {\n fn div(self, other: u64) -> u64 {\n self / other\n }\n}\nimpl Div for u32 {\n fn div(self, other: u32) -> u32 {\n self / other\n }\n}\nimpl Div for u16 {\n fn div(self, other: u16) -> u16 {\n self / other\n }\n}\nimpl Div for u8 {\n fn div(self, other: u8) -> u8 {\n self / other\n }\n}\nimpl Div for u1 {\n fn div(self, other: u1) -> u1 {\n self / other\n }\n}\n\nimpl Div for i8 {\n fn div(self, other: i8) -> i8 {\n self / other\n }\n}\nimpl Div for i16 {\n fn div(self, other: i16) -> i16 {\n self / other\n }\n}\nimpl Div for i32 {\n fn div(self, other: i32) -> i32 {\n self / other\n }\n}\nimpl Div for i64 {\n fn div(self, other: i64) -> i64 {\n self / other\n }\n}\n\n// docs:start:rem-trait\npub trait Rem {\n fn rem(self, other: Self) -> Self;\n}\n// docs:end:rem-trait\n\nimpl Rem for u128 {\n fn rem(self, other: u128) -> u128 {\n self % other\n }\n}\nimpl Rem for u64 {\n fn rem(self, other: u64) -> u64 {\n self % other\n }\n}\nimpl Rem for u32 {\n fn rem(self, other: u32) -> u32 {\n self % other\n }\n}\nimpl Rem for u16 {\n fn rem(self, other: u16) -> u16 {\n self % other\n }\n}\nimpl Rem for u8 {\n fn rem(self, other: u8) -> u8 {\n self % other\n }\n}\nimpl Rem for u1 {\n fn rem(self, other: u1) -> u1 {\n self % other\n }\n}\n\nimpl Rem for i8 {\n fn rem(self, other: i8) -> i8 {\n self % other\n }\n}\nimpl Rem for i16 {\n fn rem(self, other: i16) -> i16 {\n self % other\n }\n}\nimpl Rem for i32 {\n fn rem(self, other: i32) -> i32 {\n self % other\n }\n}\nimpl Rem for i64 {\n fn rem(self, other: i64) -> i64 {\n self % other\n }\n}\n\n// docs:start:neg-trait\npub trait Neg {\n fn neg(self) -> Self;\n}\n// docs:end:neg-trait\n\n// docs:start:neg-trait-impls\nimpl Neg for Field {\n fn neg(self) -> Field {\n -self\n }\n}\n\nimpl Neg for i8 {\n fn neg(self) -> i8 {\n -self\n }\n}\nimpl Neg for i16 {\n fn neg(self) -> i16 {\n -self\n }\n}\nimpl Neg for i32 {\n fn neg(self) -> i32 {\n -self\n }\n}\nimpl Neg for i64 {\n fn neg(self) -> i64 {\n -self\n }\n}\n// docs:end:neg-trait-impls\n\n// docs:start:wrapping-add-trait\npub trait WrappingAdd {\n fn wrapping_add(self, y: Self) -> Self;\n}\n// docs:end:wrapping-add-trait\n\nimpl WrappingAdd for u1 {\n fn wrapping_add(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingAdd for u8 {\n fn wrapping_add(self: u8, y: u8) -> u8 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u16 {\n fn wrapping_add(self: u16, y: u16) -> u16 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u32 {\n fn wrapping_add(self: u32, y: u32) -> u32 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u64 {\n fn wrapping_add(self: u64, y: u64) -> u64 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for u128 {\n fn wrapping_add(self: u128, y: u128) -> u128 {\n wrapping_add_hlp(self, y)\n }\n}\n\nimpl WrappingAdd for i8 {\n fn wrapping_add(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_add(y as u8) as i8\n }\n}\n\nimpl WrappingAdd for i16 {\n fn wrapping_add(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_add(y as u16) as i16\n }\n}\n\nimpl WrappingAdd for i32 {\n fn wrapping_add(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_add(y as u32) as i32\n }\n}\n\nimpl WrappingAdd for i64 {\n fn wrapping_add(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_add(y as u64) as i64\n }\n}\nimpl WrappingAdd for Field {\n fn wrapping_add(self: Field, y: Field) -> Field {\n self + y\n }\n}\n\n// docs:start:wrapping-sub-trait\npub trait WrappingSub {\n fn wrapping_sub(self, y: Self) -> Self;\n}\n// docs:start:wrapping-sub-trait\n\nimpl WrappingSub for u1 {\n fn wrapping_sub(self: u1, y: u1) -> u1 {\n self ^ y\n }\n}\n\nimpl WrappingSub for u8 {\n fn wrapping_sub(self: u8, y: u8) -> u8 {\n wrapping_sub_hlp(self, y) as u8\n }\n}\n\nimpl WrappingSub for u16 {\n fn wrapping_sub(self: u16, y: u16) -> u16 {\n wrapping_sub_hlp(self, y) as u16\n }\n}\n\nimpl WrappingSub for u32 {\n fn wrapping_sub(self: u32, y: u32) -> u32 {\n wrapping_sub_hlp(self, y) as u32\n }\n}\nimpl WrappingSub for u64 {\n fn wrapping_sub(self: u64, y: u64) -> u64 {\n wrapping_sub_hlp(self, y) as u64\n }\n}\nimpl WrappingSub for u128 {\n fn wrapping_sub(self: u128, y: u128) -> u128 {\n wrapping_sub_hlp(self, y) as u128\n }\n}\n\nimpl WrappingSub for i8 {\n fn wrapping_sub(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_sub(y as u8) as i8\n }\n}\n\nimpl WrappingSub for i16 {\n fn wrapping_sub(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_sub(y as u16) as i16\n }\n}\n\nimpl WrappingSub for i32 {\n fn wrapping_sub(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_sub(y as u32) as i32\n }\n}\nimpl WrappingSub for i64 {\n fn wrapping_sub(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_sub(y as u64) as i64\n }\n}\nimpl WrappingSub for Field {\n fn wrapping_sub(self: Field, y: Field) -> Field {\n self - y\n }\n}\n\n// docs:start:wrapping-mul-trait\npub trait WrappingMul {\n fn wrapping_mul(self, y: Self) -> Self;\n}\n// docs:start:wrapping-mul-trait\n\nimpl WrappingMul for u1 {\n fn wrapping_mul(self: u1, y: u1) -> u1 {\n self & y\n }\n}\n\nimpl WrappingMul for u8 {\n fn wrapping_mul(self: u8, y: u8) -> u8 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u16 {\n fn wrapping_mul(self: u16, y: u16) -> u16 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for u32 {\n fn wrapping_mul(self: u32, y: u32) -> u32 {\n wrapping_mul_hlp(self, y)\n }\n}\nimpl WrappingMul for u64 {\n fn wrapping_mul(self: u64, y: u64) -> u64 {\n wrapping_mul_hlp(self, y)\n }\n}\n\nimpl WrappingMul for i8 {\n fn wrapping_mul(self: i8, y: i8) -> i8 {\n let x = self as u8;\n x.wrapping_mul(y as u8) as i8\n }\n}\n\nimpl WrappingMul for i16 {\n fn wrapping_mul(self: i16, y: i16) -> i16 {\n let x = self as u16;\n x.wrapping_mul(y as u16) as i16\n }\n}\n\nimpl WrappingMul for i32 {\n fn wrapping_mul(self: i32, y: i32) -> i32 {\n let x = self as u32;\n x.wrapping_mul(y as u32) as i32\n }\n}\n\nimpl WrappingMul for i64 {\n fn wrapping_mul(self: i64, y: i64) -> i64 {\n let x = self as u64;\n x.wrapping_mul(y as u64) as i64\n }\n}\n\nimpl WrappingMul for u128 {\n fn wrapping_mul(self: u128, y: u128) -> u128 {\n wrapping_mul128_hlp(self, y)\n }\n}\nimpl WrappingMul for Field {\n fn wrapping_mul(self: Field, y: Field) -> Field {\n self * y\n }\n}\n\nfn wrapping_add_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() + y.as_())\n}\n\nfn wrapping_sub_hlp(x: T, y: T) -> Field\nwhere\n T: AsPrimitive,\n{\n //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow\n x.as_() + 340282366920938463463374607431768211456 - y.as_()\n}\n\nfn wrapping_mul_hlp(x: T, y: T) -> T\nwhere\n T: AsPrimitive,\n Field: AsPrimitive,\n{\n AsPrimitive::as_(x.as_() * y.as_())\n}\n\nglobal two_pow_64: u128 = 0x10000000000000000;\n/// Splits a 128 bits number into two 64 bits limbs\nunconstrained fn split64(x: u128) -> (u64, u64) {\n let lo = x as u64;\n let hi = (x / two_pow_64) as u64;\n (lo, hi)\n}\n\n/// Split a 128 bits number into two 64 bits limbs\n/// It will fail if the number is more than 128 bits\nfn split_into_64_bit_limbs(x: u128) -> (u64, u64) {\n // Safety: the limbs are constrained below\n let (x_lo, x_hi) = unsafe { split64(x) };\n assert(x as Field == x_lo as Field + x_hi as Field * two_pow_64 as Field);\n (x_lo, x_hi)\n}\n\n#[field(bn254)]\nfn wrapping_mul128_hlp(x: u128, y: u128) -> u128 {\n let (x_lo, x_hi) = split_into_64_bit_limbs(x);\n let (y_lo, y_hi) = split_into_64_bit_limbs(y);\n // Multiplication using the limbs:(x_lo + 2**64*x_hi)*(y_lo + 2**64*y_hi)=x_lo*y_lo+...\n // and skipping the terms over 2**128\n // Working with u64 limbs ensures that we cannot overflow the field modulus.\n let low = x_lo as Field * y_lo as Field;\n let lo = low as u64 as Field;\n let carry = (low - lo) / two_pow_64 as Field;\n let high = x_lo as Field * y_hi as Field + x_hi as Field * y_lo as Field + carry;\n let hi = high as u64 as Field;\n (lo + two_pow_64 as Field * hi) as u128\n}\n", diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index 84ca0257b31..4e036a762d7 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -57,10 +57,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 194 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 25 }, Jump { location: 27 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 29 }, Mov { destination: Relative(6), source: Relative(1) }, Jump { location: 29 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(2) }, JumpIf { condition: Relative(7), location: 35 }, Jump { location: 37 }, Mov { destination: Relative(8), source: Relative(12) }, Jump { location: 39 }, Mov { destination: Relative(8), source: Relative(2) }, Jump { location: 39 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(6), rhs: Relative(8) }, BinaryIntOp { destination: Relative(9), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(9), location: 43 }, Jump { location: 45 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, JumpIf { condition: Relative(5), location: 49 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(5), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(6), op: Sub, lhs: Relative(5), rhs: Relative(4) }, Cast { destination: Relative(7), source: Relative(6), bit_size: Integer(U32) }, Cast { destination: Relative(4), source: Relative(7), bit_size: Field }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(8), op: Sub, lhs: Relative(5), rhs: Relative(7) }, Cast { destination: Relative(9), source: Relative(8), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(9), bit_size: Field }, Cast { destination: Relative(8), source: Relative(7), bit_size: Integer(U32) }, Cast { destination: Relative(9), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(10), op: Sub, lhs: Relative(5), rhs: Relative(9) }, Cast { destination: Relative(9), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(5), source: Relative(9), bit_size: Field }, Cast { destination: Relative(9), source: Relative(5), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(1), rhs: Relative(6) }, Mov { destination: Relative(10), source: Relative(5) }, Cast { destination: Relative(5), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(11), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(4), bit_size: Integer(U32) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 2147483648 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(11), rhs: Relative(4) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U1, lhs: Relative(13), rhs: Relative(11) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U1, lhs: Relative(5), rhs: Relative(12) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(5), location: 80 }, Call { location: 200 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(10), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 85 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, Mov { destination: Relative(11), source: Relative(10) }, Cast { destination: Relative(10), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(7), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(12) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(12), rhs: Relative(7) }, BinaryIntOp { destination: Relative(7), op: Mul, bit_size: U1, lhs: Relative(4), rhs: Relative(13) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(4), location: 99 }, Call { location: 200 }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, JumpIf { condition: Relative(4), location: 103 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(7) } }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(6) }, JumpIf { condition: Relative(5), location: 109 }, Jump { location: 111 }, Mov { destination: Relative(7), source: Relative(15) }, Jump { location: 113 }, Mov { destination: Relative(7), source: Relative(6) }, Jump { location: 113 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(10), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(2) }, JumpIf { condition: Relative(10), location: 119 }, Jump { location: 121 }, Mov { destination: Relative(11), source: Relative(15) }, Jump { location: 123 }, Mov { destination: Relative(11), source: Relative(2) }, Jump { location: 123 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(7), rhs: Relative(11) }, BinaryIntOp { destination: Relative(12), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(10) }, JumpIf { condition: Relative(12), location: 127 }, Jump { location: 129 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(2), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(8) }, JumpIf { condition: Relative(2), location: 133 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(4), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(6) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, JumpIf { condition: Relative(4), location: 139 }, Jump { location: 141 }, Mov { destination: Relative(5), source: Relative(14) }, Jump { location: 143 }, Mov { destination: Relative(5), source: Relative(6) }, Jump { location: 143 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(9) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(9) }, JumpIf { condition: Relative(7), location: 149 }, Jump { location: 151 }, Mov { destination: Relative(10), source: Relative(14) }, Jump { location: 153 }, Mov { destination: Relative(10), source: Relative(9) }, Jump { location: 153 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, BinaryIntOp { destination: Relative(11), op: Xor, bit_size: U1, lhs: Relative(4), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 157 }, Jump { location: 159 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(12), rhs: Relative(2) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(4), location: 163 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 169 }, Jump { location: 171 }, Mov { destination: Relative(4), source: Relative(12) }, Jump { location: 173 }, Mov { destination: Relative(4), source: Relative(1) }, Jump { location: 173 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(9) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(9) }, JumpIf { condition: Relative(5), location: 179 }, Jump { location: 181 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 183 }, Mov { destination: Relative(6), source: Relative(9) }, Jump { location: 183 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(4), rhs: Relative(6) }, BinaryIntOp { destination: Relative(7), op: Xor, bit_size: U1, lhs: Relative(3), rhs: Relative(5) }, JumpIf { condition: Relative(7), location: 187 }, Jump { location: 189 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(8) }, JumpIf { condition: Relative(1), location: 193 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(3) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 199 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZfNTipBEIXfZdYspqr611cxxiCOhoQAQbjJjeHdb7VVB3ExhMx4N3wH8Xw0TfXofHavw8vp/Xm9fdt9dA+Pn93LYb3ZrN+fN7vV8rjebfWnn13fHqh2D7TouDeQgQ1iCIZoSIZsKAaziFnELGIWMYuYRcwiZhGziFnELMEswSzBLMEswSxBLaxIhmwoBrXkRRfVUhRkUEtViKFZemVbTFS21SRlW07rFmdbkLaTuliUKuOgVBtrL4lTfaz91JalvZSc2Vmc1Zh7JznZKc7gdF92X3Zfdl92X2k+XWchJzvFGZzNp5+/JGd2Fmc11t5JTnaKMzjdV91X3VfdV9Unus/U9wiEwAjqFGohIESEhJARCkL1QD0CITACzAQzwUwwE8wEM8HMMDPMDDPDzDAzzAwzw8wwt0MiOqDUjokFQmCEZpYWAkJESAgZoSBUD+3oWCAERoA5wBxgDjAHmAPMAeYIc4Q5whxhjjBHmCPMEeYIcztbomeJ2uGyQAiM0MyxhYAQERJCRigI1UM7ZhYIgRFgzjBnmDPMGeYMc4a5wFxgLjAXmAvMBeYCc4G5wNxOnugVhNrRs0AIzZzO50WHq/fz8TAM7eJ9dTnXi/x+eRi2x+5he9psFt2f5eb09Usf++X2i8flQV/VMzdsX5UqfFtvhpbOi+92P17VxXmZarzU44Q+9/2EPktBP46+v4z3S6jZBSUSXQxSfxjCuCHnSm7IhdKYId7Ygz73gl3UXMYcadwhOVRXSE58MRDfv4oU6XsV1M/dC5Yxw73fB4/uxK2JyJeJGJ9IotkjQTx7Jkh+YSgozJ6K2+u4cyzu3o/xubj7W5k0GEIYDJHxwaizB4P72YPB9AuDwTx7MG6v487BuHs/bgxG/a+DcfkccrUV9/8Nuu7nKf1y6Vee2Z/y/oHQD8zz+iJT+imgX2hmP03oR8IAXc/PpL4O3XX/SZ8tV+vDj5vsczMd1suXzeBP307b1dWrx797vIKb9P1htxpeT4ehma7u1PXxkWpYUK1P7UZFn+r/UQvu+enc3v4f", + "debug_symbols": "tZfNTipBEIXfZdYspqr611cxxiCOhoQAQbjJjeHdb7VVB3ExhMx4N3wH8Xw0TfXofHavw8vp/Xm9fdt9dA+Pn93LYb3ZrN+fN7vV8rjebfWnn13fHqh2D7TouDeQgQ1iCIZoSIZsKAaziFnELGIWMYuYRcwiZhGziFnELMEswSzBLMEswSxBLaxIhmwoBrXkRRfVUhRkUEtViKFZemVbTFS21SRlW07rFmdbkLaTuliUKuOgVBtrL4lTfaz91JalvZSc2Vmc1Zh7JznZKc7gdF92X3Zfdl92X2k+XWchJzvFGZzNp5+/JGd2Fmc11t5JTnaKMzjdV91X3VfdV9Unus/U9wiEwAjqFGohIESEhJARCkL1QD0CITACzAQzwUwwE8wEM8HMMDPMDDPDzDAzzAwzw8wwt0MiOqDUjokFQmCEZpYWAkJESAgZoSBUD+3oWCAERoA5wBxgDjAHmAPMAeYIc4Q5whxhjjBHmCPMEeYIcztbomeJ2uGyQAiM0MyxhYAQERJCRigI1UM7ZhYIgRFgzjBnmDPMGeYMc4a5wFxgLjAXmAvMBeYCc4G5wNxOnugVhNrRs0AIzZzO50WHq/fz8TAM7eJ9dTnXi/x+eRi2x+5he9psFt2f5eb09Usf++X2i8flQV/VMzdsX5UqfFtvhpbOi+92P17VxXmZarzU44Q+9/2EPktBP46+v4z3S6jZBSUSXQxSfxjCuCHnSm7IhdKYId7Ygz73gl3UXMYcadwRcrtWfClCDt87QXz/KlKk71VQP3cvWMYM934fPLoTtyYiXyZifCKJZo8E8eyZIPmFoaAweypur+POsbh7P8bn4u5vZdJgCGEwRMYHo84eDO5nDwbTLwwG8+zBuL2OOwfj7v24MRj1vw7G5XNI4gl/g677eUq/XPqVZ/anvH8g9APzvL7IlH4K6Bea2U8T+pEwQNfzM6mvQ3fdf9Jny9X68OMm+9xMh/XyZTP407fTdnX16vHvHq/gJn1/2K2G19NhaKarO3V9fKQaFlTrU7tR0af6f9SCe346t7f/Bw==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_0.snap index 84ca0257b31..4e036a762d7 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_0.snap @@ -57,10 +57,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 194 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 25 }, Jump { location: 27 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 29 }, Mov { destination: Relative(6), source: Relative(1) }, Jump { location: 29 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(2) }, JumpIf { condition: Relative(7), location: 35 }, Jump { location: 37 }, Mov { destination: Relative(8), source: Relative(12) }, Jump { location: 39 }, Mov { destination: Relative(8), source: Relative(2) }, Jump { location: 39 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(6), rhs: Relative(8) }, BinaryIntOp { destination: Relative(9), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(9), location: 43 }, Jump { location: 45 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, JumpIf { condition: Relative(5), location: 49 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(5), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(6), op: Sub, lhs: Relative(5), rhs: Relative(4) }, Cast { destination: Relative(7), source: Relative(6), bit_size: Integer(U32) }, Cast { destination: Relative(4), source: Relative(7), bit_size: Field }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(8), op: Sub, lhs: Relative(5), rhs: Relative(7) }, Cast { destination: Relative(9), source: Relative(8), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(9), bit_size: Field }, Cast { destination: Relative(8), source: Relative(7), bit_size: Integer(U32) }, Cast { destination: Relative(9), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(10), op: Sub, lhs: Relative(5), rhs: Relative(9) }, Cast { destination: Relative(9), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(5), source: Relative(9), bit_size: Field }, Cast { destination: Relative(9), source: Relative(5), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(1), rhs: Relative(6) }, Mov { destination: Relative(10), source: Relative(5) }, Cast { destination: Relative(5), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(11), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(4), bit_size: Integer(U32) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 2147483648 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(11), rhs: Relative(4) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U1, lhs: Relative(13), rhs: Relative(11) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U1, lhs: Relative(5), rhs: Relative(12) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(5), location: 80 }, Call { location: 200 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(10), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 85 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, Mov { destination: Relative(11), source: Relative(10) }, Cast { destination: Relative(10), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(7), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(12) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(12), rhs: Relative(7) }, BinaryIntOp { destination: Relative(7), op: Mul, bit_size: U1, lhs: Relative(4), rhs: Relative(13) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(4), location: 99 }, Call { location: 200 }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, JumpIf { condition: Relative(4), location: 103 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(7) } }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(6) }, JumpIf { condition: Relative(5), location: 109 }, Jump { location: 111 }, Mov { destination: Relative(7), source: Relative(15) }, Jump { location: 113 }, Mov { destination: Relative(7), source: Relative(6) }, Jump { location: 113 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(10), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(2) }, JumpIf { condition: Relative(10), location: 119 }, Jump { location: 121 }, Mov { destination: Relative(11), source: Relative(15) }, Jump { location: 123 }, Mov { destination: Relative(11), source: Relative(2) }, Jump { location: 123 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(7), rhs: Relative(11) }, BinaryIntOp { destination: Relative(12), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(10) }, JumpIf { condition: Relative(12), location: 127 }, Jump { location: 129 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(2), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(8) }, JumpIf { condition: Relative(2), location: 133 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(4), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(6) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, JumpIf { condition: Relative(4), location: 139 }, Jump { location: 141 }, Mov { destination: Relative(5), source: Relative(14) }, Jump { location: 143 }, Mov { destination: Relative(5), source: Relative(6) }, Jump { location: 143 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(9) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(9) }, JumpIf { condition: Relative(7), location: 149 }, Jump { location: 151 }, Mov { destination: Relative(10), source: Relative(14) }, Jump { location: 153 }, Mov { destination: Relative(10), source: Relative(9) }, Jump { location: 153 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, BinaryIntOp { destination: Relative(11), op: Xor, bit_size: U1, lhs: Relative(4), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 157 }, Jump { location: 159 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(12), rhs: Relative(2) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(4), location: 163 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 169 }, Jump { location: 171 }, Mov { destination: Relative(4), source: Relative(12) }, Jump { location: 173 }, Mov { destination: Relative(4), source: Relative(1) }, Jump { location: 173 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(9) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(9) }, JumpIf { condition: Relative(5), location: 179 }, Jump { location: 181 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 183 }, Mov { destination: Relative(6), source: Relative(9) }, Jump { location: 183 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(4), rhs: Relative(6) }, BinaryIntOp { destination: Relative(7), op: Xor, bit_size: U1, lhs: Relative(3), rhs: Relative(5) }, JumpIf { condition: Relative(7), location: 187 }, Jump { location: 189 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(8) }, JumpIf { condition: Relative(1), location: 193 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(3) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 199 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZfNTipBEIXfZdYspqr611cxxiCOhoQAQbjJjeHdb7VVB3ExhMx4N3wH8Xw0TfXofHavw8vp/Xm9fdt9dA+Pn93LYb3ZrN+fN7vV8rjebfWnn13fHqh2D7TouDeQgQ1iCIZoSIZsKAaziFnELGIWMYuYRcwiZhGziFnELMEswSzBLMEswSxBLaxIhmwoBrXkRRfVUhRkUEtViKFZemVbTFS21SRlW07rFmdbkLaTuliUKuOgVBtrL4lTfaz91JalvZSc2Vmc1Zh7JznZKc7gdF92X3Zfdl92X2k+XWchJzvFGZzNp5+/JGd2Fmc11t5JTnaKMzjdV91X3VfdV9Unus/U9wiEwAjqFGohIESEhJARCkL1QD0CITACzAQzwUwwE8wEM8HMMDPMDDPDzDAzzAwzw8wwt0MiOqDUjokFQmCEZpYWAkJESAgZoSBUD+3oWCAERoA5wBxgDjAHmAPMAeYIc4Q5whxhjjBHmCPMEeYIcztbomeJ2uGyQAiM0MyxhYAQERJCRigI1UM7ZhYIgRFgzjBnmDPMGeYMc4a5wFxgLjAXmAvMBeYCc4G5wNxOnugVhNrRs0AIzZzO50WHq/fz8TAM7eJ9dTnXi/x+eRi2x+5he9psFt2f5eb09Usf++X2i8flQV/VMzdsX5UqfFtvhpbOi+92P17VxXmZarzU44Q+9/2EPktBP46+v4z3S6jZBSUSXQxSfxjCuCHnSm7IhdKYId7Ygz73gl3UXMYcadwhOVRXSE58MRDfv4oU6XsV1M/dC5Yxw73fB4/uxK2JyJeJGJ9IotkjQTx7Jkh+YSgozJ6K2+u4cyzu3o/xubj7W5k0GEIYDJHxwaizB4P72YPB9AuDwTx7MG6v487BuHs/bgxG/a+DcfkccrUV9/8Nuu7nKf1y6Vee2Z/y/oHQD8zz+iJT+imgX2hmP03oR8IAXc/PpL4O3XX/SZ8tV+vDj5vsczMd1suXzeBP307b1dWrx797vIKb9P1htxpeT4ehma7u1PXxkWpYUK1P7UZFn+r/UQvu+enc3v4f", + "debug_symbols": "tZfNTipBEIXfZdYspqr611cxxiCOhoQAQbjJjeHdb7VVB3ExhMx4N3wH8Xw0TfXofHavw8vp/Xm9fdt9dA+Pn93LYb3ZrN+fN7vV8rjebfWnn13fHqh2D7TouDeQgQ1iCIZoSIZsKAaziFnELGIWMYuYRcwiZhGziFnELMEswSzBLMEswSxBLaxIhmwoBrXkRRfVUhRkUEtViKFZemVbTFS21SRlW07rFmdbkLaTuliUKuOgVBtrL4lTfaz91JalvZSc2Vmc1Zh7JznZKc7gdF92X3Zfdl92X2k+XWchJzvFGZzNp5+/JGd2Fmc11t5JTnaKMzjdV91X3VfdV9Unus/U9wiEwAjqFGohIESEhJARCkL1QD0CITACzAQzwUwwE8wEM8HMMDPMDDPDzDAzzAwzw8wwt0MiOqDUjokFQmCEZpYWAkJESAgZoSBUD+3oWCAERoA5wBxgDjAHmAPMAeYIc4Q5whxhjjBHmCPMEeYIcztbomeJ2uGyQAiM0MyxhYAQERJCRigI1UM7ZhYIgRFgzjBnmDPMGeYMc4a5wFxgLjAXmAvMBeYCc4G5wNxOnugVhNrRs0AIzZzO50WHq/fz8TAM7eJ9dTnXi/x+eRi2x+5he9psFt2f5eb09Usf++X2i8flQV/VMzdsX5UqfFtvhpbOi+92P17VxXmZarzU44Q+9/2EPktBP46+v4z3S6jZBSUSXQxSfxjCuCHnSm7IhdKYId7Ygz73gl3UXMYcadwRcrtWfClCDt87QXz/KlKk71VQP3cvWMYM934fPLoTtyYiXyZifCKJZo8E8eyZIPmFoaAweypur+POsbh7P8bn4u5vZdJgCGEwRMYHo84eDO5nDwbTLwwG8+zBuL2OOwfj7v24MRj1vw7G5XNI4gl/g677eUq/XPqVZ/anvH8g9APzvL7IlH4K6Bea2U8T+pEwQNfzM6mvQ3fdf9Jny9X68OMm+9xMh/XyZTP407fTdnX16vHvHq/gJn1/2K2G19NhaKarO3V9fKQaFlTrU7tR0af6f9SCe346t7f/Bw==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index 84ca0257b31..4e036a762d7 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/signed_division/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -57,10 +57,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(4), offset_address: Relative(5) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U32) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U32) }, Cast { destination: Direct(32838), source: Direct(32838), bit_size: Integer(U32) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Mov { destination: Relative(3), source: Direct(32838) }, Call { location: 17 }, Call { location: 18 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32839 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 194 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(5), location: 25 }, Jump { location: 27 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 29 }, Mov { destination: Relative(6), source: Relative(1) }, Jump { location: 29 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(2) }, JumpIf { condition: Relative(7), location: 35 }, Jump { location: 37 }, Mov { destination: Relative(8), source: Relative(12) }, Jump { location: 39 }, Mov { destination: Relative(8), source: Relative(2) }, Jump { location: 39 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(6), rhs: Relative(8) }, BinaryIntOp { destination: Relative(9), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(7) }, JumpIf { condition: Relative(9), location: 43 }, Jump { location: 45 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(3) }, JumpIf { condition: Relative(5), location: 49 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(1), bit_size: Field }, Const { destination: Relative(5), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(6), op: Sub, lhs: Relative(5), rhs: Relative(4) }, Cast { destination: Relative(7), source: Relative(6), bit_size: Integer(U32) }, Cast { destination: Relative(4), source: Relative(7), bit_size: Field }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(3), bit_size: Field }, BinaryFieldOp { destination: Relative(8), op: Sub, lhs: Relative(5), rhs: Relative(7) }, Cast { destination: Relative(9), source: Relative(8), bit_size: Integer(U32) }, Cast { destination: Relative(7), source: Relative(9), bit_size: Field }, Cast { destination: Relative(8), source: Relative(7), bit_size: Integer(U32) }, Cast { destination: Relative(9), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(10), op: Sub, lhs: Relative(5), rhs: Relative(9) }, Cast { destination: Relative(9), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(5), source: Relative(9), bit_size: Field }, Cast { destination: Relative(9), source: Relative(5), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(5), op: Add, bit_size: U32, lhs: Relative(1), rhs: Relative(6) }, Mov { destination: Relative(10), source: Relative(5) }, Cast { destination: Relative(5), source: Relative(10), bit_size: Integer(U32) }, Cast { destination: Relative(11), source: Relative(1), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(4), bit_size: Integer(U32) }, Const { destination: Relative(4), bit_size: Integer(U32), value: 2147483648 }, BinaryIntOp { destination: Relative(13), op: LessThan, bit_size: U32, lhs: Relative(11), rhs: Relative(4) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: Equals, bit_size: U1, lhs: Relative(13), rhs: Relative(11) }, BinaryIntOp { destination: Relative(11), op: LessThan, bit_size: U32, lhs: Relative(5), rhs: Relative(4) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(13) }, BinaryIntOp { destination: Relative(11), op: Mul, bit_size: U1, lhs: Relative(5), rhs: Relative(12) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U1, lhs: Relative(11), rhs: Relative(12) }, JumpIf { condition: Relative(5), location: 80 }, Call { location: 200 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(11), op: Equals, bit_size: U32, lhs: Relative(10), rhs: Relative(5) }, JumpIf { condition: Relative(11), location: 85 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(12) } }, BinaryIntOp { destination: Relative(10), op: Add, bit_size: U32, lhs: Relative(3), rhs: Relative(8) }, Mov { destination: Relative(11), source: Relative(10) }, Cast { destination: Relative(10), source: Relative(11), bit_size: Integer(U32) }, Cast { destination: Relative(12), source: Relative(3), bit_size: Integer(U32) }, Cast { destination: Relative(13), source: Relative(7), bit_size: Integer(U32) }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(4) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(13), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(12) }, BinaryIntOp { destination: Relative(12), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(4) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(12), rhs: Relative(7) }, BinaryIntOp { destination: Relative(7), op: Mul, bit_size: U1, lhs: Relative(4), rhs: Relative(13) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U1, lhs: Relative(7), rhs: Relative(13) }, JumpIf { condition: Relative(4), location: 99 }, Call { location: 200 }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(11), rhs: Relative(5) }, JumpIf { condition: Relative(4), location: 103 }, Const { destination: Relative(7), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(7) } }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(6) }, JumpIf { condition: Relative(5), location: 109 }, Jump { location: 111 }, Mov { destination: Relative(7), source: Relative(15) }, Jump { location: 113 }, Mov { destination: Relative(7), source: Relative(6) }, Jump { location: 113 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(10), op: LessThan, bit_size: U32, lhs: Relative(13), rhs: Relative(2) }, Const { destination: Relative(14), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(15), op: Sub, bit_size: U32, lhs: Relative(14), rhs: Relative(2) }, JumpIf { condition: Relative(10), location: 119 }, Jump { location: 121 }, Mov { destination: Relative(11), source: Relative(15) }, Jump { location: 123 }, Mov { destination: Relative(11), source: Relative(2) }, Jump { location: 123 }, BinaryIntOp { destination: Relative(4), op: Div, bit_size: U32, lhs: Relative(7), rhs: Relative(11) }, BinaryIntOp { destination: Relative(12), op: Xor, bit_size: U1, lhs: Relative(5), rhs: Relative(10) }, JumpIf { condition: Relative(12), location: 127 }, Jump { location: 129 }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(4), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(4) }, BinaryIntOp { destination: Relative(2), op: Equals, bit_size: U32, lhs: Relative(4), rhs: Relative(8) }, JumpIf { condition: Relative(2), location: 133 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(4), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(6) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(6) }, JumpIf { condition: Relative(4), location: 139 }, Jump { location: 141 }, Mov { destination: Relative(5), source: Relative(14) }, Jump { location: 143 }, Mov { destination: Relative(5), source: Relative(6) }, Jump { location: 143 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(7), op: LessThan, bit_size: U32, lhs: Relative(12), rhs: Relative(9) }, Const { destination: Relative(13), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(14), op: Sub, bit_size: U32, lhs: Relative(13), rhs: Relative(9) }, JumpIf { condition: Relative(7), location: 149 }, Jump { location: 151 }, Mov { destination: Relative(10), source: Relative(14) }, Jump { location: 153 }, Mov { destination: Relative(10), source: Relative(9) }, Jump { location: 153 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(5), rhs: Relative(10) }, BinaryIntOp { destination: Relative(11), op: Xor, bit_size: U1, lhs: Relative(4), rhs: Relative(7) }, JumpIf { condition: Relative(11), location: 157 }, Jump { location: 159 }, Const { destination: Relative(12), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(12), rhs: Relative(2) }, BinaryIntOp { destination: Relative(4), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(3) }, JumpIf { condition: Relative(4), location: 163 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(3), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(1) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 169 }, Jump { location: 171 }, Mov { destination: Relative(4), source: Relative(12) }, Jump { location: 173 }, Mov { destination: Relative(4), source: Relative(1) }, Jump { location: 173 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 2147483647 }, BinaryIntOp { destination: Relative(5), op: LessThan, bit_size: U32, lhs: Relative(10), rhs: Relative(9) }, Const { destination: Relative(11), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(12), op: Sub, bit_size: U32, lhs: Relative(11), rhs: Relative(9) }, JumpIf { condition: Relative(5), location: 179 }, Jump { location: 181 }, Mov { destination: Relative(6), source: Relative(12) }, Jump { location: 183 }, Mov { destination: Relative(6), source: Relative(9) }, Jump { location: 183 }, BinaryIntOp { destination: Relative(2), op: Div, bit_size: U32, lhs: Relative(4), rhs: Relative(6) }, BinaryIntOp { destination: Relative(7), op: Xor, bit_size: U1, lhs: Relative(3), rhs: Relative(5) }, JumpIf { condition: Relative(7), location: 187 }, Jump { location: 189 }, Const { destination: Relative(10), bit_size: Integer(U32), value: 0 }, BinaryIntOp { destination: Relative(2), op: Sub, bit_size: U32, lhs: Relative(10), rhs: Relative(2) }, BinaryIntOp { destination: Relative(1), op: Equals, bit_size: U32, lhs: Relative(2), rhs: Relative(8) }, JumpIf { condition: Relative(1), location: 193 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(3) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 199 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 5019202896831570965 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZfNTipBEIXfZdYspqr611cxxiCOhoQAQbjJjeHdb7VVB3ExhMx4N3wH8Xw0TfXofHavw8vp/Xm9fdt9dA+Pn93LYb3ZrN+fN7vV8rjebfWnn13fHqh2D7TouDeQgQ1iCIZoSIZsKAaziFnELGIWMYuYRcwiZhGziFnELMEswSzBLMEswSxBLaxIhmwoBrXkRRfVUhRkUEtViKFZemVbTFS21SRlW07rFmdbkLaTuliUKuOgVBtrL4lTfaz91JalvZSc2Vmc1Zh7JznZKc7gdF92X3Zfdl92X2k+XWchJzvFGZzNp5+/JGd2Fmc11t5JTnaKMzjdV91X3VfdV9Unus/U9wiEwAjqFGohIESEhJARCkL1QD0CITACzAQzwUwwE8wEM8HMMDPMDDPDzDAzzAwzw8wwt0MiOqDUjokFQmCEZpYWAkJESAgZoSBUD+3oWCAERoA5wBxgDjAHmAPMAeYIc4Q5whxhjjBHmCPMEeYIcztbomeJ2uGyQAiM0MyxhYAQERJCRigI1UM7ZhYIgRFgzjBnmDPMGeYMc4a5wFxgLjAXmAvMBeYCc4G5wNxOnugVhNrRs0AIzZzO50WHq/fz8TAM7eJ9dTnXi/x+eRi2x+5he9psFt2f5eb09Usf++X2i8flQV/VMzdsX5UqfFtvhpbOi+92P17VxXmZarzU44Q+9/2EPktBP46+v4z3S6jZBSUSXQxSfxjCuCHnSm7IhdKYId7Ygz73gl3UXMYcadwhOVRXSE58MRDfv4oU6XsV1M/dC5Yxw73fB4/uxK2JyJeJGJ9IotkjQTx7Jkh+YSgozJ6K2+u4cyzu3o/xubj7W5k0GEIYDJHxwaizB4P72YPB9AuDwTx7MG6v487BuHs/bgxG/a+DcfkccrUV9/8Nuu7nKf1y6Vee2Z/y/oHQD8zz+iJT+imgX2hmP03oR8IAXc/PpL4O3XX/SZ8tV+vDj5vsczMd1suXzeBP307b1dWrx797vIKb9P1htxpeT4ehma7u1PXxkWpYUK1P7UZFn+r/UQvu+enc3v4f", + "debug_symbols": "tZfNTipBEIXfZdYspqr611cxxiCOhoQAQbjJjeHdb7VVB3ExhMx4N3wH8Xw0TfXofHavw8vp/Xm9fdt9dA+Pn93LYb3ZrN+fN7vV8rjebfWnn13fHqh2D7TouDeQgQ1iCIZoSIZsKAaziFnELGIWMYuYRcwiZhGziFnELMEswSzBLMEswSxBLaxIhmwoBrXkRRfVUhRkUEtViKFZemVbTFS21SRlW07rFmdbkLaTuliUKuOgVBtrL4lTfaz91JalvZSc2Vmc1Zh7JznZKc7gdF92X3Zfdl92X2k+XWchJzvFGZzNp5+/JGd2Fmc11t5JTnaKMzjdV91X3VfdV9Unus/U9wiEwAjqFGohIESEhJARCkL1QD0CITACzAQzwUwwE8wEM8HMMDPMDDPDzDAzzAwzw8wwt0MiOqDUjokFQmCEZpYWAkJESAgZoSBUD+3oWCAERoA5wBxgDjAHmAPMAeYIc4Q5whxhjjBHmCPMEeYIcztbomeJ2uGyQAiM0MyxhYAQERJCRigI1UM7ZhYIgRFgzjBnmDPMGeYMc4a5wFxgLjAXmAvMBeYCc4G5wNxOnugVhNrRs0AIzZzO50WHq/fz8TAM7eJ9dTnXi/x+eRi2x+5he9psFt2f5eb09Usf++X2i8flQV/VMzdsX5UqfFtvhpbOi+92P17VxXmZarzU44Q+9/2EPktBP46+v4z3S6jZBSUSXQxSfxjCuCHnSm7IhdKYId7Ygz73gl3UXMYcadwRcrtWfClCDt87QXz/KlKk71VQP3cvWMYM934fPLoTtyYiXyZifCKJZo8E8eyZIPmFoaAweypur+POsbh7P8bn4u5vZdJgCGEwRMYHo84eDO5nDwbTLwwG8+zBuL2OOwfj7v24MRj1vw7G5XNI4gl/g677eUq/XPqVZ/anvH8g9APzvL7IlH4K6Bea2U8T+pEwQNfzM6mvQ3fdf9Jny9X68OMm+9xMh/XyZTP407fTdnX16vHvHq/gJn1/2K2G19NhaKarO3V9fKQaFlTrU7tR0af6f9SCe346t7f/Bw==", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { 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 b76fff51d79..b73a67cd310 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_3824: u32 = x - 1_u32; - slice[i_3824] = slice[x]; + let i_3857: u32 = x - 1_u32; + slice[i_3857] = 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_3825: u32 = x - 1_u32; - slice[i_3825] = slice[x]; + let i_3858: u32 = x - 1_u32; + slice[i_3858] = slice[x]; } } else { slice[x] = 0_Field; diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap index b26fc90234f..7ad9ade1f31 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_-9223372036854775808.snap @@ -77,10 +77,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tZXdjqMwDIXfJddc2PnPvMpqVdE2HSEhWjEw0qqad18TDKUruep2NDc+QDifEttJruqY9+P7rulO5w/19uuq9n3Tts37rj0f6qE5d/T1+lWp5XU39DnTJ7UZJ9el7nM3qLdubNtKfdbtWH76uNRd0aHuaRQqlbsjKQFPTZunp6/q5gbZmpC9CG51u3s7yvbgrGZAcD6sBJPuCFomIHh3m4N3XmIYmWGCTYwwweuVgPq1WQSAb68koMh4Np/BSISnCopGKugDO+qw+C1K/iT7PYBjgAcjp+DRFMB6WPNovRMh+O2W+I95hPDiYqzZQKIIsTLEorfMoMcoLebJsqZX2sKvi9jk4d9zIjxqS1waM6ERNznGR6mMZl0FRGdfhGjYQMTm0vCj9bjlM96fu7/prT40/d1FoTSdB5UyJdoSXYm+xFBiLDGViDALzjLbkfyUGiQA0iZFx+pZA2tkTbNqYEVWzWpYmacnniclnqZi68AaWdOsBliRVbMaVsvqWCfetIM/676p923mq/M0dofNTTr8uSwjy1176c+HfBz7PCWzjFF6/wI=", + "debug_symbols": "tZXbioMwEIbfJddezOSofZVlKbZNiyC2WF1YSt99YxxPCyNdy97MV03/n8zB5CFO/tBe9kV1vt7F7uMhDnVRlsVlX16PeVNcq/D28UzE8Lhvau/DKzFbD6pbXvuqEbuqLctEfOVlG/90v+VVZJPXYRUS4atTYDA8F6Xvfj2TSQ28NEPSIphRbZZy5OXOaEkGzlg3Oqhs4SB5BwRrpj1YYzkPxXtop4ZdaKenPFBu24UDeDsTh6zHq/V0inN4qaGouIauyFG6Qa+R02e83gIYMrCg+BKsbQG0hbGO2hrWBN8eiT/sw7mNyWg1M0lZE82bGNRDVwwa5JJ5sa3ZlrGwYxKzOvw+J9zaWOIwmBkq9iPHdK2UqRqzgNTojSYSZibscEn4135M9UyX5+5neMqPRb24KIQM50EiVIw6RhOjjdHFmMaYxYjQA3v0cgz6UBoMBhg+UjRES3TElJj1lEBEoiQqIvnJzs8GBj8Zmi0dMSVmPRUQkSiJiqiJhtj5yWdXzLrID6Wnq/PcVsfZTdp834aV4a691dejP7W174oZ10J5fwA=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_0.snap index b26fc90234f..7ad9ade1f31 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_0.snap @@ -77,10 +77,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tZXdjqMwDIXfJddc2PnPvMpqVdE2HSEhWjEw0qqad18TDKUruep2NDc+QDifEttJruqY9+P7rulO5w/19uuq9n3Tts37rj0f6qE5d/T1+lWp5XU39DnTJ7UZJ9el7nM3qLdubNtKfdbtWH76uNRd0aHuaRQqlbsjKQFPTZunp6/q5gbZmpC9CG51u3s7yvbgrGZAcD6sBJPuCFomIHh3m4N3XmIYmWGCTYwwweuVgPq1WQSAb68koMh4Np/BSISnCopGKugDO+qw+C1K/iT7PYBjgAcjp+DRFMB6WPNovRMh+O2W+I95hPDiYqzZQKIIsTLEorfMoMcoLebJsqZX2sKvi9jk4d9zIjxqS1waM6ERNznGR6mMZl0FRGdfhGjYQMTm0vCj9bjlM96fu7/prT40/d1FoTSdB5UyJdoSXYm+xFBiLDGViDALzjLbkfyUGiQA0iZFx+pZA2tkTbNqYEVWzWpYmacnniclnqZi68AaWdOsBliRVbMaVsvqWCfetIM/676p923mq/M0dofNTTr8uSwjy1176c+HfBz7PCWzjFF6/wI=", + "debug_symbols": "tZXbioMwEIbfJddezOSofZVlKbZNiyC2WF1YSt99YxxPCyNdy97MV03/n8zB5CFO/tBe9kV1vt7F7uMhDnVRlsVlX16PeVNcq/D28UzE8Lhvau/DKzFbD6pbXvuqEbuqLctEfOVlG/90v+VVZJPXYRUS4atTYDA8F6Xvfj2TSQ28NEPSIphRbZZy5OXOaEkGzlg3Oqhs4SB5BwRrpj1YYzkPxXtop4ZdaKenPFBu24UDeDsTh6zHq/V0inN4qaGouIauyFG6Qa+R02e83gIYMrCg+BKsbQG0hbGO2hrWBN8eiT/sw7mNyWg1M0lZE82bGNRDVwwa5JJ5sa3ZlrGwYxKzOvw+J9zaWOIwmBkq9iPHdK2UqRqzgNTojSYSZibscEn4135M9UyX5+5neMqPRb24KIQM50EiVIw6RhOjjdHFmMaYxYjQA3v0cgz6UBoMBhg+UjRES3TElJj1lEBEoiQqIvnJzs8GBj8Zmi0dMSVmPRUQkSiJiqiJhtj5yWdXzLrID6Wnq/PcVsfZTdp834aV4a691dejP7W174oZ10J5fwA=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_9223372036854775807.snap index b26fc90234f..7ad9ade1f31 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_false_inliner_9223372036854775807.snap @@ -77,10 +77,10 @@ expression: artifact "unconstrained func 1", "[Const { destination: Direct(21), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(20), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(0), size_address: Direct(21), offset_address: Direct(20) }, Const { destination: Direct(2), bit_size: Field, value: 0 }, BinaryFieldOp { destination: Direct(3), op: Equals, lhs: Direct(0), rhs: Direct(2) }, JumpIf { condition: Direct(3), location: 8 }, Const { destination: Direct(1), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Direct(0), op: Div, lhs: Direct(1), rhs: Direct(0) }, Stop { return_data: HeapVector { pointer: Direct(20), size: Direct(21) } }]" ], - "debug_symbols": "tZXdjqMwDIXfJddc2PnPvMpqVdE2HSEhWjEw0qqad18TDKUruep2NDc+QDifEttJruqY9+P7rulO5w/19uuq9n3Tts37rj0f6qE5d/T1+lWp5XU39DnTJ7UZJ9el7nM3qLdubNtKfdbtWH76uNRd0aHuaRQqlbsjKQFPTZunp6/q5gbZmpC9CG51u3s7yvbgrGZAcD6sBJPuCFomIHh3m4N3XmIYmWGCTYwwweuVgPq1WQSAb68koMh4Np/BSISnCopGKugDO+qw+C1K/iT7PYBjgAcjp+DRFMB6WPNovRMh+O2W+I95hPDiYqzZQKIIsTLEorfMoMcoLebJsqZX2sKvi9jk4d9zIjxqS1waM6ERNznGR6mMZl0FRGdfhGjYQMTm0vCj9bjlM96fu7/prT40/d1FoTSdB5UyJdoSXYm+xFBiLDGViDALzjLbkfyUGiQA0iZFx+pZA2tkTbNqYEVWzWpYmacnniclnqZi68AaWdOsBliRVbMaVsvqWCfetIM/676p923mq/M0dofNTTr8uSwjy1176c+HfBz7PCWzjFF6/wI=", + "debug_symbols": "tZXbioMwEIbfJddezOSofZVlKbZNiyC2WF1YSt99YxxPCyNdy97MV03/n8zB5CFO/tBe9kV1vt7F7uMhDnVRlsVlX16PeVNcq/D28UzE8Lhvau/DKzFbD6pbXvuqEbuqLctEfOVlG/90v+VVZJPXYRUS4atTYDA8F6Xvfj2TSQ28NEPSIphRbZZy5OXOaEkGzlg3Oqhs4SB5BwRrpj1YYzkPxXtop4ZdaKenPFBu24UDeDsTh6zHq/V0inN4qaGouIauyFG6Qa+R02e83gIYMrCg+BKsbQG0hbGO2hrWBN8eiT/sw7mNyWg1M0lZE82bGNRDVwwa5JJ5sa3ZlrGwYxKzOvw+J9zaWOIwmBkq9iPHdK2UqRqzgNTojSYSZibscEn4135M9UyX5+5neMqPRb24KIQM50EiVIw6RhOjjdHFmMaYxYjQA3v0cgz6UBoMBhg+UjRES3TElJj1lEBEoiQqIvnJzs8GBj8Zmi0dMSVmPRUQkSiJiqiJhtj5yWdXzLrID6Wnq/PcVsfZTdp834aV4a691dejP7W174oZ10J5fwA=", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap index aa422d31fe2..c1043dea138 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_-9223372036854775808.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U8) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 48 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(3), rhs: Relative(4) }, Const { destination: Relative(3), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Relative(4), op: Sub, lhs: Relative(5), rhs: Relative(3) }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U8) }, Cast { destination: Relative(5), source: Relative(6), bit_size: Field }, Cast { destination: Relative(4), source: Relative(5), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U8, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 29 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Add, lhs: Relative(4), rhs: Relative(3) }, Cast { destination: Relative(5), source: Relative(2), bit_size: Integer(U8) }, Cast { destination: Relative(3), source: Relative(5), bit_size: Field }, Cast { destination: Relative(2), source: Relative(3), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 38 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(4), rhs: Relative(4) }, Cast { destination: Relative(3), source: Relative(1), bit_size: Integer(U8) }, Cast { destination: Relative(2), source: Relative(3), bit_size: Field }, Cast { destination: Relative(1), source: Relative(2), bit_size: Integer(U8) }, Const { destination: Relative(2), bit_size: Integer(U8), value: 1 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(1), rhs: Relative(2) }, JumpIf { condition: Relative(3), location: 47 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 53 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZXbjoIwEED/pc88dDq9wa8YY1CrISFoEDbZGP59BymImwxxMfvCAeucdqYDvYtj2LfnXVGdLjeRbe5iXxdlWZx35eWQN8Wlol/vQvYXcCLTiQAvMkNIH1A0ZAkwQInMEXCAHmBE5gl2gBvgB5AFVCKQNIBE8gBpUUViJKmAJkATaSNdJOkgJZJPQSK0jIRI8imaR2OkjjSRtmfXJWLMe9fUIfRpzwpB5bnmdagakVVtWSbiKy/bx59u17x6sMlrGpWJCNWRSMJTUYb+rkue0ZIPTSHGgjRTtHkNBz7cGa2iwBnrJgOmLwbFG0Ba81yDNZZzIO9Ap9OoQGfVZAC1bhVOyo8zccA63q2nQ87w1oYCchu6EA7KjfEauPiUj7dSmiiwEvkSLC1BaiunOmprWAl83BJ/WIdzK5PROJN4VqJ5iQaro4NuPZfMm9uarmkLOyUxq8Pv74RbaksYGzMFZF9y8Eul9DhlIb3RKyVKziRscyn5r/vxrKd//e5u6Sk/FPXLidj1prrI92WIj6e2OsxGm+/rODKeqNf6cgjHtg69aXas0nWjfWJw2/Wz/QA=", + "debug_symbols": "tZVRboMwDEDvkm8+4sROAleZpoq26YSEaMVg0lRx95kSKJ3kqmu1H15p8EvsGHJW+7jtPzZVczh+quLtrLZtVdfVx6Y+7squOjb871np8QJeFZgpCKogRn6B4SHHgAlGFZ5hJ+AEUkVguAl+QpjAFjCZsqwBy2QPsNaaRJvIKuAJLCW6RJ/IOsiZ7DOQKdSJkMg+w/OgTcRESnQjhyFTc96bro1xTHtVCC7PqWxj06mi6es6U19l3V8e+jyVzYVd2fKozlRs9kwWHqo6jr+G7Bqt5dAcUixoWqLpNhzkcE9oksCT84vB5jcGIxtAO7quwZGTHFZ2oLfzKtDjNQ8wz63Ca/1yJh5Ex6P19FYyPLShYKUNvRMOxs/xCFJ8Lsc7rSkJnLZyCe4tQaPTSx3RkSiBl1viD+vw/slk0K4kQZSgLCHAeVcICKRkHtzW/Jm2cEsSqzr8/k74e20Jc2PmYMWXHMK9Uga7ZKED4ZMSo1cSsbmM/tf9uNYz3H533/mu3FXtzYk4jKa2Krd1TLeHvtmtRrvv0zwyn6in9riL+76No2l1rPL1DUNG9n0YZ/sB", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_0.snap index aa422d31fe2..c1043dea138 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_0.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U8) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 48 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(3), rhs: Relative(4) }, Const { destination: Relative(3), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Relative(4), op: Sub, lhs: Relative(5), rhs: Relative(3) }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U8) }, Cast { destination: Relative(5), source: Relative(6), bit_size: Field }, Cast { destination: Relative(4), source: Relative(5), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U8, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 29 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Add, lhs: Relative(4), rhs: Relative(3) }, Cast { destination: Relative(5), source: Relative(2), bit_size: Integer(U8) }, Cast { destination: Relative(3), source: Relative(5), bit_size: Field }, Cast { destination: Relative(2), source: Relative(3), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 38 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(4), rhs: Relative(4) }, Cast { destination: Relative(3), source: Relative(1), bit_size: Integer(U8) }, Cast { destination: Relative(2), source: Relative(3), bit_size: Field }, Cast { destination: Relative(1), source: Relative(2), bit_size: Integer(U8) }, Const { destination: Relative(2), bit_size: Integer(U8), value: 1 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(1), rhs: Relative(2) }, JumpIf { condition: Relative(3), location: 47 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 53 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZXbjoIwEED/pc88dDq9wa8YY1CrISFoEDbZGP59BymImwxxMfvCAeucdqYDvYtj2LfnXVGdLjeRbe5iXxdlWZx35eWQN8Wlol/vQvYXcCLTiQAvMkNIH1A0ZAkwQInMEXCAHmBE5gl2gBvgB5AFVCKQNIBE8gBpUUViJKmAJkATaSNdJOkgJZJPQSK0jIRI8imaR2OkjjSRtmfXJWLMe9fUIfRpzwpB5bnmdagakVVtWSbiKy/bx59u17x6sMlrGpWJCNWRSMJTUYb+rkue0ZIPTSHGgjRTtHkNBz7cGa2iwBnrJgOmLwbFG0Ba81yDNZZzIO9Ap9OoQGfVZAC1bhVOyo8zccA63q2nQ87w1oYCchu6EA7KjfEauPiUj7dSmiiwEvkSLC1BaiunOmprWAl83BJ/WIdzK5PROJN4VqJ5iQaro4NuPZfMm9uarmkLOyUxq8Pv74RbaksYGzMFZF9y8Eul9DhlIb3RKyVKziRscyn5r/vxrKd//e5u6Sk/FPXLidj1prrI92WIj6e2OsxGm+/rODKeqNf6cgjHtg69aXas0nWjfWJw2/Wz/QA=", + "debug_symbols": "tZVRboMwDEDvkm8+4sROAleZpoq26YSEaMVg0lRx95kSKJ3kqmu1H15p8EvsGHJW+7jtPzZVczh+quLtrLZtVdfVx6Y+7squOjb871np8QJeFZgpCKogRn6B4SHHgAlGFZ5hJ+AEUkVguAl+QpjAFjCZsqwBy2QPsNaaRJvIKuAJLCW6RJ/IOsiZ7DOQKdSJkMg+w/OgTcRESnQjhyFTc96bro1xTHtVCC7PqWxj06mi6es6U19l3V8e+jyVzYVd2fKozlRs9kwWHqo6jr+G7Bqt5dAcUixoWqLpNhzkcE9oksCT84vB5jcGIxtAO7quwZGTHFZ2oLfzKtDjNQ8wz63Ca/1yJh5Ex6P19FYyPLShYKUNvRMOxs/xCFJ8Lsc7rSkJnLZyCe4tQaPTSx3RkSiBl1viD+vw/slk0K4kQZSgLCHAeVcICKRkHtzW/Jm2cEsSqzr8/k74e20Jc2PmYMWXHMK9Uga7ZKED4ZMSo1cSsbmM/tf9uNYz3H533/mu3FXtzYk4jKa2Krd1TLeHvtmtRrvv0zwyn6in9riL+76No2l1rPL1DUNG9n0YZ/sB", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": { diff --git a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_9223372036854775807.snap b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_9223372036854775807.snap index aa422d31fe2..c1043dea138 100644 --- a/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_9223372036854775807.snap +++ b/tooling/nargo_cli/tests/snapshots/execution_success/wrapping_operations/execute__tests__force_brillig_true_inliner_9223372036854775807.snap @@ -44,10 +44,10 @@ expression: artifact "unconstrained func 0", "[Const { destination: Direct(2), bit_size: Integer(U32), value: 1 }, Const { destination: Direct(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Direct(0), bit_size: Integer(U32), value: 3 }, Const { destination: Relative(3), bit_size: Integer(U32), value: 2 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, CalldataCopy { destination_address: Direct(32836), size_address: Relative(3), offset_address: Relative(4) }, Cast { destination: Direct(32836), source: Direct(32836), bit_size: Integer(U8) }, Cast { destination: Direct(32837), source: Direct(32837), bit_size: Integer(U8) }, Mov { destination: Relative(1), source: Direct(32836) }, Mov { destination: Relative(2), source: Direct(32837) }, Call { location: 15 }, Call { location: 16 }, Const { destination: Relative(1), bit_size: Integer(U32), value: 32838 }, Const { destination: Relative(2), bit_size: Integer(U32), value: 0 }, Stop { return_data: HeapVector { pointer: Relative(1), size: Relative(2) } }, Return, Call { location: 48 }, Cast { destination: Relative(3), source: Relative(1), bit_size: Field }, Const { destination: Relative(4), bit_size: Field, value: 340282366920938463463374607431768211456 }, BinaryFieldOp { destination: Relative(5), op: Add, lhs: Relative(3), rhs: Relative(4) }, Const { destination: Relative(3), bit_size: Field, value: 1 }, BinaryFieldOp { destination: Relative(4), op: Sub, lhs: Relative(5), rhs: Relative(3) }, Cast { destination: Relative(6), source: Relative(4), bit_size: Integer(U8) }, Cast { destination: Relative(5), source: Relative(6), bit_size: Field }, Cast { destination: Relative(4), source: Relative(5), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(5), op: Equals, bit_size: U8, lhs: Relative(4), rhs: Relative(2) }, JumpIf { condition: Relative(5), location: 29 }, Const { destination: Relative(6), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(6) } }, Cast { destination: Relative(4), source: Relative(2), bit_size: Field }, BinaryFieldOp { destination: Relative(2), op: Add, lhs: Relative(4), rhs: Relative(3) }, Cast { destination: Relative(5), source: Relative(2), bit_size: Integer(U8) }, Cast { destination: Relative(3), source: Relative(5), bit_size: Field }, Cast { destination: Relative(2), source: Relative(3), bit_size: Integer(U8) }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(2), rhs: Relative(1) }, JumpIf { condition: Relative(3), location: 38 }, Const { destination: Relative(5), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(5) } }, BinaryFieldOp { destination: Relative(1), op: Mul, lhs: Relative(4), rhs: Relative(4) }, Cast { destination: Relative(3), source: Relative(1), bit_size: Integer(U8) }, Cast { destination: Relative(2), source: Relative(3), bit_size: Field }, Cast { destination: Relative(1), source: Relative(2), bit_size: Integer(U8) }, Const { destination: Relative(2), bit_size: Integer(U8), value: 1 }, BinaryIntOp { destination: Relative(3), op: Equals, bit_size: U8, lhs: Relative(1), rhs: Relative(2) }, JumpIf { condition: Relative(3), location: 47 }, Const { destination: Relative(4), bit_size: Integer(U32), value: 0 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Relative(4) } }, Return, Const { destination: Direct(32772), bit_size: Integer(U32), value: 30720 }, BinaryIntOp { destination: Direct(32771), op: LessThan, bit_size: U32, lhs: Direct(0), rhs: Direct(32772) }, JumpIf { condition: Direct(32771), location: 53 }, IndirectConst { destination_pointer: Direct(1), bit_size: Integer(U64), value: 17843811134343075018 }, Trap { revert_data: HeapVector { pointer: Direct(1), size: Direct(2) } }, Return]" ], - "debug_symbols": "tZXbjoIwEED/pc88dDq9wa8YY1CrISFoEDbZGP59BymImwxxMfvCAeucdqYDvYtj2LfnXVGdLjeRbe5iXxdlWZx35eWQN8Wlol/vQvYXcCLTiQAvMkNIH1A0ZAkwQInMEXCAHmBE5gl2gBvgB5AFVCKQNIBE8gBpUUViJKmAJkATaSNdJOkgJZJPQSK0jIRI8imaR2OkjjSRtmfXJWLMe9fUIfRpzwpB5bnmdagakVVtWSbiKy/bx59u17x6sMlrGpWJCNWRSMJTUYb+rkue0ZIPTSHGgjRTtHkNBz7cGa2iwBnrJgOmLwbFG0Ba81yDNZZzIO9Ap9OoQGfVZAC1bhVOyo8zccA63q2nQ87w1oYCchu6EA7KjfEauPiUj7dSmiiwEvkSLC1BaiunOmprWAl83BJ/WIdzK5PROJN4VqJ5iQaro4NuPZfMm9uarmkLOyUxq8Pv74RbaksYGzMFZF9y8Eul9DhlIb3RKyVKziRscyn5r/vxrKd//e5u6Sk/FPXLidj1prrI92WIj6e2OsxGm+/rODKeqNf6cgjHtg69aXas0nWjfWJw2/Wz/QA=", + "debug_symbols": "tZVRboMwDEDvkm8+4sROAleZpoq26YSEaMVg0lRx95kSKJ3kqmu1H15p8EvsGHJW+7jtPzZVczh+quLtrLZtVdfVx6Y+7squOjb871np8QJeFZgpCKogRn6B4SHHgAlGFZ5hJ+AEUkVguAl+QpjAFjCZsqwBy2QPsNaaRJvIKuAJLCW6RJ/IOsiZ7DOQKdSJkMg+w/OgTcRESnQjhyFTc96bro1xTHtVCC7PqWxj06mi6es6U19l3V8e+jyVzYVd2fKozlRs9kwWHqo6jr+G7Bqt5dAcUixoWqLpNhzkcE9oksCT84vB5jcGIxtAO7quwZGTHFZ2oLfzKtDjNQ8wz63Ca/1yJh5Ex6P19FYyPLShYKUNvRMOxs/xCFJ8Lsc7rSkJnLZyCe4tQaPTSx3RkSiBl1viD+vw/slk0K4kQZSgLCHAeVcICKRkHtzW/Jm2cEsSqzr8/k74e20Jc2PmYMWXHMK9Uga7ZKED4ZMSo1cSsbmM/tf9uNYz3H533/mu3FXtzYk4jKa2Krd1TLeHvtmtRrvv0zwyn6in9riL+76No2l1rPL1DUNG9n0YZ/sB", "file_map": { "12": { - "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", + "source": "// docs:start:from-trait\npub trait From {\n fn from(input: T) -> Self;\n}\n// docs:end:from-trait\n\nimpl From for T {\n fn from(input: T) -> T {\n input\n }\n}\n\n// docs:start:into-trait\npub trait Into {\n fn into(self) -> T;\n}\n\nimpl Into for U\nwhere\n T: From,\n{\n fn into(self) -> T {\n T::from(self)\n }\n}\n// docs:end:into-trait\n\n// docs:start:from-impls\n// Unsigned integers\n\nimpl From for u16 {\n fn from(value: u8) -> u16 {\n value as u16\n }\n}\n\nimpl From for u32 {\n fn from(value: u8) -> u32 {\n value as u32\n }\n}\n\nimpl From for u32 {\n fn from(value: u16) -> u32 {\n value as u32\n }\n}\n\nimpl From for u64 {\n fn from(value: u8) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u16) -> u64 {\n value as u64\n }\n}\n\nimpl From for u64 {\n fn from(value: u32) -> u64 {\n value as u64\n }\n}\n\nimpl From for u128 {\n fn from(value: u8) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u16) -> u128 {\n value as u128\n }\n}\n\nimpl From for u128 {\n fn from(value: u32) -> u128 {\n value as u128\n }\n}\nimpl From for u128 {\n fn from(value: u64) -> u128 {\n value as u128\n }\n}\n\nimpl From for Field {\n fn from(value: u8) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u16) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u32) -> Field {\n value as Field\n }\n}\nimpl From for Field {\n fn from(value: u64) -> Field {\n value as Field\n }\n}\n\nimpl From for Field {\n fn from(value: u128) -> Field {\n value as Field\n }\n}\n\n// Signed integers\n\nimpl From for i16 {\n fn from(value: i8) -> i16 {\n value as i16\n }\n}\n\nimpl From for i32 {\n fn from(value: i8) -> i32 {\n value as i32\n }\n}\n\nimpl From for i32 {\n fn from(value: i16) -> i32 {\n value as i32\n }\n}\n\nimpl From for i64 {\n fn from(value: i8) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i16) -> i64 {\n value as i64\n }\n}\n\nimpl From for i64 {\n fn from(value: i32) -> i64 {\n value as i64\n }\n}\n\n// Booleans\nimpl From for u8 {\n fn from(value: bool) -> u8 {\n value as u8\n }\n}\nimpl From for u16 {\n fn from(value: bool) -> u16 {\n value as u16\n }\n}\nimpl From for u32 {\n fn from(value: bool) -> u32 {\n value as u32\n }\n}\nimpl From for u64 {\n fn from(value: bool) -> u64 {\n value as u64\n }\n}\nimpl From for u128 {\n fn from(value: bool) -> u128 {\n value as u128\n }\n}\nimpl From for i8 {\n fn from(value: bool) -> i8 {\n value as i8\n }\n}\nimpl From for i16 {\n fn from(value: bool) -> i16 {\n value as i16\n }\n}\nimpl From for i32 {\n fn from(value: bool) -> i32 {\n value as i32\n }\n}\nimpl From for i64 {\n fn from(value: bool) -> i64 {\n value as i64\n }\n}\nimpl From for Field {\n fn from(value: bool) -> Field {\n value as Field\n }\n}\n// docs:end:from-impls\n\n/// A generic interface for casting between primitive types,\n/// equivalent of using the `as` keyword between values.\n///\n/// # Example\n///\n/// ```\n/// let x: Field = 1234567890;\n/// let y: u8 = x as u8;\n/// let z: u8 = x.as_();\n/// assert_eq(y, z);\n/// ```\npub trait AsPrimitive {\n /// The equivalent of doing `self as T`.\n fn as_(self) -> T;\n}\n\n#[generate_as_primitive_impls]\ncomptime fn generate_as_primitive_impls(_: FunctionDefinition) -> Quoted {\n let types = [\n quote { bool },\n quote { u8 },\n quote { u16 },\n quote { u32 },\n quote { u64 },\n quote { u128 },\n quote { i8 },\n quote { i16 },\n quote { i32 },\n quote { i64 },\n ];\n\n let mut impls = &[];\n for type1 in types {\n for type2 in types {\n let body = if type1 == type2 {\n quote { self }\n } else if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for $type2 {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n }\n\n let u_types =\n [quote { bool }, quote { u8 }, quote { u16 }, quote { u32 }, quote { u64 }, quote { u128 }];\n\n for type2 in u_types {\n let body = quote { self as Field };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive for $type2 {\n fn as_(self) -> Field {\n $body\n }\n }\n },\n );\n }\n\n for type1 in u_types {\n let body = if type1 == quote { bool } {\n quote { self != 0 }\n } else {\n quote { self as $type1 }\n };\n\n impls = impls.push_back(\n quote {\n impl AsPrimitive<$type1> for Field {\n fn as_(self) -> $type1 {\n $body\n }\n }\n },\n );\n }\n\n impls.join(quote {})\n}\n", "path": "std/convert.nr" }, "39": {