Repository navigation
Add Collectable trait and make_collectable shim - #47
Merged
bors[bot] merged 2 commits intoFeb 24, 2022
Merged
Conversation
Values of types which implement the collectable trait can dynamically change their heap allocation from non-GC'd to GC'd.
Member
|
bors r+ |
|
Build failed: |
Collaborator
Author
|
bors try |
tryBuild failed: |
Collaborator
Author
|
bors try |
Collaborator
Author
|
bors try- |
Collaborator
Author
|
bors try |
tryBuild succeeded: |
Collaborator
Author
|
This can be squashed now. |
Member
|
Please squash. |
If `T` is `NoFinalize`, `Gc<T>::new(value: T)` needs to be able to switch any heap allocations which make up `value` to collectable. It should do this by recursing through the component types of `T` looking for fields/variants/indices etc which implement `Collectable`. When it finds types which do, it should call `Collectable::set_collectable()` on them. Recursing over types in this way is not possible in standard Rust code, so it needs to be done as part of a new intrinsic in rustc. This introduces the boilerplate needed to setup that intrinsic, named `make_collectable`.
jacob-hughes
force-pushed
the
make_collectable_intrinsic_shim
branch
from
February 24, 2022 16:38
6a92585 to
5483246
Compare
Collaborator
Author
|
Squashed |
Member
|
bors r+ |
|
Build failed: |
Member
|
bors r+ |
|
Build succeeded: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the necessary boilerplate trait and intrinsics for the GC to be able to remove finalizers on types marked
NoFinalize. There are no tests for this asmake_collectableis currently stubbed astodo!.