summaryrefslogtreecommitdiff
path: root/info.toml
diff options
context:
space:
mode:
authorNoah Cairns <noah.cairns1@gmail.com>2022-06-15 09:40:30 -0400
committermokou <mokou@fastmail.com>2022-07-14 17:59:29 +0200
commit5e1ca4b99577578a1c92d71eeba49d88f60dcedc (patch)
tree96b4797dd5347cfc7382cc044d3f9a6b17d96775 /info.toml
parent582320aded8a9369f8b5a959419f04ea6d3f5b04 (diff)
fix(errors5): improve exercise instructions
Diffstat (limited to 'info.toml')
-rw-r--r--info.toml21
1 files changed, 8 insertions, 13 deletions
diff --git a/info.toml b/info.toml
index b13ed45..97c174f 100644
--- a/info.toml
+++ b/info.toml
@@ -619,22 +619,17 @@ name = "errors5"
path = "exercises/error_handling/errors5.rs"
mode = "compile"
hint = """
-There are two different possible `Result` types produced within
-`main()`, which are propagated using `?` operators. How do we declare a
-return type from `main()` that allows both?
-
-Another hint: under the hood, the `?` operator calls `From::from`
-on the error value to convert it to a boxed trait object, a
-`Box<dyn error::Error>`, which is polymorphic-- that means that lots of
-different kinds of errors can be returned from the same function because
-all errors act the same since they all implement the `error::Error` trait.
+There are two different possible `Result` types produced within `main()`, which are
+propagated using `?` operators. How do we declare a return type from `main()` that allows both?
+
+Under the hood, the `?` operator calls `From::from` on the error value to convert it to a boxed
+trait object, a `Box<dyn error::Error>`. This boxed trait object is polymorphic, and since all
+errors implement the `error:Error` trait, we can capture lots of different errors in one "Box"
+object.
+
Check out this section of the book:
https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator
-This exercise uses some concepts that we won't get to until later in the
-course, like `Box` and the `From` trait. It's not important to understand
-them in detail right now, but you can read ahead if you like.
-
Read more about boxing errors:
https://doc.rust-lang.org/stable/rust-by-example/error/multiple_error_types/boxing_errors.html