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

Make #[derive(IntoBytes)] support more generic types #2063

Open
joshlf opened this issue Nov 15, 2024 · 0 comments
Open

Make #[derive(IntoBytes)] support more generic types #2063

joshlf opened this issue Nov 15, 2024 · 0 comments

Comments

@joshlf
Copy link
Member

joshlf commented Nov 15, 2024

Here's an idea for making #[derive(IntoBytes)] smarter on generic types: we can see from the surface syntax which fields are based on generic types and which are entirely concrete. Then, we can perform const computation based on those concrete types to extract partial information about the type. We can then use that partial information to infer bounds that must hold of generic types.

For example, if we could use const code to compute the maximum alignment that we could tolerate for a given field, then we could emit a bound of F: Unaligned<{derive_generated_computation}> for that field.

@joshlf joshlf changed the title Make #[derive(IntoBytes)] support a more generic types Make #[derive(IntoBytes)] support more generic types Nov 15, 2024
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

No branches or pull requests

1 participant