about summary refs log tree commit diff
path: root/src/libcore/mem.rs
AgeCommit message (Collapse)AuthorLines
2017-09-13update "since" for discriminant_valueAlex Burka-8/+8
It's going to be backported to beta.
2017-09-04Additional traits for std::mem::ManuallyDropLance Roy-4/+61
Add pass-through implementations for all of the derivable traits. These cannot be derived since ManuallyDrop is a union.
2017-09-04Derive std::mem::ManuallyDrop from Clone and Copy.Lance Roy-0/+14
Although types that don't implement Drop can't be Copyable, this can still be useful when ManuallyDrop is used inside a generic type. This doesn't derive from Copy as that would require T: Copy + Clone, instead it provides an impl of Clone for T: Clone.
2017-09-02stabilize mem::discriminant (closes #24263)Alex Burka-9/+8
2017-08-31Update bootstrap compilerAlex Crichton-43/+0
This commit updates the bootstrap compiler and clears out a number of #[cfg(stage0)] annotations and related business
2017-08-24Fix inconsistent doc headingslukaramu-1/+1
This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574.
2017-08-11Add `#[inline]` to `mem::unreachable`Tobias Bucher-0/+1
2017-08-09`mem::unreachable`: Add tracking issueTobias Bucher-1/+1
2017-08-09Put `intrinsics::unreachable` on a possible path to stabilizationTobias Bucher-0/+11
Mark it with the `unreachable` feature and put it into the `mem` module. This is a pretty straight-forward API that can already be simulated in stable Rust by using `transmute` to create an uninhabited enum that can be matched.
2017-07-25std: Stabilize `manually_drop` featureAlex Crichton-10/+7
Stabilizes * `core::mem::ManuallyDrop` * `std::mem::ManuallyDrop` * `ManuallyDrop::new` * `ManuallyDrop::into_inner` * `ManuallyDrop::drop` * `Deref for ManuallyDrop` * `DerefMut for ManuallyDrop` Closes #40673
2017-07-19Implement const fn {size,align}_of.Eduard-Mihai Burtescu-0/+43
2017-06-28Auto merge of #42819 - scottmcm:swap-nonoverlapping, r=sfacklerbors-53/+1
Reuse the mem::swap optimizations to speed up slice::rotate This is most helpful for compound types where LLVM didn't vectorize the loop. Highlight: bench slice::rotate_medium_by727_strings gets 38% faster. Exposes the swapping logic from PR https://github.com/rust-lang/rust/pull/40454 as `pub unsafe fn ptr::swap_nonoverlapping` under library feature `swap_nonoverlapping` https://github.com/rust-lang/rust/issues/42818. (The new method seemed plausible, and was the simplest way to share the logic. I'm not attached to it, though, so let me know if a different way would be better.)
2017-06-23Removed as many "```ignore" as possible.kennytm-4/+11
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-21Reuse the mem::swap optimizations to speed up slice::rotateScott McMurray-53/+1
Exposes the swapping logic from PR 40454 as `pub unsafe fn ptr::swap_nonoverlapping` under feature swap_nonoverlapping This is most helpful for compound types where LLVM didn't vectorize the loop. Highlight: bench slice::rotate_medium_by727_strings gets 38% faster.
2017-06-19Disable repr(simd) in mem::swap on RedoxJeremy Soller-2/+2
2017-06-11Auto merge of #40454 - djzin:fast-swap, r=sfacklerbors-13/+54
speed up mem::swap I would have thought that the mem::swap code didn't need an intermediate variable precisely because the pointers are guaranteed never to alias. And.. it doesn't! It seems that llvm will also auto-vectorize this case for large structs, but alas it doesn't seem to have all the aliasing info it needs and so will add redundant checks (and even not bother with autovectorizing for small types). Looks like a lot of performance could still be gained here, so this might be a good test case for future optimizer improvements. Here are the current benchmarks for the simd version of mem::swap; the timings are in cycles (code below) measured with 10 iterations. The timings for sizes > 32 which are not a multiple of 8 tend to be ever so slightly faster in the old code, but not always. For large struct sizes (> 1024) the new code shows a marked improvement. \* = latest commit † = subtracted from other measurements | arr_length | noop<sup>†</sup> | rust_stdlib | simd_u64x4\* | simd_u64x8 |------------------|------------|-------------------|-------------------|------------------- 8|80|90|90|90 16|72|177|177|177 24|32|76|76|76 32|68|188|112|188 40|32|80|60|80 48|32|84|56|84 56|32|108|72|108 64|32|108|72|76 72|80|350|220|230 80|80|350|220|230 88|80|420|270|270 96|80|420|270|270 104|80|500|320|320 112|80|490|320|320 120|72|528|342|342 128|48|360|234|234 136|72|987|387|387 144|80|1070|420|420 152|64|856|376|376 160|68|804|400|400 168|80|1060|520|520 176|80|1070|520|520 184|32|464|228|228 192|32|504|228|228 200|32|440|248|248 208|72|987|573|573 216|80|1464|220|220 224|48|852|450|450 232|72|1182|666|666 240|32|428|288|288 248|32|428|308|308 256|80|860|770|770 264|80|1130|820|820 272|80|1340|820|820 280|80|1220|870|870 288|72|1227|804|804 296|72|1356|849|849
2017-06-09hack around bug in emscriptenDjzin-1/+3
2017-05-31Rollup merge of #42252 - stjepang:clarify-alignof-docs, r=nikomatsakisMark Simulacrum-4/+4
Clarify the docs for align_of and its variants It's okay to have unaligned raw pointers and then use `ptr::write_unaligned` and `ptr::read_unaligned`. However, using unaligned `&T` and `&mut T` would be undefined behavior. The current documentation seems to indicate that everything has to be aligned, but in reality only references do. This PR changes the text of docs accordingly. r? @sfackler
2017-05-30Add 'the'Stjepan Glavina-4/+4
2017-05-28restore old behaviourDjzin-18/+1
2017-05-28restore old behaviour for sizes < 128Djzin-41/+34
2017-05-27better respect alignment for copying tailDjzin-25/+37
2017-05-27Merge remote-tracking branch 'upstream/master' into fast-swapDjzin-8/+178
2017-05-27copy tail bytes better for aligned typesDjzin-0/+21
2017-05-27Clarify the docs for align_of and its variantsStjepan Glavina-4/+4
2017-05-20expose needs_drop under mem::Alexis Beingessner-0/+52
2017-05-07fix nitDjzin-1/+1
2017-05-07improve wordingDjzin-2/+1
2017-05-07optimize out stack alignment for sizes < 32Djzin-5/+12
2017-04-29process:exit -> process::exit in mem::forget docsNathan Moos-1/+1
The documentation in mem::forget says "...or call `process:exit`..." instead of `process::exit`. r? @steveklabnik
2017-04-24change wordingDjzin-1/+1
2017-04-09into_inner to associated functionSimonas Kazlauskas-2/+19
2017-04-09 Replace the `forget` intrinsic with ManuallyDropSimonas Kazlauskas-1/+6
less intrinsics = better life
2017-04-09Implement Manually DropSimonas Kazlauskas-0/+96
2017-03-20Fix up various linkssteveklabnik-5/+5
The unstable book, libstd, libcore, and liballoc all needed some adjustment.
2017-03-15use simd blocksDjzin-10/+20
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-1/+1
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-13add SWAP_BLOCK_SIZE constantDjzin-7/+9
2017-03-12fix typoDjzin-1/+1
2017-03-12a new approach; ditch xor cuteness and maximize cache localityDjzin-6/+18
2017-03-12avoid recursionDjzin-2/+5
2017-03-12speed up mem::swapDjzin-12/+9
2017-02-21Get linkchecker cleanSteve Klabnik-4/+4
This affects the book, some missed things in the reference, the grammar, and the standard library. Whew!
2017-02-20Revert "Fix up links"Steve Klabnik-1/+1
This reverts commit 7f1d1c6d9a7be5e427bace30e740b16b25f25c92. The original commit was created because mdBook and rustdoc had different generation algorithms for header links; now with https://github.com/rust-lang/rust/pull/39966 , the algorithms are the same. So let's undo this change. ... when I came across this problem, I said "eh, this isn't fun, but it doesn't take that long." I probably should have just actually taken the time to fix upstream, given that they were amenable. Oh well!
2017-02-13Fix up linksSteve Klabnik-1/+1
mdbook and rustdoc generate links differently, so we need to change all these links.
2016-11-11Add missing urls for mem moduleGuillaume Gomez-16/+23
2016-09-27add wrapper for discriminant_valueAlex Burka-0/+82
2016-09-10Tweak std::mem docsKeegan McAllister-93/+201
Fixes #29362.
2016-08-25Auto merge of #35906 - jseyfried:local_prelude, r=eddybbors-1/+0
Use `#[prelude_import]` in `libcore` and `libstd` r? @eddyb
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-1/+0