From fe3aa480cd36f6bc1dd35c3d58affb5b33be9baa Mon Sep 17 00:00:00 2001 From: Nikolai Vavilov Date: Thu, 13 Feb 2020 12:34:44 +0200 Subject: [PATCH] Clarify the wording MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "a type which didn’t implement the type which defines the method" doesn't make a lot of sense. --- src/ch10-02-traits.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ch10-02-traits.md b/src/ch10-02-traits.md index 0e01361d22..2980b60b2d 100644 --- a/src/ch10-02-traits.md +++ b/src/ch10-02-traits.md @@ -453,12 +453,12 @@ reduce duplication but also specify to the compiler that we want the generic type to have particular behavior. The compiler can then use the trait bound information to check that all the concrete types used with our code provide the correct behavior. In dynamically typed languages, we would get an error at -runtime if we called a method on a type which didn’t implement the type which -defines the method. But Rust moves these errors to compile time so we’re forced -to fix the problems before our code is even able to run. Additionally, we don’t -have to write code that checks for behavior at runtime because we’ve already -checked at compile time. Doing so improves performance without having to give -up the flexibility of generics. +runtime if we called a method on a type which didn’t define the method. But Rust +moves these errors to compile time so we’re forced to fix the problems before +our code is even able to run. Additionally, we don’t have to write code that +checks for behavior at runtime because we’ve already checked at compile time. +Doing so improves performance without having to give up the flexibility of +generics. Another kind of generic that we’ve already been using is called *lifetimes*. Rather than ensuring that a type has the behavior we want, lifetimes ensure