Skip to content
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

Add Gc::as_ref to get a &'gc T from a Gc<'gc, T> #66

Merged
merged 2 commits into from
May 17, 2023

Conversation

moulins
Copy link
Collaborator

@moulins moulins commented May 16, 2023

(also, add impl AsRef for Gc, and remove extra borrows from other Gc-taking methods)

This is sound, as &'gc T doesn't implement Collect (unless 'gc ends up being 'static, which will be impossible once #63 is merged) and so cannot escape the current arena callback by being stored in the GC root.

This is sound, as `&'gc T` doesn't implement `Collect`, and so cannot
escape the current arena callback.
@moulins moulins changed the title Add API to get a &'gc T from a Gc<'gc, T> Add Gc::as_ref to get a &'gc T from a Gc<'gc, T> May 16, 2023
@kyren kyren merged commit 6c9a055 into kyren:master May 17, 2023
moulins added a commit to moulins/gc-arena that referenced this pull request May 18, 2023
This is less error prone.

Also, add some `'gc` lifetimes in `mutate(_root)` methods missed in kyren#66
@moulins moulins mentioned this pull request May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants