Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upstd: Standardize (input, output) param orderings #23866
Conversation
rust-highfive
assigned
brson
Mar 30, 2015
This comment has been minimized.
This comment has been minimized.
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
r? @aturon |
rust-highfive
assigned
aturon
and unassigned
brson
Mar 30, 2015
petrochenkov
reviewed
Mar 30, 2015
| } | ||
|
|
||
| #[stable(feature = "rust1", since = "1.0.0")] | ||
| #[cfg(not(stage0))] | ||
| pub use intrinsics::copy; |
This comment has been minimized.
This comment has been minimized.
petrochenkov
Mar 30, 2015
Contributor
It may be an off-topic, but I always wanted to ask - why copy and copy_nonoverlapping are in ptr and not in mem?
mem::copy - copy memory, totally understandable and resembles memcpy
ptr::copy - what? copy pointer?
This comment has been minimized.
This comment has been minimized.
alexcrichton
Mar 30, 2015
Author
Member
APIs that are centered around raw pointers go in std::ptr currently while those dealing with references go in std::mem (in general). Also, the _memory suffix from ptr::copy_memory was recently dropped as there's probably not much you're copying with pointers other than the memory itself.
This comment has been minimized.
This comment has been minimized.
Manishearth
added a commit
to Manishearth/rust
that referenced
this pull request
Mar 31, 2015
bors
added a commit
that referenced
this pull request
Mar 31, 2015
bors
merged commit acd48a2
into
rust-lang:master
Mar 31, 2015
1 check passed
This comment has been minimized.
This comment has been minimized.
|
Thanks for causing segfaults all over my code with this change that was obviously not in need of an RFC because it was submitted by @alexcrichton himself. This is what one has to expect from |
alexcrichton
deleted the
alexcrichton:switch-some-orders
branch
Apr 2, 2015
This comment has been minimized.
This comment has been minimized.
|
IIRC, stable isn't really stable until 1.0 (or maybe beta?). As is, we're still in alpha. From the blog post:
|
This comment has been minimized.
This comment has been minimized.
|
Yeah, who gives a beep about undetectable changes that are guaranteed to introduce memory unsafety all over the place downstream. |
This comment has been minimized.
This comment has been minimized.
|
Other people silently breaking your code is really annoying but please remain civil; this is not lkml. You're using an unstable alpha language and Alex made that change to prevent future confusion (users generally expect copy to be from-to). |
This comment has been minimized.
This comment has been minimized.
You're conflating breaking with introducing undefined behavior that cannot be detected without manually auditing every place
I don't read lkml but you're making it sound like a swell place.
Nonsense. |
This comment has been minimized.
This comment has been minimized.
|
It's too late now, but I guarantee this will confuse a large number of people coming from C and expecting a memcpy replacement. Though I suppose that bridge is already crossed by |
This comment has been minimized.
This comment has been minimized.
|
Regarding the confusion, I honestly think that if people blindly write code expecting it to be the same as in some other language then that's on them. If it were named the same then yeah I would agree that could be misleading. |
This comment has been minimized.
This comment has been minimized.
|
(not trying to be vitriolic) Was this ever discussed in an RFC? This seems like something that would have happened in one of the stabilization RFCs, and I stopped subscribing to rustc dev a couple months ago (mailbox was becoming too fat) |
This comment has been minimized.
This comment has been minimized.
|
@aturon @alexcrichton Whoa, this was not the right call. I'm with the others. If i had known about this, I would be completely opposed. |
This comment has been minimized.
This comment has been minimized.
|
I think this should be reverted. Submitted #24142 to revert it. |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton what about |
alexcrichton commentedMar 30, 2015
This functions swaps the order of arguments to a few functions that previously
took (output, input) parameters, but now take (input, output) parameters (in
that order).
The affected functions are:
Closes #22890
[breaking-change]