From aaaea2c562dc5638e8fcaa00371492ae71b07e46 Mon Sep 17 00:00:00 2001 From: Havvy Date: Tue, 5 Dec 2017 14:01:09 -0800 Subject: [PATCH] compile_error example blurbs --- src/libstd/macros.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index e2028883f23..b36473d9b75 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -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.")