compile_error example blurbs
This commit is contained in:
@@ -286,8 +286,11 @@ pub mod builtin {
|
|||||||
/// better error messages for errornous conditions.
|
/// better error messages for errornous conditions.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
|
///
|
||||||
/// Two such examples are macros and `#[cfg]` environments.
|
/// Two such examples are macros and `#[cfg]` environments.
|
||||||
///
|
///
|
||||||
|
/// Emit better compiler error if a macro is passed invalid values.
|
||||||
|
///
|
||||||
/// ```compile_fail
|
/// ```compile_fail
|
||||||
/// macro_rules! give_me_foo_or_bar {
|
/// macro_rules! give_me_foo_or_bar {
|
||||||
/// (foo) => {};
|
/// (foo) => {};
|
||||||
@@ -301,6 +304,8 @@ pub mod builtin {
|
|||||||
/// // ^ will fail at compile time with message "This macro only accepts `foo` or `bar`"
|
/// // ^ will fail at compile time with message "This macro only accepts `foo` or `bar`"
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// Emit compiler error if one of a number of features isn't available.
|
||||||
|
///
|
||||||
/// ```compile_fail
|
/// ```compile_fail
|
||||||
/// #[cfg(not(any(feature = "foo", feature = "bar")))]
|
/// #[cfg(not(any(feature = "foo", feature = "bar")))]
|
||||||
/// compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate.")
|
/// compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate.")
|
||||||
|
|||||||
Reference in New Issue
Block a user