summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch19-advanced-features
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/listings/ch19-advanced-features')
-rw-r--r--src/doc/book/listings/ch19-advanced-features/listing-19-20/output.txt14
-rw-r--r--src/doc/book/listings/ch19-advanced-features/no-listing-18-returns-closure/output.txt2
2 files changed, 11 insertions, 5 deletions
diff --git a/src/doc/book/listings/ch19-advanced-features/listing-19-20/output.txt b/src/doc/book/listings/ch19-advanced-features/listing-19-20/output.txt
index 684508245..a3b281e3f 100644
--- a/src/doc/book/listings/ch19-advanced-features/listing-19-20/output.txt
+++ b/src/doc/book/listings/ch19-advanced-features/listing-19-20/output.txt
@@ -1,12 +1,18 @@
$ cargo run
Compiling traits-example v0.1.0 (file:///projects/traits-example)
-error[E0283]: type annotations needed
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> src/main.rs:20:43
|
+2 | fn baby_name() -> String;
+ | ------------------------- `Animal::baby_name` defined here
+...
20 | println!("A baby dog is called a {}", Animal::baby_name());
- | ^^^^^^^^^^^^^^^^^ cannot infer type
+ | ^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
- = note: cannot satisfy `_: Animal`
+help: use the fully-qualified path to the only available implementation
+ |
+20 | println!("A baby dog is called a {}", <::Dog as Animal>::baby_name());
+ | +++++++++ +
-For more information about this error, try `rustc --explain E0283`.
+For more information about this error, try `rustc --explain E0790`.
error: could not compile `traits-example` due to previous error
diff --git a/src/doc/book/listings/ch19-advanced-features/no-listing-18-returns-closure/output.txt b/src/doc/book/listings/ch19-advanced-features/no-listing-18-returns-closure/output.txt
index d6fffc967..104f2cf0f 100644
--- a/src/doc/book/listings/ch19-advanced-features/no-listing-18-returns-closure/output.txt
+++ b/src/doc/book/listings/ch19-advanced-features/no-listing-18-returns-closure/output.txt
@@ -7,7 +7,7 @@ error[E0746]: return type cannot have an unboxed trait object
| ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
-help: use `impl Fn(i32) -> i32` as the return type, as all return paths are of type `[closure@src/lib.rs:2:5: 2:14]`, which implements `Fn(i32) -> i32`
+help: use `impl Fn(i32) -> i32` as the return type, as all return paths are of type `[closure@src/lib.rs:2:5: 2:8]`, which implements `Fn(i32) -> i32`
|
1 | fn returns_closure() -> impl Fn(i32) -> i32 {
| ~~~~~~~~~~~~~~~~~~~