Skip to content

Take method invocation semantics out of chapter on deref coercion. #28203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/doc/trpl/deref-coercions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down