-
Notifications
You must be signed in to change notification settings - Fork 13.3k
doc: add a "primitive type reference" page #33516
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
Conversation
While it is not useful to list impls here, and there are no inherent methods, references are still a primitive (and very important) type and should get an entry in the overview on http://doc.rust-lang.org/std/#primitives and a place to put general verbiage about references, and probably a reference to the book. We do *not* add links to this page from other types, like we do for `&[T]`, because that would likely be more confusing than helpful. Fixes: rust-lang#15654
Nice, I would like to see this. @alexcrichton is this the right way to do this? It feels right to me, but would like to double check. |
/// are represented as pointers, but the compiler can statically ensure that no | ||
/// unsafety results from passing and dereferencing them. | ||
/// | ||
/// Shared references (`&T`) allow read-only access to the pointee, while |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somewhat nuanced where types like &Cell<T>
are actually read/write, not just read only. Perhaps this could just indicate "allows aliasing"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the official term is just "reference", not "shared reference"
Are there any incoming links to this page anywhere as well? |
// | ||
/// Borrowed references, `&T`, and `&mut T`. | ||
/// | ||
/// References fundamental to Rust's system of ownership and borrowing. They |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
References are fundamental
Closing due to inactivity, but feel free to reopen with comments addressed! |
While it is not useful to list impls here, and there are no inherent methods, references are still a primitive (and very important) type and should get an entry in the overview on http://doc.rust-lang.org/std/#primitives and a place to put general verbiage about references, and probably a reference to the book.
We do not add links to this page from other types, like we do for
&[T]
, because that would likely be more confusing than helpful.Fixes: #15654
r? @steveklabnik - the documentation I put in primitive_docs.rs is just a placeholder for what you'd like to put there :)