summary refs log tree commit diff
path: root/src/libcore/mem
AgeCommit message (Collapse)AuthorLines
2019-06-29Rollup merge of #61199 - ollie27:rustdoc_cfg_test, r=QuietMisdreavusMazdak Farrokhzad-1/+4
Revert "Set test flag when rustdoc is running with --test option" Reverts https://github.com/rust-lang/rust/pull/59940. It caused doctests in this repository to no longer be tested including all of the core crate.
2019-06-18Make MaybeUninit #[repr(transparent)]Michael Bradshaw-1/+15
Tracking issue: #60405
2019-06-09Fix more tests after revert of rustdoc cfg(test) featureOliver Middleton-1/+4
2019-06-07Auto merge of #61130 - jonhoo:mem-take, r=SimonSapinbors-0/+55
Add std::mem::take as suggested in #61129 This PR implements #61129 by adding `std::mem::take`. The added function is equivalent to: ```rust std::mem::replace(dest, Default::default()) ``` This particular pattern is fairly common, especially when implementing `Future::poll`, where you often need to yield an owned value in `Async::Ready`. This change allows you to write ```rust return Async::Ready(std::mem::take(self.result)); ``` instead of ```rust return Async::Ready(std::mem::replace(self.result, Vec::new())); ``` EDIT: Changed name from `take` to `swap_default`. EDIT: Changed name back to `take`.
2019-06-05Escape needs_drop in the needs_drop documentationChris Gregory-1/+1
2019-06-05Escape HashMap with backticks in needs_drop docsChris Gregory-1/+1
2019-05-29Add std::mem::take as suggested in #61129Jon Gjengset-0/+55
The name `swap_default` was suggested but rejected. @SimonSapin observed that this operation isn't really a `swap` in the same sense as `mem::swap`; it is a `replace`. Since `replace_default` is a bit misleading, the "correct" name would be `replace_with_default`, which is quite verbose. @czipperz observed that we have precedence for using `take` to refer to methods that replace with `Default` in `Cell::take` and `Option::take`, so this reverts commit 99c00591c29b472c8a87c4a9342d0e0c508647a3 to return to the original `take` method name. The name `replace_with_default` was suggested, but was deemed too verbose, especially given that we use `take` for methods that replace with `Default` elsewhere.
2019-05-29split libcore::mem into multiple filesRalf Jung-0/+1417