rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

mix proc_macro_deps with normal deps

Open ashi009 opened this issue 1 year ago • 2 comments

Continue the conversation https://bazelbuild.slack.com/archives/CSV56UT0F/p1726491451410859?thread_ts=1726290118.173529&cid=CSV56UT0F

Given the improvements to the bazel configuration transitions, it's now possible to perform this transition on the rulst_proc_macro rule itself instead of using a separate attr.

ashi009 avatar Sep 20 '24 08:09 ashi009

I would love to see this.

If @dzbarsky's PR doesn't stick for some reason (I hope it does' but am not following the discussion), maybe there's a lower-tech solution?

The rust_proc_macro bazel macro could do one extra layer of wrapping, and add a regular rust_library containing pub use the_real_proc_macro::*. That library would still need something like the existing proc_macro_deps, but it would no longer be user-facing.

sam-mccall avatar Nov 27 '25 10:11 sam-mccall

I would love to see this.

If @dzbarsky's PR doesn't stick for some reason (I hope it does' but am not following the discussion), maybe there's a lower-tech solution?

The rust_proc_macro bazel macro could do one extra layer of wrapping, and add a regular rust_library containing pub use the_real_proc_macro::*. That library would still need something like the existing proc_macro_deps, but it would no longer be user-facing.

None of my approaches found traction with the maintainers. I ended up writing a rust_deps rule to split/sort the deps and using it like so , which works, but is kind of annoying because it makes bazel query on a crate require some hops to understand deps.

The rust_proc_macro wrapper approach you mention is interesting, have you prototyped it?

dzbarsky avatar Nov 30 '25 20:11 dzbarsky