Specifying extra rustc flags based on `--compilation_mode`
Hi!
Currently, the rustc flags -Copt-level (and -Cdebug-info) is set based on the --compilation_mode.
However, I want to also set some additional flags that should change based on --compilation_mode, such as -Clto=true and -Ccodegen-units=1 on opt (with some other default values on dbg or fastbuild), for example.
Is there some way of achieving this with rules_rust at the moment without wrapper macros with select(..), or is that the preferred approach? I'm using rules_rust through bzlmod if that matters, but I could switch back to WORKSPACE if that makes it easier.
Wrapper macros with select is the preferred approach, as shown in the example.
https://github.com/bazelbuild/rules_rust/tree/main/examples/bzlmod/compile_opt
It is not perfect, but allows per binary opt settings. I am unaware of a better solution atm.