Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check usage of max_level features #627

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
rustup default ${{ matrix.rust }}
- run: cargo test --verbose
- run: cargo test --verbose --no-default-features
- run: cargo test --verbose --all-features
- run: cargo test --verbose --features std,serde,sval,sval_ref,value-bag,kv,kv_std,kv_sval,kv_serde
- run: cargo test --verbose --features serde
- run: cargo test --verbose --features std
- run: cargo test --verbose --features kv
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
rustup default stable
rustup component add rust-docs
- name: Run rustdoc
run: RUSTDOCFLAGS="-D warnings" cargo doc --verbose --all-features
run: RUSTDOCFLAGS="-D warnings" cargo doc --verbose --features std,serde,sval,sval_ref,value-bag,kv,kv_std,kv_sval,kv_serde

features:
name: Feature check
Expand Down
39 changes: 39 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,45 @@
#![cfg_attr(rustbuild, feature(staged_api, rustc_private))]
#![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))]

#[cfg(any(
all(feature = "max_level_off", feature = "max_level_error"),
all(feature = "max_level_off", feature = "max_level_warn"),
all(feature = "max_level_off", feature = "max_level_info"),
all(feature = "max_level_off", feature = "max_level_debug"),
all(feature = "max_level_off", feature = "max_level_trace"),
all(feature = "max_level_error", feature = "max_level_warn"),
all(feature = "max_level_error", feature = "max_level_info"),
all(feature = "max_level_error", feature = "max_level_debug"),
all(feature = "max_level_error", feature = "max_level_trace"),
all(feature = "max_level_warn", feature = "max_level_info"),
all(feature = "max_level_warn", feature = "max_level_debug"),
all(feature = "max_level_warn", feature = "max_level_trace"),
all(feature = "max_level_info", feature = "max_level_debug"),
all(feature = "max_level_info", feature = "max_level_trace"),
all(feature = "max_level_debug", feature = "max_level_trace"),
))]
compile_error!("multiple max_level_* features set");

#[rustfmt::skip]
#[cfg(any(
all(feature = "release_max_level_off", feature = "release_max_level_error"),
all(feature = "release_max_level_off", feature = "release_max_level_warn"),
all(feature = "release_max_level_off", feature = "release_max_level_info"),
all(feature = "release_max_level_off", feature = "release_max_level_debug"),
all(feature = "release_max_level_off", feature = "release_max_level_trace"),
all(feature = "release_max_level_error", feature = "release_max_level_warn"),
all(feature = "release_max_level_error", feature = "release_max_level_info"),
all(feature = "release_max_level_error", feature = "release_max_level_debug"),
all(feature = "release_max_level_error", feature = "release_max_level_trace"),
all(feature = "release_max_level_warn", feature = "release_max_level_info"),
all(feature = "release_max_level_warn", feature = "release_max_level_debug"),
all(feature = "release_max_level_warn", feature = "release_max_level_trace"),
all(feature = "release_max_level_info", feature = "release_max_level_debug"),
all(feature = "release_max_level_info", feature = "release_max_level_trace"),
all(feature = "release_max_level_debug", feature = "release_max_level_trace"),
))]
compile_error!("multiple release_max_level_* features set");

#[cfg(all(not(feature = "std"), not(test)))]
extern crate core as std;

Expand Down