You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a bit confused with the term "non-pointer types" used in the docs for Deref/DerefMut.
From docs for Deref
IfT implements Deref<Target = U>, and x is a value of typeT, then:*In immutable contexts,*x on non-pointer types is equivalent to *Deref::deref(&x).
From docs for DerefMut
IfT implements DerefMut<Target = U>, and x is a value of typeT, then:*In mutable contexts,*x on non-pointer types is equivalent to *DerefMut::deref_mut(&mut x).
The docs describe behavior of *x on non-pointer types.
If I assume "smart pointer"s are "pointer"s (as the Rust reference does),
it seems quite awkward to discuss behavior of *x on non-pointer types in the docs,
since docs for Deref & DerefMut say that "Deref/DerefMut should only be implemented for smart pointers".
If the term "non-pointer type" refers to smart pointers in this context,
would it be better to replace the term "non-pointer type" with either
just "smart pointer" or "non-primitive pointer type" ??
Thank you for reading this issue 🦀
The text was updated successfully, but these errors were encountered:
Elinvynia
added
the
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
label
May 20, 2020
…fackler
Rephrase term 'non-pointer type'
Hello 🐈 ,
If the reader assumes that 'pointer type's include 'smart pointer's,
the term 'non-pointer type' could mislead the reader to assume that
x should not be a smart pointer type. I tried to rephrase the term
'non-pointer type' to remove ambiguity in the doc comments.
closesrust-lang#72335
Thank you for reviewing this PR! 🦸♀️
Hi 🦀 ,
I'm a bit confused with the term "non-pointer types" used in the docs for
Deref
/DerefMut
.Deref
DerefMut
The docs describe behavior of
*x
on non-pointer types.If I assume "smart pointer"s are "pointer"s (as the Rust reference does),
it seems quite awkward to discuss behavior of
*x
on non-pointer types in the docs,since docs for
Deref
&DerefMut
say that"Deref/DerefMut should only be implemented for smart pointers".
If the term "non-pointer type" refers to smart pointers in this context,
would it be better to replace the term "non-pointer type" with either
just "smart pointer" or "non-primitive pointer type" ??
Thank you for reading this issue 🦀
The text was updated successfully, but these errors were encountered: