Conditional rustflags?

I know that there is a [build] section in .cargo/config file that accepts rustflags, but the problem is, it is effective all the time.

I would like to use some rustflags ONLY under RELEASE builds. For example, is there something equivalent to:

rustflags = [

Note that I only want those flags under RELEASE builds, and they shall have no effect under DEV builds.

Thx in advance.

"Debug" and "Release" are called profiles, so what you want is profile-specific RUSTFLAGS. A quick Google search for those terms brings up this Cargo issue, so it looks like this is being worked on.

1 Like

Thx! So do we have a workaround for this issue right now? Is there a profile-specific pre-build task available that can change env variables?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.