Skip to content

Commit

Permalink
Fix code snippet
Browse files Browse the repository at this point in the history
```rust
type Result<T> = Result<T, std::io::Error>;
```
This example [doesn't compiled](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7b13da576c5fd89ca3e2a89720c3fc8c):
```
error[E0107]: wrong number of type arguments: expected 1, found 2
 --> src/main.rs:1:28
  |
1 | type Result<T> = Result<T, std::io::Error>;
  |                            ^^^^^^^^^^^^^^ unexpected type argument

error[E0391]: cycle detected when processing `Result`
 --> src/main.rs:1:18
  |
1 | type Result<T> = Result<T, std::io::Error>;
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: ...which again requires processing `Result`, completing the cycle
```
  • Loading branch information
vlad20012 committed Mar 15, 2019
1 parent 51053e9 commit 6aa13a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ch19-04-advanced-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ The `Result<..., Error>` is repeated a lot. As such, `std::io` has this type of
alias declaration:

```rust,ignore
type Result<T> = Result<T, std::io::Error>;
type Result<T> = std::result::Result<T, std::io::Error>;
```

Because this declaration is in the `std::io` module, we can use the fully
Expand Down

0 comments on commit 6aa13a6

Please sign in to comment.