diff --git a/changelog.d/8493-raw-handle-iter-methods.md b/changelog.d/8493-raw-handle-iter-methods.md new file mode 100644 index 0000000000..11b7432a8c --- /dev/null +++ b/changelog.d/8493-raw-handle-iter-methods.md @@ -0,0 +1 @@ +fix(lint): `array/iter_methods.rs` is back within its raw-handle ceiling (#8493). #8482 added four `get_raw_const_ptr` reads for the join helpers' post-collection receiver reload, taking the module to 6 bare reads against a ceiling of 2 and the workspace to 982 against a baseline of 978 — which turned `lint` red on `main` and, because `lint` is part of `pr-gate`, blocked every open PR. `normalize_array_receiver` only does tag-stripping and a header probe, so the scoped `with_const_ptr` form the ratchet recommends applies directly and preserves the rooting the fix added. diff --git a/crates/perry-runtime/src/array/iter_methods.rs b/crates/perry-runtime/src/array/iter_methods.rs index c7ddad0180..5a1eb632b1 100644 --- a/crates/perry-runtime/src/array/iter_methods.rs +++ b/crates/perry-runtime/src/array/iter_methods.rs @@ -1086,15 +1086,12 @@ fn join_exotic_element(arr: *const ArrayHeader, index: u32) -> (Option, *co let arr_handle = scope.root_raw_const_ptr(arr); let present = arr_handle.with_const_ptr(|arr| crate::array::array_spec_has_index(arr, index)); if !present { - return ( - None, - normalize_array_receiver(arr_handle.get_raw_const_ptr::()), - ); + return (None, arr_handle.with_const_ptr(normalize_array_receiver)); } let value = arr_handle.with_const_ptr(|arr| crate::array::array_spec_get(arr, index)); ( Some(value.to_bits()), - normalize_array_receiver(arr_handle.get_raw_const_ptr::()), + arr_handle.with_const_ptr(normalize_array_receiver), ) } @@ -1110,10 +1107,7 @@ fn join_element_to_string( let arr_handle = scope.root_raw_const_ptr(arr); let element_handle = scope.root_nanbox_u64(element_bits); let string = crate::value::js_jsvalue_to_string(element_handle.get_nanbox_f64()); - ( - string, - normalize_array_receiver(arr_handle.get_raw_const_ptr::()), - ) + (string, arr_handle.with_const_ptr(normalize_array_receiver)) } #[cold] @@ -1127,10 +1121,7 @@ fn join_bigint_to_string( let element_handle = scope.root_nanbox_u64(element_bits); let value = crate::value::JSValue::from_bits(element_handle.get_nanbox_u64()); let string = crate::bigint::js_bigint_to_string(value.as_bigint_ptr()); - ( - string, - normalize_array_receiver(arr_handle.get_raw_const_ptr::()), - ) + (string, arr_handle.with_const_ptr(normalize_array_receiver)) } /// join - Join array elements into a string with a separator