Skip to content

Conversation

@neocturne
Copy link

@neocturne neocturne commented May 6, 2024

This is a fairly large overhaul of the field type logic, adding support for various new types:

  • arrays
  • tuples
  • Box<T>
  • arbitrarily nested types built from all supported types

It also fixes deriving Borrowed for tuple structs, which was previously broken.

All existing tests pass without changes, and I've added new testcases for all new features.

Fixes #13

@neocturne neocturne force-pushed the more-types branch 4 times, most recently from a85b71e to 9e1c252 Compare May 7, 2024 06:22
@neocturne neocturne marked this pull request as draft May 7, 2024 06:24
@neocturne
Copy link
Author

Oh, I just found a few issues with the new code that are not covered by the tests yet. Will push an update later today.

@neocturne neocturne marked this pull request as ready for review May 7, 2024 07:46
neocturne added 7 commits May 7, 2024 10:02
This rewrites a lot of the FieldKind and helper logic to make type
resolution fully composable. This allows to use arbitrarily nested
constructions of all supported types.

All existing testcases pass without changes, and two new cases are added
to demonstrate the new feature.
This just copies the logic for handling tuple and unit structs from
IntoOwnedGen to BorrowedGen.
This tests build for various combinations of different types, in
particular some involving cloned types in containers like Vec and
Option.
…fields

Avoid moving all inner fields or reimplementing clone(), thus generating
shorter and in some cases possibly more efficient code.

This is basically a regression fix for "feature: make field type
resolution recursive", kept as a separate commit to make review easier.
It should have no effect on which code does or does not compile.
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.

Option<Box<T<'a>>> fields where Talso has into_owned

1 participant