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

Clarify serde_derive platform support #2574

Closed
DarkKirb opened this issue Aug 17, 2023 · 5 comments · Fixed by #2590
Closed

Clarify serde_derive platform support #2574

DarkKirb opened this issue Aug 17, 2023 · 5 comments · Fixed by #2590

Comments

@DarkKirb
Copy link

Originally posted by @dtolnay in #2538 (comment)

[…] The precompiled implementation is the only supported way to use the macros that are published in serde_derive. […]

This does seem to imply that platforms where the precompiled implementation is not available are not officially supported. However the rust compiler, which uses serde_derive, is supported on many platforms, most of which are listed in the rust documentation.

@fogti
Copy link

fogti commented Aug 18, 2023

I'm also quite irritated that this way was chosen instead of e.g. compiling the macro into some form of byte-code like WASM or such (which wouldn't have the platform support problems to such an extent), while still providing some form of build speedup (as I suppose that the build time of serde_derive is the problem).

@zopsicle
Copy link

Compiling to bytecode would make little sense, because then a bytecode interpreter must be shipped in addition to serde-derive, which would itself most certainly take even longer to compile.

@pacak
Copy link

pacak commented Aug 18, 2023

Compiling to bytecode would make little sense, because then a bytecode interpreter must be shipped in addition to serde-derive, which would itself most certainly take even longer to compile.

There's https://github.com/dtolnay/watt and readme suggests that compiling a bytecode interpreter is faster than complex macro with dependencies, what's more - it uses serde as an example.

@DarkKirb
Copy link
Author

watt would work for my use-case (cargo2nix), but it is still incompatible with corporate or distro policy

@dtolnay
Copy link
Member

dtolnay commented Aug 19, 2023

Thanks for clarifying the unclear wording — this specifically refers to platforms on which cargo build involves the precompiled implementation in the first place. The crate works on all host platforms on which rustc supports proc macros; not all of those involve a precompiled macro. It also only refers to support extended by a serde maintainer. Support obtained from elsewhere (notably distro packagers) would be free to support different build modes, as always.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

5 participants