Skip to content

Commit

Permalink
refactor(data_structures): remove NonNull shim (#8423)
Browse files Browse the repository at this point in the history
The `NonNull` shim in `oxc_data_structures` was just to emulate native APIs which only became stable in Rust 1.80.0. #8407 bumped our MSRV to 1.80.0, so now we can remove the shim and use `std::ptr::NonNull` directly.
  • Loading branch information
overlookmotel committed Jan 11, 2025
1 parent 52f88c0 commit 9c1844a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 115 deletions.
5 changes: 3 additions & 2 deletions crates/oxc_data_structures/src/stack/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
use std::{
alloc::{self, Layout},
mem::{align_of, size_of},
ptr, slice,
ptr::{self, NonNull},
slice,
};

use assert_unchecked::assert_unchecked;

use super::{NonNull, StackCapacity};
use super::StackCapacity;

pub trait StackCommon<T>: StackCapacity<T> {
// Getter + setter methods defined by implementer
Expand Down
2 changes: 0 additions & 2 deletions crates/oxc_data_structures/src/stack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
mod capacity;
mod common;
mod non_empty;
mod non_null;
mod sparse;
mod standard;

use capacity::StackCapacity;
use common::StackCommon;
pub use non_empty::NonEmptyStack;
use non_null::NonNull;
pub use sparse::SparseStack;
pub use standard::Stack;
3 changes: 2 additions & 1 deletion crates/oxc_data_structures/src/stack/non_empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
use std::{
mem::size_of,
ops::{Deref, DerefMut},
ptr::NonNull,
};

use super::{NonNull, StackCapacity, StackCommon};
use super::{StackCapacity, StackCommon};

/// A stack which can never be empty.
///
Expand Down
109 changes: 0 additions & 109 deletions crates/oxc_data_structures/src/stack/non_null.rs

This file was deleted.

3 changes: 2 additions & 1 deletion crates/oxc_data_structures/src/stack/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
use std::{
mem::size_of,
ops::{Deref, DerefMut},
ptr::NonNull,
};

use super::{NonNull, StackCapacity, StackCommon};
use super::{StackCapacity, StackCommon};

/// A simple stack.
///
Expand Down

0 comments on commit 9c1844a

Please sign in to comment.