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

Yokeable Derive: require Sized on certain types #4659

Merged
merged 2 commits into from
Mar 7, 2024

Conversation

sffc
Copy link
Member

@sffc sffc commented Mar 6, 2024

Similar to #4657

For now only on structs with no explicit lifetimes

@sffc sffc requested a review from Manishearth as a code owner March 6, 2024 22:31
@sffc sffc mentioned this pull request Mar 6, 2024
@Manishearth
Copy link
Member

Manishearth commented Mar 7, 2024

Is this really necessary? We should be able to support this, yes?

#[derive(Yokeable)]
struct MultiVec<'a, T: ?Sized> {
   x: VarZeroVec<'a, T>,
   y: VarZeroVec<'a, T>,
}

It seems you actually want where Self: Sized?

But really it's unclear why this is necessary in the first place: generic parameters are by default Sized and need to be opted out of, and if someone chooses to opt out of it we should respect that. It's extremely rare that T: Sized is necessary on an impl.

@Manishearth
Copy link
Member

Okay, yeah, for now please generate where Self: ?Sized or where <output type>: Sized. In the long run we should integrate this into yoke(may_borrow) from #3771

@Manishearth
Copy link
Member

Either that, or enforce FieldThatUsesGenerics: Sized for all fields that involve generics.

@sffc sffc changed the title Require Sized generics in Yokeable derive Require that Yokeable is Sized in certain types Mar 7, 2024
@sffc sffc changed the title Require that Yokeable is Sized in certain types Yokeable Derive: require Sized on certain types Mar 7, 2024
@sffc sffc merged commit 6af2333 into unicode-org:main Mar 7, 2024
30 checks passed
@sffc sffc deleted the yoke-sized branch March 7, 2024 12:34
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