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

Remove RcStruct #1299

Merged
merged 13 commits into from
Nov 15, 2021
Merged

Remove RcStruct #1299

merged 13 commits into from
Nov 15, 2021

Conversation

Manishearth
Copy link
Member

(finally)

Fixes #1262, fixes #1284

#1297 had all the churny parts of this change so this PR should be much more manageable (and can be reviewed at leisure).

This contains a bunch of related changes:

  • Moving all code over to DataPayload::new_owned() from DataPayload::from_partial_owned()
  • Moving ErasedCart into yoke (Add Yoke::erase_cart() to Yoke #1284) and adding nice helper methods for working with it. We don't use it anymore, but it does seem generally useful.
  • Removing DataPayloadInner::RcStruct and DataPayload::from_partial_owned()

It should be easy to re-add an ErasedCart based RcRef(Yoke<&'static Y, ErasedRcCart>) later if needed. It's worth waiting to see what our needs are in this area before adding new variants or constructors; Yoke is pretty versatile so we should be able to use it as needed.

@Manishearth Manishearth requested a review from sffc as a code owner November 15, 2021 21:48
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • utils/yoke/src/erased.rs is now changed in the branch

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

/// `dyn Drop` isn't legal (and doesn't make sense since `Drop` is not
/// implement on all destructible types). However, all trait objects come with
/// a destructor, so we can just use an empty trait to get a destructor object.
pub trait ErasedDestructor: 'static {}
Copy link
Member

Choose a reason for hiding this comment

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

Thought: We're not actually using this in DataPayload, right? Because we are instead just Boxing the whole Yoke into a trait object? So we may or may not need this; if it doesn't solve our use case, is it going to solve anyone else's?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I think that this is generally useful, it's just not useful for us anymore.

It may actually become useful in the future if we ever add e.g. RcRef or something.

Copy link
Member Author

Choose a reason for hiding this comment

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

We also can probably clean up the "Box the entire yoke into a trait object" business if we try, actually.

@Manishearth Manishearth added this to the 2021 Q4 0.5 Sprint B milestone Nov 15, 2021
@Manishearth Manishearth merged commit cee2b5f into unicode-org:main Nov 15, 2021
@Manishearth Manishearth deleted the im-not-owned branch November 15, 2021 23:26
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.

Add Yoke::erase_cart() to Yoke Improving or getting rid of the DataPayload RcStruct variant
2 participants