oxc/tasks
branchseer f159f60084
Make ast types covariant over the allocator lifetime. (#2943)
## Why

Due to the usage of `&'alloc mut T` in `oxc_allocator::Box`, and
`bumpalo::collections::Vec` in `oxc_allocator::Vec`, ast types are
currently invariant over their allocator lifetime `'a`. This prevents
`ouroboros` from generating `borrow_*` on ast type fields, leading to
the unfriendly `with_*` api:
c250b288ef/crates/oxc_parser/examples/multi-thread.rs (L82-L84)

## How

- For `oxc_allocator::Vec`, switch to `allocator_api2::vec::Vec`, which
has a covariant relationship with the allocator lifetime.
- For `oxc_allocator::Box`, use `std::ptr::NonNull` which is
specifically designed to be covariant. I don't use
`allocator_api2::boxed::Box` because it holds the allocator for
dropping, so the size is bigger.

## Downside

Now that `oxc_allocator::Box` uses the unsafe `NonNull`. It has to be a
private field to be safe. This make it impossible to do `Box(....)`
pattern matching.
2024-04-12 18:12:18 +08:00
..
benchmark feat(linter): Add --jsdoc-plugin flag (#2935) 2024-04-12 10:39:12 +08:00
common chore: only build the allocators in release mode because they are slow to build (60s) 2024-04-02 17:39:01 +08:00
coverage chore: improve sourcemap visualizer (#2886) 2024-04-03 10:45:00 +08:00
javascript_globals chore: update Cargo.toml and deny.yaml 2024-03-05 16:31:05 +08:00
lint_rules fix(tasks/lint_rules): Fix plugin-jest rules collector (#2915) 2024-04-08 10:22:56 +08:00
minsize chore: apply cargo autoinherit (#2826) 2024-03-26 23:57:50 +08:00
prettier_conformance feat(prettier/ts): better conformance (#2721) 2024-03-20 18:59:49 +08:00
rulegen Make ast types covariant over the allocator lifetime. (#2943) 2024-04-12 18:12:18 +08:00
transform_conformance feat(transformer): implement react-jsx-self (#2946) 2024-04-12 18:08:36 +08:00
libs.txt refactor(benchmark): use more complicated files (#1811) 2023-12-25 17:27:02 +08:00