rust-lang/rust-by-example

Formatted print - fmt::Display example issue

Calm0016 opened this issue · 1 comments

In https://doc.rust-lang.org/rust-by-example/hello/print.html

at line 47 there is an example for

// This will not compile because `Structure` does not implement
// fmt::Display.
//println!("This struct `{}` won't print...", Structure(3));
// TODO ^ Try uncommenting this line

if you uncomment the 48th, 49th, or both lines it still throws an error message.

The first error in the code is at line 37 and is for you to correct as first activity.

The line 47 is part of the second activity and is intended to be done after the first. It shows how Structure can't be printed by default since it's a user defined type and thus not part of fmt::Display.
The following chapters will explain how user defined types can be printed.

The line 47 should be re-commented to complete the third and final activity.