diff options
| author | Havvy <ryan.havvy@gmail.com> | 2017-12-05 14:01:09 -0800 |
|---|---|---|
| committer | Havvy <ryan.havvy@gmail.com> | 2017-12-05 14:01:09 -0800 |
| commit | aaaea2c562dc5638e8fcaa00371492ae71b07e46 (patch) | |
| tree | d0b08e813da7d1b761450ab19046c310375d9d41 /src/libstd | |
| parent | 3f0b766c35f6822f1f69ec23630496bbe11a707f (diff) | |
| download | rust-aaaea2c562dc5638e8fcaa00371492ae71b07e46.tar.gz rust-aaaea2c562dc5638e8fcaa00371492ae71b07e46.zip | |
compile_error example blurbs
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/macros.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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.") |
