Uh oh!
There was an error while loading. Please reload this page.
Constify copy related functions - #83091
Conversation
rust-highfive
commented
Mar 13, 2021
r? @KodrAus (rust-highfive has picked a reviewer for you, use r? to override) |
What do we want to call the feature gate for copy_to and copy_from? Would it make sense to reuse |
RalfJung
commented
Mar 14, 2021
Cc @rust-lang/wg-const-eval
Yeah that makes sense. |
There was a problem hiding this comment.
Do we want to keep these checks? The same checks were removed for ptr::copy_nonoverlapping when it was constified in #79684
There was a problem hiding this comment.
For copy_nonoverlapping we ended up removing them entirely also for performance reasons. I am not sure if those apply here.
There was a problem hiding this comment.
"Not sure" as in "Lets undo those changes for now so we can continue with the less controversial changes and maybe consider that for some other time"? Or just "Not sure" :)
There was a problem hiding this comment.
"Not sure" as in "let's see what others think"... @oli-obk ?
There was a problem hiding this comment.
I'm for removing the checks. I don't see why swap_nonoverlapping should have them while copy_nonoverlapping doesn't have them.
usbalbin
commented
Mar 15, 2021
I have removed the |
There was a problem hiding this comment.
could you create and reference an issue for these?
oli-obk
commented
Mar 15, 2021
one commit per feature gate is great, thanks! Once all unstable feature attributes have an issue instead of |
usbalbin
commented
Mar 15, 2021
bors
commented
Mar 15, 2021
@usbalbin: 🔑 Insufficient privileges: Not in reviewers |
copy related functionsjoshtriplett
commented
Mar 16, 2021
@bors r=oli-obk |
bors
commented
Mar 16, 2021
📌 Commit db9a53b has been approved by |
Rollup of 10 pull requests Successful merges: - rust-lang#81822 (Added `try_exists()` method to `std::path::Path`) - rust-lang#83072 (Update `Vec` docs) - rust-lang#83077 (rustdoc: reduce GC work during search) - rust-lang#83091 (Constify `copy` related functions) - rust-lang#83156 (Fall-back to sans-serif if Arial is not available) - rust-lang#83157 (No background for code in portability snippets) - rust-lang#83160 (Deprecate RustcEncodable and RustcDecodable.) - rust-lang#83162 (Specify *.woff2 files as binary) - rust-lang#83172 (More informative diagnotic from `x.py test` attempt atop beta checkout) - rust-lang#83196 (Use delay_span_bug instead of panic in layout_scalar_valid_range) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…Mark-Simulacrum Make copy/copy_nonoverlapping fn's again Make copy/copy_nonoverlapping fn's again, rather than intrinsics. This a short-term change to address issue rust-lang#84297. It effectively reverts PRs rust-lang#81167rust-lang#81238 (and part of rust-lang#82967), rust-lang#83091, and parts of rust-lang#79684.
…Mark-Simulacrum Make copy/copy_nonoverlapping fn's again Make copy/copy_nonoverlapping fn's again, rather than intrinsics. This a short-term change to address issue rust-lang#84297. It effectively reverts PRs rust-lang#81167rust-lang#81238 (and part of rust-lang#82967), rust-lang#83091, and parts of rust-lang#79684.
…r=jhpratt
Fix missing const for inherent pointer `replace` methods
`ptr::replace` (the free fn) is already const stable. However, there are inherent convenience methods on `*mut T` and `NonNull<T>`, allowing you to write eg. `unsafe { foo.replace(bar) }` where `foo` is `*mut T` or `NonNull<T>`.
It seems const was never added to the inherent method (likely oversight), so this PR adds it.
I don't believe this needs another[^1] FCP as the inherent methods are already stable and `ptr::replace` is already const stable, so this adds no new API.
Original tracking issue: rust-lang#83164
`ptr::replace` constified in rust-lang#83091
`ptr::replace` const stabilized in rust-lang#130954
[^1]: `const_replace` FCP completed: rust-lang#83164 (comment)Rollup merge of rust-lang#136877 - Sky9x:const-inherent-ptr-replace, r=jhpratt Fix missing const for inherent pointer `replace` methods `ptr::replace` (the free fn) is already const stable. However, there are inherent convenience methods on `*mut T` and `NonNull<T>`, allowing you to write eg. `unsafe { foo.replace(bar) }` where `foo` is `*mut T` or `NonNull<T>`. It seems const was never added to the inherent method (likely oversight), so this PR adds it. I don't believe this needs another[^1] FCP as the inherent methods are already stable and `ptr::replace` is already const stable, so this adds no new API. Original tracking issue: rust-lang#83164 `ptr::replace` constified in rust-lang#83091 `ptr::replace` const stabilized in rust-lang#130954 [^1]: `const_replace` FCP completed: rust-lang#83164 (comment)
…r=jhpratt
Fix missing const for inherent pointer `replace` methods
`ptr::replace` (the free fn) is already const stable. However, there are inherent convenience methods on `*mut T` and `NonNull<T>`, allowing you to write eg. `unsafe { foo.replace(bar) }` where `foo` is `*mut T` or `NonNull<T>`.
It seems const was never added to the inherent method (likely oversight), so this PR adds it.
I don't believe this needs another[^1] FCP as the inherent methods are already stable and `ptr::replace` is already const stable, so this adds no new API.
Original tracking issue: rust-lang#83164
`ptr::replace` constified in rust-lang#83091
`ptr::replace` const stabilized in rust-lang#130954
[^1]: `const_replace` FCP completed: rust-lang#83164 (comment)
Constify
*const T::copy_to[_nonoverlapping]*mut T::copy_to[_nonoverlapping]*mut T::copy_from[_nonoverlapping]mem::transmute_copymem::swapptr::swap[_nonoverlapping]mem::replaceptr::replace