summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorMirko Adzic <adzicmirko97@gmail.com>2026-07-10 17:20:36 +0100
committerGary Guo <gary@garyguo.net>2026-07-13 12:11:29 +0100
commit7e4d9c946de525cac36bb693c42a147b8e9f03c5 (patch)
treebcf6f7713a0836d640ec1e41da0d2bda721a50b2 /tools/perf/scripts/python
parent751ecd5a19cf2c55807bf30f35bafc32e179a19c (diff)
rust: pin-init: make `[pin_]init_array_from_fn` unwind safe
The previous code only ran cleanup on the explicit error path. If the per- element initializer panicked partway through, the elements already written into the array would be leaked: their `Drop` impls would never run. This violates the pinning requirement. Fix the unwind safety issue by adding a guard type that drops element on both error and panic path. To avoid having to duplicate code between `pin_init_array_from_fn` and the non-pin variant, extract the code to a shared `ArrayInit` type; this type is internal and not visible via API. Reported-by: Gary Guo <gary@garyguo.net> Closes: https://github.com/Rust-for-Linux/pin-init/issues/136 Signed-off-by: Mirko Adzic <adzicmirko97@gmail.com> Link: https://patch.msgid.link/20260710-pin-init-sync-v1-6-8fa16cde87ae@garyguo.net [ Split guard type and the initializer type, move the guard type to be within __pinned_init. - Gary ] Co-developed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Gary Guo <gary@garyguo.net>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions