Skip to content

Commit

Permalink
Printing non-Display structs is a *compile* error
Browse files Browse the repository at this point in the history
`Rectangle` doesn't implement `std::fmt::Display` is a compile error, not a run-time error.
  • Loading branch information
Vasily Galkin committed Jul 14, 2019
1 parent 7ddc464 commit 9cb1d20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ch05-02-example-structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn main() {
<span class="caption">Listing 5-11: Attempting to print a `Rectangle`
instance</span>

When we run this code, we get an error with this core message:
When we compile this code, we get an error with this core message:

```text
error[E0277]: `Rectangle` doesn't implement `std::fmt::Display`
Expand Down Expand Up @@ -195,7 +195,7 @@ Let’s try it! The `println!` macro call will now look like `println!("rect1 is
enables us to print our struct in a way that is useful for developers so we can
see its value while we’re debugging our code.

Run the code with this change. Drat! We still get an error:
Compile the code with this change. Drat! We still get an error:

```text
error[E0277]: `Rectangle` doesn't implement `std::fmt::Debug`
Expand Down

0 comments on commit 9cb1d20

Please sign in to comment.