1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! Static assertions for crate features, with informative errors.
//!
//! The macros from this crate print which specific features are responsible for
//! the assertion failure.
//!
//! # Examples
//!
//! ### Exactly one feature
//!
//! This example demonstrates the [`exactly_one`] macro,
//! which asserts that exactly one of the listed features is enabled.
//!
//!
//! ```compile_fail
//! assert_cfg::exactly_one!{
//!     feature = "foo",
//!     feature = "bar",
//!     feature = "qux",
//! }
//! ```
//!
//! When the `"foo"` and `"bar"` features are enabled,
//! the above code produces this compile-time error:
//! ```text
//! error[E0080]: evaluation of constant value failed
//!  --> src/lib.rs:15:1
//!   |
//! 4 | / assert_cfg::exactly_one!{
//! 5 | |     feature = "foo",
//! 6 | |     feature = "bar",
//! 7 | |     feature = "qux",
//! 8 | | }
//!   | |_^ the evaluated program panicked at '
//! too many features were enabled, only one of them can be enabled:
//! - `feature = "foo"`
//! - `feature = "bar"`
//!
//! ```
//!
//!
//! # No-std support
//!
//! `assert_cfg` is `#![no_std]`, it can be used anywhere Rust can be used.
//!
//! # Minimum Supported Rust Version
//!
//! This requires Rust 1.57.0, because it uses the `panic` macro in a const context.
//!
//!
//!
//! [`exactly_one`]: crate::exactly_one

#![no_std]

#[doc(hidden)]
pub mod __ {
    pub use core::{cfg, concat};

    pub use crate::{
        assert_all::assert_all, assert_any::assert_any, assert_exactly_one::assert_exactly_one,
        assert_none::assert_none, condition::Cond,
    };
}

#[macro_use]
mod internal_macros;

mod assert_all;
mod assert_any;
mod assert_exactly_one;
mod assert_none;
mod condition;

use crate::condition::Cond;

#[cfg(all(not(feature = "__test"), test))]
compile_error!(r#"The "__test" feature must be enabled to run tests"#);

#[cfg(doctest)]
#[doc = include_str!("../README.md")]
pub struct ReadmeTest;