In implementing the backend overrides over automatic selection:
531
I noticed that if someone tries to override with --cfg curve25519_dalek_backend="simd" where the simd override is not possible e.g. in a case of target being wasm32-unknown-unknown - we would get "duplicate" cfg() during the compile time if we try to re-set it as "serial" via build script as a fallback with a warning.
By leaving the failed override as a mere warning - for every simd related gating we would have to include all(not(curve25519_dalek_backend = "serial"), not(curve25519_dalek_backend = "fiat") in negative sense ruling out every other possibility in every gate for simd backend.
Since vast majority of the people should not be using this override to begin with and this case should be considered a compile error I've left it to trigger a failure at build time where override fails - which also gets tested via the build test.
By leaving it as a compile error we can have more simplified positive gating - e.g. in simd case it would be mere cfg(curve25519_dalek_backend = "simd") instead of a litany of all(not(every_other)) everywhere - manifest still has to have it that way since it gets evaluated before build.rs.
This also helps ensure somebody doesn't try to supply wrong overrides expecting the override to work in vast minority cases they would be using this.
This also should be forwards compatible given multiple cfg(param=) is not really well defined behaviour.
In implementing the backend overrides over automatic selection:
531
I noticed that if someone tries to override with
--cfg curve25519_dalek_backend="simd"
where the simd override is not possible e.g. in a case of target being wasm32-unknown-unknown - we would get "duplicate" cfg() during the compile time if we try to re-set it as "serial" via build script as a fallback with a warning.By leaving the failed override as a mere warning - for every simd related gating we would have to include
all(not(curve25519_dalek_backend = "serial"), not(curve25519_dalek_backend = "fiat")
in negative sense ruling out every other possibility in every gate for simd backend.Since vast majority of the people should not be using this override to begin with and this case should be considered a compile error I've left it to trigger a failure at build time where override fails - which also gets tested via the build test.
By leaving it as a compile error we can have more simplified positive gating - e.g. in simd case it would be mere
cfg(curve25519_dalek_backend = "simd")
instead of a litany ofall(not(every_other))
everywhere - manifest still has to have it that way since it gets evaluated before build.rs.This also helps ensure somebody doesn't try to supply wrong overrides expecting the override to work in vast minority cases they would be using this.
This also should be forwards compatible given multiple
cfg(param=)
is not really well defined behaviour.