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

Burn DataMarker::Cart down with fire #1279

Merged
merged 20 commits into from
Nov 10, 2021

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Nov 10, 2021

Progress towards #1262
Builds on #1278

Fixes #1151

This does not completely get rid of RcStruct, however it gets rid of the need for the "cart" type and removes a lot of lifetimes. The biggest win we get here is that projections can be made freely between data payload types now.

It should be much easier to get rid of RcStruct after this.

Notes for reviewing:

Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Basically LGTM! That wasn't as hard as I thought it would be

provider/core/src/data_provider.rs Show resolved Hide resolved
provider/core/src/inv.rs Show resolved Hide resolved
@@ -26,7 +24,6 @@ impl DataPayload<'static, CowStrMarker> {
/// `ErasedDataStruct` is to be used.
pub struct CowStringMarker;
Copy link
Member

Choose a reason for hiding this comment

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

Request: Please get rid of CowStringMarker now. I think it's only used in a couple of places.

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 use it in a bunch of tests; is there something it should be replaced with?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, CowStrMarker

provider/core/src/marker/mod.rs Show resolved Hide resolved

/// All that Yoke needs from the Cart type is the destructor. We can
/// use a trait object to handle that.
pub(crate) type ErasedCart<'data> = Rc<dyn ErasedDestructor<'data> + 'data>;
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: I think ErasedCart is better suited for the yoke crate, both because it is more strongly coupled to Yoke than to DataPayload and because then we can keep the unsafe code in one crate.

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO it would be if it:

  • did not have the lifetime
  • did not have the IsCovariant<'data> bound

These are both due to tricky constraints from our side and they make it not as general. My original plan was for it to be in the yoke crate but as long as we have the IsCovariant<'data> bound it doesn't make that much sense.

Once we get rid of the lifetime then this will be possible, I don't want to do it right now because the current design is too specific to us. Even if we can get rid of the IsCovariant bound I'd be okay with moving this upstream because ErasedCart<'static> would always work for folks who don't want to care about the lifetime. Requiring IsCovariant makes this much less generally useful

Copy link
Member Author

Choose a reason for hiding this comment

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

There are also multiple ownership patterns one may want here; from an Rc to a Box.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will file a followup for moving this out

Copy link
Member Author

Choose a reason for hiding this comment

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

provider/core/src/serde.rs Show resolved Hide resolved
provider/core/src/serde.rs Outdated Show resolved Hide resolved
utils/yoke/src/yoke.rs Show resolved Hide resolved
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Also please take note of the failing docs tests

@gregtatum gregtatum removed their request for review November 10, 2021 15:19
@Manishearth Manishearth requested a review from sffc November 10, 2021 16:19
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Please migrate to CowStrMarker and fix the merge conflict

@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • provider/core/src/erased.rs is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@Manishearth Manishearth requested a review from sffc November 10, 2021 20:33
@Manishearth Manishearth merged commit c6857ec into unicode-org:main Nov 10, 2021
@Manishearth Manishearth deleted the the-cart-the branch November 10, 2021 21:14
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.

Converging a payload from two different projections
2 participants