Auto merge of #80590 - camelid:bool-never-docs, r=nagisa
Update `bool` and `!` docs
This commit is contained in:
commit
bcd6975079
1 changed files with 7 additions and 6 deletions
|
@ -11,8 +11,9 @@
|
||||||
/// `bool` implements various traits, such as [`BitAnd`], [`BitOr`], [`Not`], etc.,
|
/// `bool` implements various traits, such as [`BitAnd`], [`BitOr`], [`Not`], etc.,
|
||||||
/// which allow us to perform boolean operations using `&`, `|` and `!`.
|
/// which allow us to perform boolean operations using `&`, `|` and `!`.
|
||||||
///
|
///
|
||||||
/// `if` always demands a `bool` value. [`assert!`], which is an important macro in testing,
|
/// `if` requires a `bool` value as its conditional. [`assert!`], which is an
|
||||||
/// checks whether an expression returns `true` and panics if it isn't.
|
/// important macro in testing, checks whether an expression is `true` and panics
|
||||||
|
/// if it isn't.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let bool_val = true & false | false;
|
/// let bool_val = true & false | false;
|
||||||
|
@ -25,7 +26,7 @@
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// A trivial example of the usage of `bool`,
|
/// A trivial example of the usage of `bool`:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let praise_the_borrow_checker = true;
|
/// let praise_the_borrow_checker = true;
|
||||||
|
@ -122,9 +123,9 @@ mod prim_bool {}
|
||||||
/// `!`, if we have to call [`String::from_str`] for some reason the result will be a
|
/// `!`, if we have to call [`String::from_str`] for some reason the result will be a
|
||||||
/// [`Result<String, !>`] which we can unpack like this:
|
/// [`Result<String, !>`] which we can unpack like this:
|
||||||
///
|
///
|
||||||
/// ```ignore (string-from-str-error-type-is-not-never-yet)
|
/// ```
|
||||||
/// #[feature(exhaustive_patterns)]
|
/// #![feature(exhaustive_patterns)]
|
||||||
/// // NOTE: this does not work today!
|
/// use std::str::FromStr;
|
||||||
/// let Ok(s) = String::from_str("hello");
|
/// let Ok(s) = String::from_str("hello");
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue