-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Implemented Decodable/Encodable for Cell and RefCell. Fixes #15395. #15411
Conversation
@@ -537,6 +538,33 @@ impl<E, D: Decoder<E>> Decodable<D, E> for path::windows::Path { | |||
} | |||
|
|||
// ___________________________________________________________________________ | |||
// Implement 'Encodable and Decodable' for the Cell and RefCell types. | |||
|
|||
impl<E, S:Encoder<E>,T:Encodable<S, E> + Copy> Encodable<S, E> for Cell<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you format this with more spaces:
impl<E: S: Encoder<E>, T: Encodable<S, E> + Copy> ...
(And similarly for the others below.)
Done, anything else? |
I just remembered RefCell was missing an implementation of Show while testing before, so I've added that also. |
There's a good deal of discussion about |
@alexcrichton Ok, I will remove it for now. |
Hm, the |
Or, maybe we can add it but with a fixme for #15036; after that was fixed (Thinking about it, this same approach could actually be used for |
@huonw I like this idea, I think it makes a lot more sense than just letting people continuously run into the need to |
@huonw, that sounds like a good way forward, yes. I would prefer @mitchmindtree, could you add a FIXME that @huonw mentioned above, as well as adding some tests to just exercising this basic functionality? |
@alexcrichton Is that test up to scratch? Let me know if you were after something more thorough. edit: Ahh I just realised I didn't include a test that 'fails'. Is that important? |
Looks good to me! It's ok if you have a test that doesn't fail. Could you squash the commits together as well? |
I think I squashed them, but I also think I might be making a commit mess? (embarrassed face) |
No worries! It looks like you've picked up a few commits here and there. I would recommend using When done, github should show only one commit as part of this PR. If you need some help, just let me know. |
Thanks @alexcrichton ! I tried to do a |
You also need to specify the point you're starting the rebase from, e.g. if this PR is directly off your |
…#15395 Updated PR with fixme and test Updated PR with fixme and test
Wipes sweat off forhead OK, I think it worked! Thanks @huonw, I've learned a lot about git in the last 24 hours 😸 |
I ran `make check` and everything went smoothly. I also tested `#[deriving(Decodable, Encodable)]` on a struct containing both Cell<T> and RefCell<T> and everything now seems to work fine.
I didn't see this when it first happened, but I don't think |
I ran
make check
and everything went smoothly. I also tested#[deriving(Decodable, Encodable)]
on a struct containing both Cell and RefCell and everything now seems to work fine.