about summary refs log tree commit diff
path: root/src/libcore/mem.rs
AgeCommit message (Collapse)AuthorLines
2018-08-31Implement the `min_const_fn` feature gateOliver Schneider-0/+28
2018-08-27Auto merge of #53227 - nivkner:pin_move, r=RalfJungbors-147/+2
move the Pin API into its own module for centralized documentation This implements the change proposed by @withoutboats in #49150, as suggested by @RalfJung in the review of #53104, along with the documentation that was originally in it, that was deemed more appropriate in module-level documentation. r? @RalfJung
2018-08-23Discourage overuse of mem::forgetKornel-39/+7
2018-08-23move PinMut into pin module and export through stdNiv Kaminer-147/+2
2018-08-09repr(transparent)Ralf Jung-0/+1
2018-08-06remove unnecessary CoerceUnsized implRalf Jung-3/+0
2018-08-03unsized ManuallyDropRalf Jung-3/+8
2018-08-01Switch to bootstrapping from 1.29 betaMark Rousskov-7/+0
2018-07-25Change ManuallyDrop from an union to a struct and make it a lang item.Eduard-Mihai Burtescu-92/+16
2018-07-21Don't use SIMD in mem::swap for types smaller than the block sizeScott McMurray-1/+1
LLVM isn't able to remove the alloca for the unaligned block in the SIMD tail in some cases, so doing this helps SRoA work in cases where it currently doesn't. Found in the `replace_with` RFC discussion.
2018-07-05Clarifying how the alignment of the struct worksVal Markovic-1/+4
The docs were not specifying how to compute the alignment of the struct, so I had to spend some time trying to figure out how that works. Found the answer [on this page](http://camlorn.net/posts/April%202017/rust-struct-field-reordering.html): > The total size of this struct is 5, but the most-aligned field is b with alignment 2, so we round up to 6 and give the struct an alignment of 2 bytes.
2018-07-02Implement `UnsafeFutureObj` for `&mut Future`Josef Reinhard Brandl-1/+3
2018-07-02Make `drop` method for `PinMut`'s `UnsafeFutureObj` impl emptyJosef Reinhard Brandl-3/+1
2018-07-02`UnsafeFutureObj` impl for `PinMut`Josef Reinhard Brandl-0/+17
2018-06-23`PinMut`: Add safe `get_mut` and rename unsafe fns to `get_mut_unchecked` ↵Josef Reinhard Brandl-4/+10
and `map_unchecked`
2018-06-08Document size_of for 128-bit integersbstrie-0/+2
We might want to consider separately documenting the alignment of primitives, rather than just their size, since 128-bit integers, unlike all other primitives, have an alignment that is not identical to their size (size_of is 16, align_of is 8)
2018-06-02Rollup merge of #51124 - frewsxcv:frewsxcv-replace, r=QuietMisdreavusMark Simulacrum-2/+3
Reword {ptr,mem}::replace docs. Fixes https://github.com/rust-lang/rust/issues/50657.
2018-06-01Reword {ptr,mem}::replace docs.Corey Farwell-2/+3
Fixes https://github.com/rust-lang/rust/issues/50657.
2018-05-30Add doc link from discriminant struct to function.Corey Farwell-1/+3
2018-05-22Add PinMut::setTaylor Cramer-0/+8
2018-05-22Make `Unpin` safe to implementTaylor Cramer-1/+1
2018-05-09Rollup merge of #50148 - japaric:const-manuallydrop, r=oli-obkkennytm-1/+2
turn `ManuallyDrop::new` into a constant function
2018-05-07Rename PinMut::borrow to PinMut::reborrow and make it a methodRalf Jung-3/+6
2018-05-07PinMut::get_mut can also preserve the lifetimeRalf Jung-1/+1
2018-05-07Change PinMut::map to be able to preserve the original reference's lifetimeRalf Jung-1/+1
Suggested by @dylanede at <https://github.com/rust-lang/rust/issues/49150#issuecomment-381071442>.
2018-05-07Rename Pin to PinMutRalf Jung-24/+24
As discussed at [1] §3 and [2] and [3], a formal look at pinning requires considering a distinguished "shared pinned" mode/typestate. Given that, it seems desirable to at least eventually actually expose that typestate as a reference type. This renames Pin to PinMut, freeing the name Pin in case we want to use it for a shared pinned reference later on. [1] https://www.ralfj.de/blog/2018/04/10/safe-intrusive-collections-with-pinning.html [2] https://github.com/rust-lang/rfcs/pull/2349#issuecomment-379250361 [3] https://github.com/rust-lang/rust/issues/49150#issuecomment-380488275
2018-05-07make the const constructor unstableJorge Aparicio-0/+1
2018-04-21turn `ManuallyDrop::new` into a constant functionJorge Aparicio-1/+1
2018-04-16Stabilize core::hint::unreachable_unchecked.kennytm-12/+0
Closes #43751.
2018-04-03impl Unpin for PinWim Looman-0/+3
2018-03-18Update tracking issue.boats-14/+14
2018-03-15Pin and PinBox are fundamental.boats-0/+1
2018-03-14Pin and Unpin in libcore.boats-2/+109
2018-02-02Rollup merge of #46156 - SimonSapin:patch-14, r=withoutboatskennytm-0/+1
Document the size of bool
2017-12-27Correct a few stability attributesOliver Middleton-7/+7
2017-11-26Stabilize const-calling existing const-fns in stdSimon Sapin-2/+0
Fixes #46038
2017-11-21Document the size of boolSimon Sapin-0/+1
2017-10-26Bump to 1.23 and update bootstrapAlex Crichton-2/+2
This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-10-13Clarify how needs_drop is conservativeAlexis Beingessner-3/+5
2017-10-08core: Ensure std::mem::Discriminant is Send + SyncUlrik Sverdrup-1/+1
`PhantomData<*const T>` has the implication of Send / Syncness following the *const T type, but the discriminant should always be Send and Sync. Use `PhantomData<fn() -> T>` which has the same variance in T, but is Send + Sync
2017-10-01Auto merge of #44897 - Havvy:doc-size_of, r=steveklabnikbors-0/+78
Docs for size_of::<#[repr(C)]> items. Most of this info comes from camlorn's blog post on optimizing struct layout and the Rustonomicon. I don't really like my wording in the first paragraph. I also cannot find a definition of what `#[repr(C)]` does for enums that have variants with fields. They're allowed, unlike `#[repr(C)] enum`s with no variants.
2017-09-28Remove link duplication.Havvy-3/+3
2017-09-27Backticks.Havvy-1/+1
2017-09-27Docs for size_of::<#[repr(C)]> items.Havvy-0/+78
Most of this info comes from camlorn's blog post on optimizing struct layout and the Rustonomicon.
2017-09-24Backport libs stabilizations to 1.21 betaDavid Tolnay-1/+1
This includes the following stabilizations: - tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563 - iterator_for_each https://github.com/rust-lang/rust/pull/44567 - ord_max_min https://github.com/rust-lang/rust/pull/44593 - compiler_fences https://github.com/rust-lang/rust/pull/44595 - needs_drop https://github.com/rust-lang/rust/pull/44639 - vec_splice https://github.com/rust-lang/rust/pull/44640
2017-09-23Rollup merge of #44648 - Havvy:doc-size_of, r=dtolnayCorey Farwell-2/+46
Expand size_of docs This PR does 3 things. 1. Adds a description of what pointer size means to the primitive pages for usize and isize. 2. Says the general size of things is not stable from compiler to compiler. 3. Adds a table of sizes of things that we do guarantee. As this is the first table in the libstd docs, I've included a picture of how that looks. ![](https://i.imgur.com/YZ6IChH.png?1)
2017-09-20Document stable size_of primitives and pointer size guaranteesHavvy-2/+46
2017-09-16stabilized needs_drop (fixes #41890)Michal Budzynski-2/+1
2017-09-16Auto merge of #43017 - durka:stabilize-const-invocation, r=eddybbors-0/+2
Individualize feature gates for const fn invocation This PR changes the meaning of `#![feature(const_fn)]` so it is only required to declare a const fn but not to call one. Based on discussion at #24111. I was hoping we could have an FCP here in order to move that conversation forward. This sets the stage for future stabilization of the constness of several functions in the standard library (listed below), so could someone please tag the lang team for review. - `std::cell` - `Cell::new` - `RefCell::new` - `UnsafeCell::new` - `std::mem` - `size_of` - `align_of` - `std::ptr` - `null` - `null_mut` - `std::sync` - `atomic` - `Atomic{Bool,Ptr,Isize,Usize}::new` - `once` - `Once::new` - primitives - `{integer}::min_value` - `{integer}::max_value` Some other functions are const but they are also unstable or hidden, e.g. `Unique::new` so they don't have to be considered at this time. After this stabilization, the following `*_INIT` constants in the standard library can be deprecated. I wasn't sure whether to include those deprecations in the current PR. - `std::sync` - `atomic` - `ATOMIC_{BOOL,ISIZE,USIZE}_INIT` - `once` - `ONCE_INIT`
2017-09-16change #![feature(const_fn)] to specific gatesAlex Burka-0/+2