What problem does this solve or what need does it fill?
The fast-math feature, as currently described in the readme, is not meant to be used by intermediate libraries:
Intermediate libraries should not use this feature and defer the decision to the final binary build.
Describe the solution you'd like
While the above warning should be sufficient, we can do a little better to further discourage intermediate libraries from using this feature. Specifically, we can change fast-math from being specified as --features glam/fast-math to --cfg glam_fast_math. (I'd suggest adding a glam_ prefix so as not to conflict with other crates that might have a "fast math" mode.)
Users would then specify this using rustflags - either through the RUSTFLAGS environment variable, or through the build.rustflags option in .cargo/config.toml.
Describe alternatives you've considered
Leaving it as is (which I admit may be a desirable option)
Additional context
This idea came to me after I saw how the getrandom and sha2 crates allow specifying various backend stuff through --cfg flags. See https://docs.rs/sha2/0.11.0/sha2/#backends and https://docs.rs/getrandom/0.4.2/getrandom/#opt-in-backends.
If implementing this change is desired, I am willing to make a PR, as the changes are relatively simple.
What problem does this solve or what need does it fill?
The
fast-mathfeature, as currently described in the readme, is not meant to be used by intermediate libraries:Describe the solution you'd like
While the above warning should be sufficient, we can do a little better to further discourage intermediate libraries from using this feature. Specifically, we can change
fast-mathfrom being specified as--features glam/fast-mathto--cfg glam_fast_math. (I'd suggest adding aglam_prefix so as not to conflict with other crates that might have a "fast math" mode.)Users would then specify this using rustflags - either through the
RUSTFLAGSenvironment variable, or through thebuild.rustflagsoption in.cargo/config.toml.Describe alternatives you've considered
Leaving it as is (which I admit may be a desirable option)
Additional context
This idea came to me after I saw how the
getrandomandsha2crates allow specifying various backend stuff through--cfgflags. See https://docs.rs/sha2/0.11.0/sha2/#backends and https://docs.rs/getrandom/0.4.2/getrandom/#opt-in-backends.If implementing this change is desired, I am willing to make a PR, as the changes are relatively simple.