Skip to content

Commit

Permalink
transmute_copy soundness
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Oct 2, 2024
1 parent 3d14608 commit e916b56
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/polars-core/src/series/arithmetic/list_borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ impl Op {
// Safety: All operations return the same type
macro_rules! wrap {
($e:expr) => {
unsafe { core::mem::transmute_copy(&$e) }
// Safety: This performs a `Copy`, but `$e` could be a `Series`,
// so we need to wrap in `ManuallyDrop` to avoid double-free.
unsafe { core::mem::transmute_copy(&core::mem::ManuallyDrop::new($e)) }
};
}

Expand Down

0 comments on commit e916b56

Please sign in to comment.