bazelbuild / bazelbuild/rules_rust

Specifying extra rustc flags based on `--compilation_mode`

Open
#2,833 1 comment 0 reactions 0 assignees View on GitHub
needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.