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

Collapse the 'rooted' field into the ptr #17

Closed
wants to merge 2 commits into from

Conversation

TyOverby
Copy link
Contributor

@TyOverby TyOverby commented Nov 8, 2015

Gc now stores the "rooted" state in the least-significant bit in the data pointer.

}

impl<T: ?Sized> !marker::Send for Gc<T> {}

impl<T: ?Sized> !marker::Sync for Gc<T> {}

impl<T: Trace + ?Sized + marker::Unsize<U>, U: Trace + ?Sized> CoerceUnsized<Gc<U>> for Gc<T> {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like losing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is broken up into two commits. The first one leaves CoerceUnsigned, but doesn't have UnsafeCell.

I don't know how to get one without removing the other. Maybe it can be done? Maybe it needs support in the standard lib?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the CoerceUnsized constraints are a bit too strong in rustc. I believe NonZero allows for the CoerceUnsize because of this: https://github.com/rust-lang/rust/blob/f9b8c49cdb75fb571c7b3ea4af90b0e96929276c/src/libcore/nonzero.rs#L78. UnsafeCell doesn't have such an impl for it (although I believe it would be safe for it to have one).

bors added a commit to rust-lang/rust that referenced this pull request Aug 23, 2016
Implement `CoerceUnsized` for `{Cell, RefCell, UnsafeCell}`

These impls are analogous to the one for `NonZero`. It's occasionally useful to be able to coerce the cell types when they're being used inside another abstraction. See Manishearth/rust-gc#17 for an example.

r? @eddyb
@mystor
Copy link
Collaborator

mystor commented Aug 27, 2016

Fixed by #40

@mystor mystor closed this Aug 27, 2016
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.

3 participants