Skip to content

Commit

Permalink
Rollup merge of rust-lang#101229 - mgeisler:link-try-operator, r=thomcc
Browse files Browse the repository at this point in the history
Link “? operator” to relevant chapter in The Book

Before, the text simply asked people to use a symbol which is hard to
search for. Now the text links back to the chapter on error
propagation in The Book. That should help people find the relevant
keywords for further searches.
  • Loading branch information
matthiaskrgr authored Aug 31, 2022
2 parents 579c050 + e10ab62 commit 99154f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,12 @@ macro_rules! matches {

/// 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
/// it, you will need to use the [raw-identifier syntax][ris]: `r#try`.
/// The [`?` operator][propagating-errors] was added to replace `try!`
/// and should be used instead. Furthermore, `try` is a reserved word
/// in Rust 2018, so if you must use it, you will need to use the
/// [raw-identifier syntax][ris]: `r#try`.
///
/// [propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator
/// [ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html
///
/// `try!` matches the given [`Result`]. In case of the `Ok` variant, the
Expand Down

0 comments on commit 99154f5

Please sign in to comment.