mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-02-02 23:38:41 +08:00
20 lines
653 B
Plaintext
20 lines
653 B
Plaintext
$ cargo run
|
|
Compiling traits-example v0.1.0 (file:///projects/traits-example)
|
|
error[E0283]: type annotations needed
|
|
--> src/main.rs:20:43
|
|
|
|
|
2 | fn baby_name() -> String;
|
|
| ------------------------- required by `Animal::baby_name`
|
|
...
|
|
20 | println!("A baby dog is called a {}", Animal::baby_name());
|
|
| ^^^^^^^^^^^^^^^^^ cannot infer type
|
|
|
|
|
= note: cannot satisfy `_: Animal`
|
|
|
|
error: aborting due to previous error
|
|
|
|
For more information about this error, try `rustc --explain E0283`.
|
|
error: could not compile `traits-example`
|
|
|
|
To learn more, run the command again with --verbose.
|