How to test for cfg not defined

I'd like to compile some item if some cfg is defined as a specific value, or it not defined at all.

e.g.) I tried #[cfg(any(some_cfg="foo", not(some_cfg)))], and I want the item to be compiled if I run cargo rustc -- --cfg 'some_cfg="foo"' or just cargo rustc

The above works when cargo rustc -- --cfg 'some_cfg="foo"' --cfg some_cfg but I want to get rid of --cfg some_cfg at the end.

Is there any way that I can achieve this?

1 Like

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.