Commit graph

20 commits

Author SHA1 Message Date
overlookmotel
9c1844a8a7 refactor(data_structures): remove NonNull shim (#8423)
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.
2025-01-11 01:18:53 +00:00
Boshen
a006955fcb build(rust): incompatible-rust-versions = "fallback" + cargo update (#8407) 2025-01-10 06:41:51 +00:00
overlookmotel
e0a09ab023 docs(data_structures): improve docs for stack types (#8356)
Improve docs for `Stack`, `NonEmptyStack` and `SparseStack`.
2025-01-08 20:49:28 +00:00
overlookmotel
46e2e27735 feat(data_structures): implement Default for NonEmptyStack (#7946)
Implement `Default` for `NonEmptyStack<T>` where `T: Default`.
2024-12-16 21:02:52 +00:00
overlookmotel
fb897f6c3a style(data_structures): add line break (#7882) 2024-12-14 13:16:49 +00:00
Boshen
7fb9d47460 style(rust): cargo +nightly fmt (#7877) 2024-12-14 06:03:31 +00:00
overlookmotel
defaf4bf2b feat(data_structures): add SparseStack::last_mut method (#7528)
Add `SparseStack::last_mut` method, as companion to `SparseStack::last`.
2024-11-28 16:39:34 +00:00
overlookmotel
d135d3ec48 feat(data_structures): add methods to SparseStack (#7305)
Add methods to `SparseStack` to get the filled entries as a slice, and get their length.
2024-11-16 05:36:36 +00:00
overlookmotel
b02114783a refactor(data_structures): make all methods of NonNull shim #[inline(always)] (#7024)
All these methods are trivial and should always be inlined.
2024-10-30 13:00:24 +00:00
overlookmotel
fb1710a8cc refactor(data_structures): add #[repr(transparent)] to NonNull shim (#7023)
Ensure `NonNull` shim is a pure wrapper around `std::ptr::NonNull`. This should be the case anyway, but make sure.
2024-10-30 13:00:22 +00:00
overlookmotel
f1fc8db2fb refactor(data_structures): add read method to NonNull shim (#7022)
Emulate [`NonNull::read`](https://doc.rust-lang.org/beta/std/ptr/struct.NonNull.html#method.read) method in `NonNull` shim. This is more ergonomic, and will be ideal usage once our MSRV reaches 1.80.0 and we can remove the shim.
2024-10-30 13:00:22 +00:00
overlookmotel
c58ec89b81 perf(data_structures): optimize NonEmptyStack::pop (#7021)
Shave a few bytes off `NonEmptyStack::pop`.
2024-10-30 13:00:21 +00:00
DonIsaac
de22b81b83 docs(data-structures): enable lint warnings on missing docs, and add missing doc comments (#6612)
Part of https://github.com/oxc-project/backlog/issues/130
2024-10-15 22:50:47 +00:00
overlookmotel
7cc05f1626 fix(data_structures): fix compilation failure on older Rust versions (#6526)
I thought I was being clever, but too clever = stupid.

The dummy code designed to flag when our MSRV is bumped and supports `NonNull::add` would fail to compile on Rust versions below 1.80.0. Precisely because of the condition this code is testing - it's not supported!

Fix this by skipping compilation unless running clippy.
2024-10-13 17:32:10 +00:00
overlookmotel
cc57541281 refactor(data_structures): NonEmptyStack::len hint that len is never 0 (#6220)
Tiny optimization. Make sure compiler knows that `NonEmptyStack::len` can never return 0.
2024-10-01 14:58:36 +00:00
overlookmotel
147a5d50fd refactor(data_structures): remove is_empty methods for non-empty stacks (#6219)
Remove `SparseStack::is_empty` method. It's pointless as the stack is never empty.

Add a dummy `NonEmptyStack::is_empty` method that always returns `false`. This is also pointless, but it overrides `slice::is_empty` which is otherwise accessible via `Deref`.
2024-10-01 14:58:35 +00:00
overlookmotel
61805fd3f2 refactor(data_structures): add debug assertion to SparseStack (#6218)
Just add an additional debug assert.
2024-10-01 12:26:38 +00:00
overlookmotel
7566c2d66f feat(data_structures): add as_slice + as_mut_slice methods to stacks (#6216)
Add `as_slice` and `as_mut_slice` methods to `Stack` and `NonEmptyStack`.
2024-10-01 12:26:36 +00:00
overlookmotel
dbfa0bc01f refactor(data_structures): add len method to StackCommon trait (#6215)
`len` method is in common between all stack types. Move it into `StackCommon` trait.
2024-10-01 12:26:35 +00:00
Boshen
c3c3447ac3 feat(data_structures): add oxc_data_structures crate; add stack (#6206) 2024-10-01 10:02:45 +00:00