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

[derive] Simplify code, remove obsolete features #361

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Sep 9, 2023

Clean up the implementation, especially in fn impl_block. Make the following notable changes:

  • Previously, syn didn't support parsing macro invocations in const generics without the full feature enabled. To avoid the compile-time overhead of that feature, we worked around it by constructing AST nodes manually. syn has since added support for this without requiring the full feature, so we make use of it.
  • We used to need to split types into those that transatively depended upon type generics (like [T; 2]) and those that didn't (like [u8; 2]). We made a change in Move field type bounds into where clauses #119 that made this distinction irrelevant, but we never removed the code to perform the split. In this commit, we remove that code. That code was the only reason we needed to enable syn's visit feature, so we are also able to remove that feature dependency.

@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from 322e9ac to 847196f Compare September 9, 2023 22:10
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from e22c6d0 to b62e2ec Compare September 9, 2023 22:10
zerocopy-derive/src/lib.rs Outdated Show resolved Hide resolved
@joshlf joshlf requested a review from djkoloski September 9, 2023 22:16
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch 2 times, most recently from 7310ef5 to c810adc Compare September 10, 2023 00:40
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from b62e2ec to 59e8401 Compare September 10, 2023 00:40
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from c810adc to 886b4c7 Compare September 10, 2023 06:33
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from 59e8401 to 4891c4f Compare September 10, 2023 06:34
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from 886b4c7 to bc62dc6 Compare September 10, 2023 19:05
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from 4891c4f to 0f315c7 Compare September 10, 2023 19:05
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from bc62dc6 to dfe39c0 Compare September 11, 2023 02:59
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from 0f315c7 to bfb5bf5 Compare September 11, 2023 02:59
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from dfe39c0 to e82b746 Compare September 11, 2023 03:47
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from bfb5bf5 to 1b18c53 Compare September 11, 2023 03:47
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from e82b746 to 8db2922 Compare September 11, 2023 19:39
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from 1b18c53 to 87754b2 Compare September 11, 2023 19:39
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from 8db2922 to 774ddaa Compare September 11, 2023 22:28
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from 87754b2 to 2402ec6 Compare September 11, 2023 22:29
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from 774ddaa to fd9b4c1 Compare September 11, 2023 22:52
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from 2402ec6 to c26336c Compare September 11, 2023 22:52
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from fd9b4c1 to 1a330ee Compare September 11, 2023 23:05
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from c26336c to b9b29a0 Compare September 11, 2023 23:05
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from 1a330ee to 67a18c0 Compare September 11, 2023 23:31
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from b9b29a0 to 34016f9 Compare September 11, 2023 23:31
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch from 67a18c0 to 05e5775 Compare September 12, 2023 00:34
@joshlf joshlf merged commit 05e5775 into try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros Sep 12, 2023
@joshlf joshlf force-pushed the try-from-bytes-raw-argument-to-is-bit-valid-3-try-transmute-macros branch from 34016f9 to 1a0b1bb Compare September 12, 2023 00:34
@joshlf joshlf deleted the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch September 12, 2023 00:34
@joshlf joshlf restored the try-from-bytes-raw-argument-to-is-bit-valid--derive-cleanup branch September 12, 2023 00:37
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.

1 participant