-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A previous PR introduced generic `alloc` and `alloc_iter` methods, instead of needing a myriad of `xxx_move` functions for each and every AST component type. However, this poses a risk of memory leak because this method allocates in the generic bumpalo arena, which doesn't run destructors. This commit makes this approach safer by using a marker trait which forbids some AST components from being allocated through this method, when they need to be dropped. Anecdotally, `alloc_iter` is renamed to `alloc_many` and a specialized version `alloc_singleton` is added to eliminate a lot of `alloc.alloc_many(iter::once(x))`. In a second time, all the legacy `xxx_move` variants or the like are removed, and replaced with `alloc` and `alloc_many` whenever possible, making the interface of `AstAlloc` quite smaller.
- Loading branch information
Showing
6 changed files
with
86 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.