about summary refs log tree commit diff
path: root/src/libcore/mem.rs
AgeCommit message (Collapse)AuthorLines
2016-01-14doc: this is more easy to read, and less prone mis-interpretationTshepang Lekhonkhobe-1/+1
This function returns the size on the stack, not that of the value that may be allocated on the heap.
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-2/+2
2015-11-12libcore: deny warnings in doctestsKevin Butler-0/+4
2015-10-13Correct spelling in docsAndrew Paseltiner-6/+6
2015-09-26Add note about Copy for drop()Manish Goregaokar-0/+20
2015-08-15core: Fill out issues for unstable featuresAlex Crichton-6/+6
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-30/+0
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-08-04Improve docs for mem::forget()Steve Klabnik-14/+16
We were burying the reason to use this function below a bunch of caveats about its usage. That's backwards. Why a function should be used belongs at the top of the docs, not the bottom. Also, add some extra links to related functions mentioned in the body.
2015-08-03Post merge changes to #27488Simonas Kazlauskas-8/+4
2015-08-03vastly expand on the mem::uninitialized docsAlexis Beingessner-6/+74
2015-07-05Auto merge of #26473 - Eljay:missing_docs, r=alexcrichtonbors-0/+5
Fixes #24249 I've tagged all items that were missing docs to allow them to compile for now, the ones in core/num should probably be documented at least. This is also a breaking change for any crates using `#[deny(missing_docs)]` that have undocumented constants, not sure there is any way to avoid this without making it a separate lint?
2015-06-29Improve doc for std::mem::dropSteve Klabnik-2/+39
This was pretty misleading, so let's improve. Fixes #26571
2015-06-26core: fix deprecation since version of align_of_min.Huon Wilson-2/+2
These will first be deprecated in 1.2.0, not 1.1.0.
2015-06-24Make `align_of` behave like `min_align_of`.Huon Wilson-13/+7
This removes a footgun, since it is a reasonable assumption to make that pointers to `T` will be aligned to `align_of::<T>()`. This also matches the behaviour of C/C++. `min_align_of` is now deprecated. Closes #21611.
2015-06-21Temp fix for all constants that are missing docs.Eljay-0/+5
2015-06-17std: Deprecate the copy_{,mut_}lifetime functionsAlex Crichton-0/+8
Unsafe patterns such as `slice::from_raw_parts` and `CStr::from_ptr` have shown that dealing with lifetimes, while useful, is often a hindrance. Consequently these functions are rarely called today and are being deprecated.
2015-06-17core: Split apart the global `core` featureAlex Crichton-2/+2
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-05-29Improve mem::forget documentationTim Ringenbach-6/+48
This adds an example from mem::swap, and provides some suggested uses of this function. Change wording on comment on forget line to be more specific as to why we need to call forget. This breaks the examples up into three pieces. The last piece isn't compiling for some reason.
2015-05-27Remove #[cfg(stage0)] items.Eduard Burtescu-34/+0
2015-05-13Remove SNAP commentsNick Cameron-4/+4
2015-05-13eddyb's changes for DST coercionsNick Cameron-0/+34
+ lots of rebasing
2015-05-07std: Mark `mem::forget` as a safe functionAlex Crichton-6/+45
This commit is an implementation of [RFC 1066][rfc] where the conclusion was that leaking a value is a safe operation in Rust code, so updating the signature of this function follows suit. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1066-safe-mem-forget.md Closes #25186
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-4/+4
2015-03-31Test fixes and rebase conflicts, round 1Alex Crichton-28/+17
2015-03-30std: Standardize (input, output) param orderingsAlex Crichton-3/+3
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: * ptr::copy * ptr::copy_nonoverlapping * slice::bytes::copy_memory * intrinsics::copy * intrinsics::copy_nonoverlapping Closes #22890 [breaking-change]
2015-03-26Added instability markers to `POST_DROP_*` consts, and related opt-in's.Felix S. Klock II-9/+18
(Reviewed rest of code; did not see other `pub` items that needed such treatment.) Driveby: fix typo in comment in ptr.rs.
2015-03-26A better `core::mem::dropped` implementation suggested by huonw on the PR.Felix S. Klock II-6/+9
2015-03-26filling-drop: switch `DTOR_NEEDED` and `DTOR_DONE` to non-trivial values.Felix S. Klock II-1/+1
2015-03-26Switch drop-flag to `u8` to allow special tags to instrument state.Felix S. Klock II-0/+57
Refactored code so that the drop-flag values for initialized (`DTOR_NEEDED`) versus dropped (`DTOR_DONE`) are given explicit names. Add `mem::dropped()` (which with `DTOR_DONE == 0` is semantically the same as `mem::zeroed`, but the point is that it abstracts away from the particular choice of value for `DTOR_DONE`). Filling-drop needs to use something other than `ptr::read_and_zero`, so I added such a function: `ptr::read_and_drop`. But, libraries should not use it if they can otherwise avoid it. Fixes to tests to accommodate filling-drop.
2015-03-25Change lint names to pluralsNick Cameron-1/+1
2015-03-25Add trivial cast lints.Nick Cameron-0/+2
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-1/+1
2015-02-24std: Stabilize some `ptr` functionsAlex Crichton-3/+3
Specifically, the following actions were taken: * The `copy_memory` and `copy_nonoverlapping_memory` functions to drop the `_memory` suffix (as it's implied by the functionality). Both functions are now marked as `#[stable]`. * The `set_memory` function was renamed to `write_bytes` and is now stable. * The `zero_memory` function is now deprecated in favor of `write_bytes` directly. * The `Unique` pointer type is now behind its own feature gate called `unique` to facilitate future stabilization. * All type parameters now are `T: ?Sized` wherever possible and new clauses were added to the `offset` functions to require that the type is sized. [breaking-change]
2015-02-16Update `core::mem` for `isize/usize` migration.Felix S. Klock II-8/+8
2015-02-05Make the lifetime anchor immutable on std::mem::copy_mut_lifetimeMikhail Zabaluev-3/+4
Only the second reference's mutability is relevant to the mutability of the returned reference.
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-7/+7
Conflicts: src/libcore/cmp.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/num/f32.rs src/libcore/num/f64.rs src/libcore/result.rs src/libcore/str/mod.rs src/librustc/lint/builtin.rs src/librustc/lint/context.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/poison.rs
2015-01-25Moving away from deprecated i/u suffixes in libcoreAlfie John-7/+7
2015-01-23grandfathered -> rust1Brian Anderson-15/+15
2015-01-23Set unstable feature names appropriatelyBrian Anderson-2/+2
* `core` - for the core crate * `hash` - hashing * `io` - io * `path` - path * `alloc` - alloc crate * `rand` - rand crate * `collections` - collections crate * `std_misc` - other parts of std * `test` - test crate * `rustc_private` - everything else
2015-01-21Remove 'since' from unstable attributesBrian Anderson-2/+2
2015-01-21Add 'feature' and 'since' to stability attributesBrian Anderson-19/+21
2015-01-07markers -> markerNick Cameron-1/+1
2015-01-07Change `std::kinds` to `std::markers`; flatten `std::kinds::marker`Nick Cameron-1/+1
[breaking-change]
2015-01-05Revert "Remove i suffix in docs"Alex Crichton-4/+4
This reverts commit f031671c6ea79391eeb3e1ad8f06fe0e436103fb. Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
2015-01-05Merge remote-tracking branch 'nrc/sized-2' into rollupAlex Crichton-2/+2
Conflicts: src/liballoc/boxed.rs src/libcollections/btree/map.rs src/libcollections/slice.rs src/libcore/borrow.rs src/libcore/cmp.rs src/libcore/ops.rs src/libstd/c_str.rs src/libstd/collections/hash/map.rs src/libsyntax/parse/obsolete.rs src/test/compile-fail/unboxed-closure-sugar-default.rs src/test/compile-fail/unboxed-closure-sugar-equiv.rs src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs src/test/compile-fail/unboxed-closure-sugar-region.rs src/test/compile-fail/unsized3.rs src/test/run-pass/associated-types-conditional-dispatch.rs
2015-01-06FalloutNick Cameron-2/+2
2015-01-05Remove i suffix in docsSteve Klabnik-4/+4
2014-12-17rollup merge of #19942: steveklabnik/doc_std_memAlex Crichton-46/+139
2014-12-16Document std::memSteve Klabnik-46/+139
2014-12-15std: Second-pass stabilization of `mem`Alex Crichton-3/+9
This commit takes a second pass through the `std::mem` module for stabilization. The only remaining non-stable items in this module were `forget`, `transmute`, `copy_lifetime`, and `copy_lifetime_mut`. The `forget` and `transmute` intrinsics themselves were marked `#[stable]` to propgate into the `core::mem` module so they would be marked stable. The `copy_lifetime` functions were left `unstable`, but `Sized?` annotations were added to the parameters to allow more general use with DSTs. The `size_of_val`, `min_align_of_val`, and `align_of_val` functions would like to grow `Sized?` bounds, but this is a backwards compatible change that currently ICEs the compiler, so this change was not made at this time. Finally, the module itself was declared `#![stable]` in this pass.