Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions crates/oxc_index/src/idxslice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,14 @@ impl<I: Idx, T> IndexSlice<I, [T]> {
#[inline(always)]
pub fn from_slice(s: &[T]) -> &Self {
// SAFETY: `IndexSlice` is a thin wrapper around `[T]` with the added marker for the index.

unsafe { &*(core::ptr::from_ref::<[T]>(s) as *const Self) }
unsafe { &*(core::ptr::from_ref(s) as *const Self) }
}

/// Construct a new mutable IdxSlice by wrapping an existing mutable slice.
#[inline(always)]
pub fn from_slice_mut(s: &mut [T]) -> &mut Self {
// SAFETY: `IndexSlice` is a thin wrapper around `[T]` with the added marker for the index.

unsafe { &mut *(core::ptr::from_mut::<[T]>(s) as *mut Self) }
unsafe { &mut *(core::ptr::from_mut(s) as *mut Self) }
}

/// Copies `self` into a new `IndexVec`.
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_traverse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,5 @@ pub fn walk_program<'a, Tr: Traverse<'a>>(
ctx: &mut TraverseCtx<'a>,
) {
// SAFETY: Walk functions are constructed to avoid unsoundness
unsafe { walk::walk_program(traverser, std::ptr::from_mut::<Program>(program), ctx) };
unsafe { walk::walk_program(traverser, std::ptr::from_mut(program), ctx) };
}