oxc-project / oxc-project/backlog

Implement conversion methods between `Vec`s of AST enums which inherit from each other

Open
#153 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
7
Forks
0
PR merge metrics
No merged PRs in 30d

Description

We have zero-cost conversion methods for converting e.g. From<Expression> for Argument. It's zero cost because Argument inherits Expression's variants, so a valid Expression is also a valid Argument, and the conversion is just an in-place transmute.

Implement the same for converting Vecs. e.g. Vec<'a, Expression<'a>> should be able to be converted to Vec<'a, Argument<'a>> as a zero cost transmute - without memory copy or allocation.

Ditto From<Box<'a, Expression<'a>>> for Box<'a, Argument<'a>>. Edit: No point. We never box enums.

The code touched in https://github.com/oxc-project/oxc/pull/7854 is an example of where we could use this for a more efficient operation.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the existing From implementations for Expression and Argument, then review the usage example in oxc-project/oxc#7854. The work is complete when equivalent Vec conversions are available for the relevant AST enums without copying or allocating, with coverage for the supported conversions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.