common: Allow to configure exhaustive types when environment variable is set

Allow to configure exhaustive types via the
`RUMA_UNSTABLE_EXHAUSTIVE_TYPES` environment variable in the same way as
it's done in other crates.

ruma-common contains at least `NewPushRule` which may be configured
as exhaustive. `ruma-client-api` uses the mentioned type and, when the
environment variable is set, it fails to compile the project.
This commit is contained in:
gnieto 2025-03-09 12:30:42 +01:00 committed by June Clementine Strawberry
parent f5ab6302aa
commit cd133c2c15
2 changed files with 8 additions and 0 deletions

View file

@ -26,6 +26,7 @@ Bug fixes:
- `MatrixVersion::V1_0` now also matches Identity Service API versions r0.2.0 to
r0.3.0.
- Allow configure exhaustive types via `RUMA_UNSTABLE_EXHAUSTIVE_TYPES` environment variable
Improvements:

View file

@ -7,4 +7,11 @@ fn main() {
}
println!("cargo:rerun-if-env-changed=RUMA_IDENTIFIERS_STORAGE");
// Set the `ruma_unstable_exhaustive_types` configuration from an environment variable.
if env::var("RUMA_UNSTABLE_EXHAUSTIVE_TYPES").is_ok() {
println!("cargo:rustc-cfg=ruma_unstable_exhaustive_types");
}
println!("cargo:rerun-if-env-changed=RUMA_UNSTABLE_EXHAUSTIVE_TYPES");
}