-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Doc: Clarify the meaning of "copy" in std::mem::swap/replace #18008
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
The Windows-specific instruction under 'Quick Start' linked the wiki article on getting started developing Rust itself, but the quick start is just about obtaining a working Rust installation. The actual wiki page with Windows-specific instructions was difficult to find.
The Sieve algorithm only requires checking all elements up to and including the square root of the maximum prime you're looking for. After that, the remaining elements are guaranteed to be prime.
Added 64-bit Windows support to the list of platforms. Support for 64-bit Windows was added in Rust 0.12.0. See https://mail.mozilla.org/pipermail/rust-dev/2014-October/011267.html for the release notes.
std::mem::replace by adding a distinction between semantic and byte copies.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon. |
A shallow byte-level copy is what a Copy is, no? I think this might be more confusing. |
Added 64-bit Windows support to the list of platforms. Support for 64-bit Windows was added in Rust 0.12.0. See https://mail.mozilla.org/pipermail/rust-dev/2014-October/011267.html for the release notes.
The Windows-specific instruction under 'Quick Start' linked the wiki article on getting started developing Rust itself, but the quick start is just about obtaining a working Rust installation. The actual wiki page with Windows-specific instructions was difficult to find. The most important thing to note on Windows is that you need mingw-builds, and it is totally not obvious. The only place where I have seen it mentioned is the wiki page, which was difficult to find before.
The Sieve algorithm only requires checking all elements up to and including the square root of the maximum prime you're looking for. After that, the remaining elements are guaranteed to be prime.
I guess it is a bit confusing, as Copy is for shallow byte copy-able types. I was trying to use the terminology used in this reddit thread: http://redd.it/2j1vqa. /u/dbaupp talks about the distinction in their comment. I'll have a think about a way to succinctly clarify the distinction. |
CC @huonw are you happy with this wording going into the docs? |
How about without |
Using |
(I'd say "without recursively copying" myself, rather than "without semantically copying". I don't know why I prefer the former over "clone" ... maybe I need to see more of the spots that @reem is referring to; I usually think of |
Are there ways to recursively copy other than by using |
Since we attach "semantic copy" to the Clone trait, I think it's an appropriate use of the term. You could say that this "swaps the values at two memory locations without dropping either one, using only shallow copies." |
FWIW, "semantic copy" is just terminology I have been using to describe the difference (the first time I know it was used was this SO answer of mine), it's not really attached to To be clear, I'm very happy with using the terminology in the docs, but I'm also happy with "clone" or "recursively copying". |
std::mem::replace by adding a distinction between semantic and byte copies.
Changes this terminology in the docs for std::mem::swap and std::mem::replace. Adds a reference to Clone in regards to recursive copying in these docs.
…into doc-mem-copy-meaning Conflicts: src/libcore/mem.rs
Alright I've updated the wording of the changed documentation with everyone's suggestions. I think I may have done something wrong in the process of committing/pulling though, so I apologize if I've made anything difficult for anyone, I'm totally new to git and github. |
@jrgold looks like this picked up a lot of extra commits, you may want to do something like this to start over:
|
@jrgold what's your status? |
Sorry, I've been really caught up with final exams these past few weeks, and I didn't want to risk doing something wrong here in case I didn't have the time to fix it. I've taken the steps @alexcrichton listed on my local copy. I'm unsure as to what other steps I need to take before pushing again; the development policy note talks about rebasing against master, but I'm not sure if that's only for the initial push before I made the pull request (I think I mucked this up before, which is what pulled in all those extra commits). |
If it's been a while, it's good policy to rebase against master in case someone's come by and changed things since. But this is up to your discretion as long as everything merges and checks. |
Yes, this will not merge without being rebased. |
Closing due to inactivity (and @bors's queue is quite full!). Feel free to reopen with a rebase! |
internal: Improve inlay hint resolution reliability The payload now ships the range the inlay hint ought to be triggered for instead of trying to estimate it from its position which is somewhat brittle
The use of "without copying" in the std::mem docs was a source of confusion to those less familiar with Rust, as it could refer to either semantic copying or byte copying. This clarifies which meaning was intended.