compile_error example blurbs

This commit is contained in:
Havvy 2017-12-05 14:01:09 -08:00
parent 3f0b766c35
commit aaaea2c562

View File

@ -286,8 +286,11 @@ pub mod builtin {
/// better error messages for errornous conditions.
///
/// # Examples
///
/// Two such examples are macros and `#[cfg]` environments.
///
/// Emit better compiler error if a macro is passed invalid values.
///
/// ```compile_fail
/// macro_rules! give_me_foo_or_bar {
/// (foo) => {};
@ -301,6 +304,8 @@ pub mod builtin {
/// // ^ 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
/// #[cfg(not(any(feature = "foo", feature = "bar")))]
/// compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate.")