Proc_macro in an existing library crate

This requires splitting source code for something that looks like a single crate into multiple parts that are compiled (or interpreted) separately, possibly for different targets if we are cross-compiling.

But this is already the case with build.rs, how is that different?

There could be in the Cargo.toml something like

[proc-macro]
path = "macro/macro.rs"

# Or can it be merged with  [build-dependencies]
[proc-macro.dependencies]
syn = "1"
quote = "1"
13 Likes