diff options
| author | benshu <benshu@benshu.de> | 2015-09-03 21:17:59 +0200 |
|---|---|---|
| committer | benshu <benshu@benshu.de> | 2015-09-03 21:17:59 +0200 |
| commit | 986f523b89924b4ba47daf0beee283a65d26f355 (patch) | |
| tree | 367740b45e8be2e1edac315fc61b813c036d6cd5 | |
| parent | 0762f58c1143b4ff0ae5d0cdda9cdd8249512e77 (diff) | |
| download | rust-986f523b89924b4ba47daf0beee283a65d26f355.tar.gz rust-986f523b89924b4ba47daf0beee283a65d26f355.zip | |
Take method invocation semantics out of chapter on deref coercion.
| -rw-r--r-- | src/doc/trpl/deref-coercions.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/doc/trpl/deref-coercions.md b/src/doc/trpl/deref-coercions.md index b7011100971..beb65c4ce35 100644 --- a/src/doc/trpl/deref-coercions.md +++ b/src/doc/trpl/deref-coercions.md @@ -89,8 +89,8 @@ Vectors can `Deref` to a slice. ## Deref and method calls -`Deref` will also kick in when calling a method. In other words, these are -the same two things in Rust: +`Deref` will also kick in when calling a method. Consider the following +example. ```rust struct Foo; @@ -99,13 +99,13 @@ impl Foo { fn foo(&self) { println!("Foo"); } } -let f = Foo; +let f = &&Foo; f.foo(); ``` -Even though `f` isn’t a reference, and `foo` takes `&self`, this works. -That’s because these things are the same: +Even though `f` is a `&&Foo` and `foo` takes `&self`, this works. That’s +because these things are the same: ```rust,ignore f.foo(); |
