Addresses deprecations reported by the latest Rust nightly while preserving Rust 1.98 compatibility.
- Rename `unit-bindings` to `unit_bindings`: hyphenated lint names are deprecated in favor of their canonical underscore spelling.
- Replace `isize::max_value()` and `usize::max_value()` with `isize::MAX` and `usize::MAX`: the legacy numeric methods are deprecated in favor of associated constants.
- Set explicit `MAX_INDEX` values on `define_index_type!`: `oxc_index` otherwise generates `<raw>::max_value() as usize`; the explicit modern constants avoid that deprecated expansion without changing the index limits.
- Remove obsolete `clippy::legacy_numeric_constants` expectations: the corrected code no longer triggers that lint, so the expectations would be unfulfilled.
- Allow the AST scanner to consume optional `define_index_type!` configuration: it previously parsed only the struct declaration and rejected the added `MAX_INDEX` option.
AI-assisted.
Use `implements!` macro (introduced in #24721) in various tests, including adding some new ones.
The most valuable change is replacing a `compile_fail` doctest which checks that `Arena` is not `Sync`. Using `assert!(implements!(Arena: !Sync));` is more robust.
Small refactor to `Arena`. Use `cmp::max(a, b)` instead of the chained version `a.max(b)`. I find the former clearer.
Also simplify one `max` operation (see comment in code).
Add a method `Arena::used_bytes` which `Allocator::used_bytes` utilizes. Re-implement it to avoid using `ChunkRawIter` iterator, which is slightly more performant.
`ChunkRawIter` is an iterator over pointer & length pairs for an `Arena`'s chunks. Alter it to return `NonNull<u8>` pointers instead of `*mut u8` pointers.
This is not a breaking change, as we do not expose the `Arena` type externally.
Fix a test for `Bump` which was failing on 32-bit in CI.
#21291 temporarily disabled the test. Turn out, there's no easy way to make this test work on 32-bit platforms, and #21510 added ample unit tests which effectively test the same thing.
So keep it disabled on 32-bit, but fix the test to make it work properly on 64-bit.
Rationale for the fix is explained in https://github.com/fitzgen/bumpalo/pull/320.
`Arena` had a feature which allowed setting an upper bound on the size of an allocator. This complicates the implementation and is not useful for our purposes (how would we gracefully handle running out of memory during parsing anyway?). So remove it.
`Arena::from_raw_parts` (used by raw transfer) does need a way to prevent an allocator growing beyond it's initial size (2 GiB), but we can provide that with a simpler method - just a `bool` which indicates if the arena can create new chunks or not.
Pure refactor. Rename `bump.rs` to `arena.rs`, and rename `bump` tests directory to `arena` - in line with renaming `Bump` to `Arena` (#21394).
No substantive changes, only renaming.