refactor(allocator)!: remove Address::from_ref method#15702
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. |
CodSpeed Performance ReportMerging #15702 will not alter performanceComparing Summary
Footnotes
|
Merge activity
|
Remove `Address::from_ref` method. #15701 removed all usage in Oxc, and this method was only introduced a few weeks ago, so I doubt it's used in Rolldown either.
`Address::from_ptr` is hard to use correctly (as evidenced by rolldown/rolldown#6961). Introduce a new trait `UnstableAddress` which has a few more guardrails. ### Migration We should swap all usage of `Address::from_ptr` for `UnstableAddress::unstable_address`. When `Address::from_ptr` is being used correctly, it can easily be swapped out: ```diff - let address = Address::from_ptr(node); + let address = node.unstable_address(); ``` But if `Address::from_ptr` was being used incorrectly, migrating to `unstable_address` will reveal that problem with a compilation error. `unstable_address` (as the name suggests) does not give the same guarantees about the stability of the `Address` it returns as `GetAddress::address` does. The name of the method makes that explicit. More details in the doc comment in this PR. ### Migration plan * #15701 migrates all usage of `Address::from_ptr` and `Address::from_ref` in Oxc's codebase to `unstable_address` (except in `oxc_traverse`, which has particular requirements around aliasing, and can't use `unstable_address`). * #15702 removes `Address::from_ref`. * Once this PR lands in an Oxc release, we can migrate Rolldown to `unstable_address`. * In next Oxc release after that, we'll make `Address::from_ptr` an unsafe method, to discourage its use. * At a future date, we can migrate `oxc_traverse` to using `NonNull` pointers instead of `*const` pointers, and get rid of `Address::from_ptr` entirely.
e41fd89 to
ceba085
Compare
a368747 to
e064079
Compare
…15700) `Address::from_ptr` is hard to use correctly (as evidenced by rolldown/rolldown#6961). Introduce a new trait `UnstableAddress` which has a few more guardrails. ### Migration We should swap all usage of `Address::from_ptr` for `UnstableAddress::unstable_address`. When `Address::from_ptr` is being used correctly, it can easily be swapped out: ```diff - let address = Address::from_ptr(node); + let address = node.unstable_address(); ``` But if `Address::from_ptr` was being used incorrectly, migrating to `unstable_address` will reveal that problem with a compilation error. `unstable_address` (as the name suggests) does not give the same guarantees about the stability of the `Address` it returns as `GetAddress::address` does. The name of the method makes that explicit. More details in the doc comment in this PR. ### Migration plan * oxc-project#15701 migrates all usage of `Address::from_ptr` and `Address::from_ref` in Oxc's codebase to `unstable_address` (except in `oxc_traverse`, which has particular requirements around aliasing, and can't use `unstable_address`). * oxc-project#15702 removes `Address::from_ref`. * Once this PR lands in an Oxc release, we can migrate Rolldown to `unstable_address`. * In next Oxc release after that, we'll make `Address::from_ptr` an unsafe method, to discourage its use. * At a future date, we can migrate `oxc_traverse` to using `NonNull` pointers instead of `*const` pointers, and get rid of `Address::from_ptr` entirely.
…15702) Remove `Address::from_ref` method. oxc-project#15701 removed all usage in Oxc, and this method was only introduced a few weeks ago, so I doubt it's used in Rolldown either.

Remove
Address::from_refmethod.#15701 removed all usage in Oxc, and this method was only introduced a few weeks ago, so I doubt it's used in Rolldown either.