You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, your --cfg flags are set up such that if you pass no flags, then you get a build where all version-conditional features are disabled. This makes it difficult to use the crate with build systems that don't run the build.rs file, since you need to manually put together the list of --cfg flags to pass. If you forget to do this, the build will still pass, so you don't catch the mistake.
In Tokio, we were able to avoid this problem by reversing the meaning of the flags. For example, you would have a --cfg no_zerocopy_target_has_atomics_1_60_0 that you pass on compilers older than 1.60.0.
For projects with a non-cargo build system that does not run build.rs, this has the following advantages:
When using the newest compiler, you get the correct behavior by default, as the correct set of --cfg flags is the empty list. You do not need to adjust the list of cfg flags on every crate update.
When using an older compiler, the build will fail if you don't do anything. This ensures that you do not forget to look at the list of --cfg flags so that you pass the right set of flags.
The text was updated successfully, but these errors were encountered:
Currently, your
--cfg
flags are set up such that if you pass no flags, then you get a build where all version-conditional features are disabled. This makes it difficult to use the crate with build systems that don't run thebuild.rs
file, since you need to manually put together the list of--cfg
flags to pass. If you forget to do this, the build will still pass, so you don't catch the mistake.In Tokio, we were able to avoid this problem by reversing the meaning of the flags. For example, you would have a
--cfg no_zerocopy_target_has_atomics_1_60_0
that you pass on compilers older than 1.60.0.For projects with a non-cargo build system that does not run
build.rs
, this has the following advantages:--cfg
flags is the empty list. You do not need to adjust the list of cfg flags on every crate update.--cfg
flags so that you pass the right set of flags.The text was updated successfully, but these errors were encountered: