-
-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ast): add AstBuilder::vec_convert
#7860
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
54b5685
to
7f641c9
Compare
CodSpeed Performance ReportMerging #7860 will not alter performanceComparing Summary
|
Sorry to say this is wildly unsound! 2 types being same size and alignment is not enough. They also need to be the same type. The only reason why we can convert from
The oxc/crates/oxc_ast/src/ast/macros.rs Lines 858 to 870 in 0804916
So there's a lot of checks that make sure this conversion is sound. But it's not sound, for example, to go in the other direction - from And it's even more unsound to perform conversion between any types which have same size and alignment, which is what
I think we probably can make a sound implementation of Beyond soundness issues, there's also a question of whether allowing this conversion loses us anything else useful. At present, we have an invariant that any pointer to an element in a Anyway... TLDR... it's complicated! |
Ah, closing it as you said! |
Give a try for oxc-project/backlog#153
I am not sure whether it a 100% safe, we only can guarantee that we use it safely