Skip to content

Commit

Permalink
Link the docs of panic!() and compile_error!()
Browse files Browse the repository at this point in the history
Fixes rust-lang#47275. These two macros are similar, but different, and could do with documentation links to each other.
  • Loading branch information
ogham committed May 29, 2018
1 parent fe5c45b commit 11c39ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/libstd/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@
/// The multi-argument form of this macro panics with a string and has the
/// [`format!`] syntax for building a string.
///
/// See also the macro [`compile_error!`], for raising errors during compilation.
///
/// [runwrap]: ../std/result/enum.Result.html#method.unwrap
/// [`Option`]: ../std/option/enum.Option.html#method.unwrap
/// [`Result`]: ../std/result/enum.Result.html
/// [`format!`]: ../std/macro.format.html
/// [`compile_error!`]: ../std/macro.compile_error.html
/// [book]: ../book/second-edition/ch09-01-unrecoverable-errors-with-panic.html
///
/// # Current implementation
Expand Down Expand Up @@ -286,7 +289,8 @@ pub mod builtin {
/// Unconditionally causes compilation to fail with the given error message when encountered.
///
/// This macro should be used when a crate uses a conditional compilation strategy to provide
/// better error messages for erroneous conditions.
/// better error messages for erroneous conditions. It's the compiler-level form of [`panic!`],
/// which emits an error at *runtime*, rather than during compilation.
///
/// # Examples
///
Expand All @@ -313,6 +317,8 @@ pub mod builtin {
/// #[cfg(not(any(feature = "foo", feature = "bar")))]
/// compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate.")
/// ```
///
/// [`panic!`]: ../std/macro.panic.html
#[stable(feature = "compile_error_macro", since = "1.20.0")]
#[macro_export]
macro_rules! compile_error {
Expand Down

0 comments on commit 11c39ac

Please sign in to comment.