File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 22// SPDX-FileCopyrightText: Copyright the Vortex contributors
33
44use std:: fmt:: Debug ;
5+ use std:: mem:: transmute;
56use std:: sync:: Arc ;
67
78use arcref:: ArcRef ;
@@ -222,8 +223,7 @@ fn downcast_owned<V: VTable>(array: ArrayRef) -> Arc<V::Array> {
222223 . vortex_expect ( "Failed to downcast array to expected encoding type" ) ;
223224 // SAFETY: ArrayAdapter<V> is #[repr(transparent)] over V::Array,
224225 // so Arc<ArrayAdapter<V>> and Arc<V::Array> have identical layout.
225- let raw = Arc :: into_raw ( adapter) as * const V :: Array ;
226- unsafe { Arc :: from_raw ( raw) }
226+ unsafe { transmute :: < Arc < ArrayAdapter < V > > , Arc < V :: Array > > ( adapter) }
227227}
228228
229229/// Upcast an `Arc<V::Array>` into an `ArrayRef` without cloning.
@@ -233,6 +233,5 @@ fn downcast_owned<V: VTable>(array: ArrayRef) -> Arc<V::Array> {
233233pub ( crate ) fn upcast_array < V : VTable > ( array : Arc < V :: Array > ) -> ArrayRef {
234234 // SAFETY: ArrayAdapter<V> is #[repr(transparent)] over V::Array,
235235 // so Arc<V::Array> and Arc<ArrayAdapter<V>> have identical layout.
236- let raw = Arc :: into_raw ( array) as * const ArrayAdapter < V > ;
237- unsafe { Arc :: from_raw ( raw) }
236+ unsafe { transmute :: < Arc < V :: Array > , Arc < ArrayAdapter < V > > > ( array) }
238237}
You can’t perform that action at this time.
0 commit comments