-/// Entry point of thread panic. For details, see `std::macros`.
+/// Panics the current thread.
+///
+/// For details, see `std::macros`.
#[macro_export]
#[allow_internal_unstable(core_panic, __rust_unstable_column)]
#[stable(feature = "core", since = "1.6.0")]
});
}
-/// Ensure that a boolean expression is `true` at runtime.
+/// Asserts that a boolean expression is `true` at runtime.
///
/// This will invoke the [`panic!`] macro if the provided expression cannot be
/// evaluated to `true` at runtime.
($($arg:tt)*) => (if cfg!(debug_assertions) { assert_ne!($($arg)*); })
}
-/// Helper macro for reducing boilerplate code for matching `Result` together
-/// with converting downstream errors.
+/// Unwraps a result or propagates its error.
///
/// The `?` operator was added to replace `try!` and should be used instead.
/// Furthermore, `try` is a reserved word in Rust 2018, so if you must use
($expr:expr,) => (r#try!($expr));
}
-/// Write formatted data into a buffer.
+/// Writes formatted data into a buffer.
///
/// This macro accepts a format string, a list of arguments, and a 'writer'. Arguments will be
/// formatted according to the specified format string and the result will be passed to the writer.
);
}
-/// A utility macro for indicating unreachable code.
+/// Indicates unreachable code.
///
/// This is useful any time that the compiler can't determine that some code is unreachable. For
/// example:
});
}
-/// A standardized placeholder for marking unfinished code.
+/// Indicates unfinished code.
///
/// This can be useful if you are prototyping and are just looking to have your
/// code type-check, or if you're implementing a trait that requires multiple
($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*)));
}
-/// A standardized placeholder for marking unfinished code.
+/// Indicates unfinished code.
///
/// This can be useful if you are prototyping and are just looking to have your
-/// code typecheck. `todo!` works exactly like `unimplemented!`, there only
+/// code typecheck. `todo!` works exactly like `unimplemented!`. The only
/// difference between the two macros is the name.
///
/// # Panics
($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*)));
}
-/// A macro to create an array of [`MaybeUninit`]
+/// Creates an array of [`MaybeUninit`].
///
/// This macro constructs an uninitialized array of the type `[MaybeUninit<K>; N]`.
///
#[cfg(rustdoc)]
mod builtin {
- /// Unconditionally causes compilation to fail with the given error message when encountered.
+ /// Causes compilation to fail with the given error message when encountered.
///
/// For more information, see the documentation for [`std::compile_error!`].
///
($msg:expr,) => ({ /* compiler built-in */ });
}
- /// The core macro for formatted string creation & output.
+ /// Constructs parameters for the other string-formatting macros.
///
/// For more information, see the documentation for [`std::format_args!`].
///
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
}
- /// Inspect an environment variable at compile time.
+ /// Inspects an environment variable at compile time.
///
/// For more information, see the documentation for [`std::env!`].
///
($name:expr,) => ({ /* compiler built-in */ });
}
- /// Optionally inspect an environment variable at compile time.
+ /// Optionally inspects an environment variable at compile time.
///
/// For more information, see the documentation for [`std::option_env!`].
///
($name:expr,) => ({ /* compiler built-in */ });
}
- /// Concatenate identifiers into one identifier.
+ /// Concatenates identifiers into one identifier.
///
/// For more information, see the documentation for [`std::concat_idents!`].
///
($($e:expr,)*) => ({ /* compiler built-in */ });
}
- /// A macro which expands to the line number on which it was invoked.
+ /// Expands to the line number on which it was invoked.
///
/// For more information, see the documentation for [`std::line!`].
///
#[rustc_doc_only_macro]
macro_rules! line { () => ({ /* compiler built-in */ }) }
- /// A macro which expands to the column number on which it was invoked.
+ /// Expands to the column number on which it was invoked.
///
/// For more information, see the documentation for [`std::column!`].
///
#[rustc_doc_only_macro]
macro_rules! column { () => ({ /* compiler built-in */ }) }
- /// A macro which expands to the file name from which it was invoked.
+ /// Expands to the file name from which it was invoked.
///
/// For more information, see the documentation for [`std::file!`].
///
#[rustc_doc_only_macro]
macro_rules! file { () => ({ /* compiler built-in */ }) }
- /// A macro which stringifies its arguments.
+ /// Stringifies its arguments.
///
/// For more information, see the documentation for [`std::stringify!`].
///
#[rustc_doc_only_macro]
macro_rules! module_path { () => ({ /* compiler built-in */ }) }
- /// Boolean evaluation of configuration flags, at compile-time.
+ /// Evaluates boolean combinations of configuration flags, at compile-time.
///
/// For more information, see the documentation for [`std::cfg!`].
///
#[rustc_doc_only_macro]
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
- /// Parse a file as an expression or an item according to the context.
+ /// Parses a file as an expression or an item according to the context.
///
/// For more information, see the documentation for [`std::include!`].
///
($file:expr,) => ({ /* compiler built-in */ });
}
- /// Ensure that a boolean expression is `true` at runtime.
+ /// Asserts that a boolean expression is `true` at runtime.
///
/// For more information, see the documentation for [`std::assert!`].
///
//! library. Each macro is available for use when linking against the standard
//! library.
-/// The entry point for panic of Rust threads.
+/// Panics the current thread.
///
/// This allows a program to terminate immediately and provide feedback
/// to the caller of the program. `panic!` should be used when a program reaches
});
}
-/// Macro for printing to the standard output.
+/// Prints to the standard output.
///
/// Equivalent to the [`println!`] macro except that a newline is not printed at
/// the end of the message.
($($arg:tt)*) => ($crate::io::_print(format_args!($($arg)*)));
}
-/// Macro for printing to the standard output, with a newline.
+/// Prints to the standard output, with a newline.
///
/// On all platforms, the newline is the LINE FEED character (`\n`/`U+000A`) alone
/// (no additional CARRIAGE RETURN (`\r`/`U+000D`).
})
}
-/// Macro for printing to the standard error.
+/// Prints to the standard error.
///
/// Equivalent to the [`print!`] macro, except that output goes to
/// [`io::stderr`] instead of `io::stdout`. See [`print!`] for
($($arg:tt)*) => ($crate::io::_eprint(format_args!($($arg)*)));
}
-/// Macro for printing to the standard error, with a newline.
+/// Prints to the standard error, with a newline.
///
/// Equivalent to the [`println!`] macro, except that output goes to
/// [`io::stderr`] instead of `io::stdout`. See [`println!`] for
})
}
-/// A macro for quick and dirty debugging with which you can inspect
-/// the value of a given expression. An example:
+/// Prints the value of a given expression for quick and dirty debugging.
+///
+/// An example:
///
/// ```rust
/// let a = 2;
}
}
-/// A macro to await on an async call.
+/// Awaits the completion of an async call.
#[macro_export]
#[unstable(feature = "await_macro", issue = "50547")]
#[allow_internal_unstable(gen_future, generators)]
} }
}
-/// A macro to select an event from a number of receivers.
+/// Selects the first successful receive event from a number of receivers.
///
/// This macro is used to wait for the first event to occur on a number of
/// receivers. It places no restrictions on the types of receivers given to
#[cfg(rustdoc)]
mod builtin {
- /// Unconditionally causes compilation to fail with the given error message when encountered.
+ /// 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. It's the compiler-level form of [`panic!`],
($msg:expr,) => ({ /* compiler built-in */ });
}
- /// The core macro for formatted string creation & output.
+ /// Constructs parameters for the other string-formatting macros.
///
/// This macro functions by taking a formatting string literal containing
/// `{}` for each additional argument passed. `format_args!` prepares the
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
}
- /// Inspect an environment variable at compile time.
+ /// Inspects an environment variable at compile time.
///
/// This macro will expand to the value of the named environment variable at
/// compile time, yielding an expression of type `&'static str`.
($name:expr,) => ({ /* compiler built-in */ });
}
- /// Optionally inspect an environment variable at compile time.
+ /// Optionally inspects an environment variable at compile time.
///
/// If the named environment variable is present at compile time, this will
/// expand into an expression of type `Option<&'static str>` whose value is
($name:expr,) => ({ /* compiler built-in */ });
}
- /// Concatenate identifiers into one identifier.
+ /// Concatenates identifiers into one identifier.
///
/// This macro takes any number of comma-separated identifiers, and
/// concatenates them all into one, yielding an expression which is a new
($($e:expr,)*) => ({ /* compiler built-in */ });
}
- /// A macro which expands to the line number on which it was invoked.
+ /// Expands to the line number on which it was invoked.
///
/// With [`column!`] and [`file!`], these macros provide debugging information for
/// developers about the location within the source.
#[rustc_doc_only_macro]
macro_rules! line { () => ({ /* compiler built-in */ }) }
- /// A macro which expands to the column number on which it was invoked.
+ /// Expands to the column number at which it was invoked.
///
/// With [`line!`] and [`file!`], these macros provide debugging information for
/// developers about the location within the source.
#[rustc_doc_only_macro]
macro_rules! column { () => ({ /* compiler built-in */ }) }
- /// A macro which expands to the file name from which it was invoked.
+ /// Expands to the file name in which it was invoked.
///
/// With [`line!`] and [`column!`], these macros provide debugging information for
/// developers about the location within the source.
#[rustc_doc_only_macro]
macro_rules! file { () => ({ /* compiler built-in */ }) }
- /// A macro which stringifies its arguments.
+ /// Stringifies its arguments.
///
/// This macro will yield an expression of type `&'static str` which is the
/// stringification of all the tokens passed to the macro. No restrictions
#[rustc_doc_only_macro]
macro_rules! module_path { () => ({ /* compiler built-in */ }) }
- /// Boolean evaluation of configuration flags, at compile-time.
+ /// Evaluates boolean combinations of configuration flags at compile-time.
///
/// In addition to the `#[cfg]` attribute, this macro is provided to allow
/// boolean expression evaluation of configuration flags. This frequently
#[rustc_doc_only_macro]
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
- /// Parse a file as an expression or an item according to the context.
+ /// Parses a file as an expression or an item according to the context.
///
/// The file is located relative to the current file (similarly to how
/// modules are found).
($file:expr,) => ({ /* compiler built-in */ });
}
- /// Ensure that a boolean expression is `true` at runtime.
+ /// Asserts that a boolean expression is `true` at runtime.
///
/// This will invoke the [`panic!`] macro if the provided expression cannot be
/// evaluated to `true` at runtime.
}
}
-/// A macro for defining `#[cfg]` if-else statements.
+/// Defines `#[cfg]` if-else statements.
///
/// This is similar to the `if/elif` C preprocessor macro by allowing definition
/// of a cascade of `#[cfg]` cases, emitting the implementation which matches