Skip to content

TRPL: Borrow and AsRef #24996

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
May 13, 2015
Merged

TRPL: Borrow and AsRef #24996

merged 1 commit into from
May 13, 2015

Conversation

steveklabnik
Copy link
Member

These two traits are commonly confused. As such, explain the difference.

Fixes #24163

r? @aturon

foo(&i);
foo(&mut i);
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could include the output here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@aturon
Copy link
Member

aturon commented May 12, 2015

Sorry for the long delay...

This looks good! Other than making sure to emphasize that these are specifically for use with generics, you should also mention that Borrow should only be used when the source and target types will produce the same hash, compare the same, etc.

These two traits are commonly confused. As such, explain the difference.

Fixes rust-lang#24163
@steveklabnik
Copy link
Member Author

@bors: r=aturon rollup

@bors
Copy link
Collaborator

bors commented May 12, 2015

📌 Commit e780fb2 has been approved by aturon

steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 12, 2015
These two traits are commonly confused. As such, explain the difference.

Fixes rust-lang#24163

r? @aturon
Manishearth added a commit to Manishearth/rust that referenced this pull request May 12, 2015
These two traits are commonly confused. As such, explain the difference.

Fixes rust-lang#24163

r? @aturon
bors added a commit that referenced this pull request May 12, 2015
@bors bors merged commit e780fb2 into rust-lang:master May 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve docs differentiating Borrow and AsRef
4 participants