Skip to content
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

Clarify C-DEREF #251

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Clarify C-DEREF #251

wants to merge 2 commits into from

Conversation

CAD97
Copy link

@CAD97 CAD97 commented Aug 25, 2021

The ship has flown the nest; Deref is not exclusively for smart pointers anymore.

Fixes #249, the direct contradiction of C-DEREF with idiomatic std APIs.

The ship has flown the nest; `Deref` is not exclusively for smart pointers anymore.

Fixes rust-lang#249, the direct contradiction of C-DEREF with idiomatic std APIs.
@CAD97
Copy link
Author

CAD97 commented Aug 25, 2021

This is weaker than some of the other proposals I've made for how we could reword C-DEREF and/or C-SMART-PTR in #249, but I think this is a small, reasonable, incremental improvement/clarification that should be fairly unobjectionable.

@@ -141,7 +141,7 @@ specifically to accommodate smart pointers, and so the traits should be used
with those rules in mind.

As a general guideline, consider the "_as-a_" rule. If you implement `Deref`,
wherever `&Target` is acceptable, `&Self` works just as well as a `&Target`.
wherever `&Target` is acceptable, `&Self` works just as well as `&Target`.
Copy link
Author

@CAD97 CAD97 Aug 25, 2021

Choose a reason for hiding this comment

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

I originally wanted to have a literal "as a" here, but I'd rather completely avoid the a/an question for &Type since this is still grammatically correct without the article, if not more correct (due to the lack of an article on &Self).

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.

C-DEREF contradicts idiomatic API in the standard library
1 participant