Open lthoerner opened 2 days ago
Thanks for the idea!
I'm not sure how often the --proc-macro
flag would be useful. Personally, I seldom start new proc macro packages, but I can't speak for everyone. On the other hand, for people working on C bindings, should we also provide a --crate-type
or --cdylib
flag?
I might be a bit conservative when adding new flags to Cargo, as every flag is permanent. I feel like for this kind of cases it might be better to explore templating solution for proc macro package. See relevant discussions in https://github.com/rust-lang/cargo/issues/5151. Perhaps https://github.com/rust-lang/cargo/issues/8365 is also related if one wants to create a workspace with a proc-macro crate.
Problem
I'm currently in the process of creating a presentation about how to implement derive macros. I found that I could express the process of creating the proc macro subcrate and adding the proper dependencies via a snippet of shell commands:
There is one notable exception here: I cannot write a command that adds the proper tag to the manifest.
Proposed Solution
It would be nice for feature parity with the
--lib
specification to have a CLI flag for emitting the manifest for a proc macro crate. I suspect this would be a relatively simple thing to add as well, and I am happy to work on it myself if this issue gets approved.Specifically, I propose that
cargo new
have a--proc-macro
flag that is mutually exclusive with--bin
or--lib
(to my understanding it would only be valid in the case of library crate anyway, though feel free to correct me here).Notes
No response