summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2015-07-30Auto merge of #27371 - Gankro:str-clone, r=alexcrichtonbors-0/+14
This is a minor [breaking-change], as it changes what `boxed_str.to_owned()` does (previously it would deref to `&str` and call `to_owned` on that to get a `String`). However `Box<str>` is such an exceptionally rare type that this is not expected to be a serious concern. Also a `Box<str>` can be freely converted to a `String` to obtain the previous result anyway.
2015-07-30Auto merge of #27174 - Gankro:rc-sat, r=alexcrichtonbors-7/+42
See https://internals.rust-lang.org/t/rc-is-unsafe-mostly-on-32-bit-targets-due-to-overflow/2120 for detailed discussion of this problem.
2015-07-29implement Clone for Box<str>, closes #27323Alexis Beingessner-0/+14
This is a minor [breaking-change], as it changes what `boxed_str.to_owned()` does (previously it would deref to `&str` and call `to_owned` on that to get a `String`). However `Box<str>` is such an exceptionally rare type that this is not expected to be a serious concern. Also a `Box<str>` can be freely converted to a `String` to obtain the previous behaviour anyway.
2015-07-29make Arc mem::forget safeAlexis Beingessner-4/+26
2015-07-29make Rc mem::forget safeAlexis Beingessner-3/+16
2015-07-29Rollup merge of #27326 - steveklabnik:doc_show_use, r=GankroSteve Klabnik-22/+44
In spirit with https://internals.rust-lang.org/t/should-we-keep-including-obvious-imports-in-code-examples/2217, show the feature flags we're using in examples. (also one instance of 'use')
2015-07-28Auto merge of #26934 - reem:boxed-slice-clone, r=Gankrobors-1/+55
Closes #25097
2015-07-28Auto merge of #27309 - eddyb:snapshot-infdef, r=alexcrichtonbors-3/+1
FreeBSD i386 snapshot is missing, failed tests (possibly spurious). r? @alexcrichton
2015-07-28Implement Clone for Box<[T]> where T: CloneJonathan Reem-1/+55
Closes #25097
2015-07-27std: Deprecate a number of unstable featuresAlex Crichton-0/+3
Many of these have long since reached their stage of being obsolete, so this commit starts the removal process for all of them. The unstable features that were deprecated are: * cmp_partial * fs_time * hash_default * int_slice * iter_min_max * iter_reset_fuse * iter_to_vec * map_in_place * move_from * owned_ascii_ext * page_size * read_and_zero * scan_state * slice_chars * slice_position_elem * subslice_offset
2015-07-27Show appropriate feature flags in docsSteve Klabnik-22/+44
2015-07-27Turn on `box(PLACE) expr` deprecation warning post-snapshot.Eduard Burtescu-1/+1
2015-07-27Register new snapshots (2015-07-26 a5c12f4).Eduard Burtescu-2/+0
2015-07-23fix doc-tests by opting into `placement_in_syntax` feature where necessary.Felix S. Klock II-1/+1
2015-07-23Review feedback: add unstable marker to Placer API and put in bound that now ↵Felix S. Klock II-0/+3
works.
2015-07-22address review feedback: remove dupe feature opt-in.Felix S. Klock II-1/+0
2015-07-22Add feature-gates for desugaring-based `box` and placement-`in`.Felix S. Klock II-0/+2
update test/compile-fail/feature-gate-box-expr.rs to reflect new feature gates. Part of what lands with Issue 22181.
2015-07-22prototype Placer protocol for unstable overloaded-box and placement-in.Felix S. Klock II-5/+102
2015-07-20Register new snapshotsAlex Crichton-17/+0
These new snapshots contain the knowledge of how to build the new triples of 32-bit MSVC and 32-bit FreeBSD, both of which should soon start having nightlies/auto builders! This does not currently register bitrig/freebsd snapshots but I believe those will be retroactively added in the near future.
2015-07-17Add RawVec to unify raw Vecish codeAlexis Beingessner-1/+456
2015-07-13Update boxed.rsWei-Ming Yang-2/+2
Reverse PR `#26944 `, symbol `#` are actually as intended.
2015-07-11Update boxed.rsWei-Ming Yang-2/+2
fix typos
2015-07-08trans: Link rlibs to dylibs with --whole-archiveAlex Crichton-0/+1
This commit starts passing the `--whole-archive` flag (`-force_load` on OSX) to the linker when linking rlibs into dylibs. The primary purpose of this commit is to ensure that the linker doesn't strip out objects from an archive when creating a dynamic library. Information on how this can go wrong can be found in issues #14344 and #25185. The unfortunate part about passing this flag to the linker is that we have to preprocess the rlib to remove the metadata and compressed bytecode found within. This means that creating a dylib will now take longer to link as we've got to copy around the input rlibs to a temporary location, modify them, and then invoke the linker. This isn't done for executables, however, so the "hello world" compile time is not affected. This fix was instigated because of the previous commit where rlibs may not contain multiple object files instead of one due to codegen units being greater than one. That change prevented the main distribution from being compiled with more than one codegen-unit and this commit fixes that. Closes #14344 Closes #25185
2015-07-03Fix 'Relaaxed' typo in code commentCorey Farwell-1/+1
2015-07-03Auto merge of #26610 - aturon:fix_make_unique, r=alexcrichtonbors-79/+177
This commit resolves the race condition in the `get_mut` and `make_unique` functions, which arose through interaction with weak pointers. The basic strategy is to "lock" the weak pointer count when trying to establish uniqueness, by reusing the field as a simple spinlock. The overhead for normal use of `Arc` is expected to be minimal -- it will be *none* when only strong pointers are used, and only requires a move from atomic increment to CAS for usage of weak pointers. The commit also removes the `unsafe` and deprecated status of these functions. Closes #24880 r? @alexcrichton cc @metajack @SimonSapin @Ms2ger
2015-07-02Fix race condition in Arc's get_mut and make_unqiueAaron Turon-79/+177
This commit resolves the race condition in the `get_mut` and `make_unique` functions, which arose through interaction with weak pointers. The basic strategy is to "lock" the weak pointer count when trying to establish uniqueness, by reusing the field as a simple spinlock. The overhead for normal use of `Arc` is expected to be minimal -- it will be *none* when only strong pointers are used, and only requires a move from atomic increment to CAS for usage of weak pointers. The commit also removes the `unsafe` and deprecated status of these functions. Along the way, the commit also improves several memory orderings, and adds commentary about why various orderings suffice.
2015-07-01Implement CoerceUnsized for arc::WeakRemi Rampin-0/+2
2015-07-01Implement CoerceUnsized for rc::WeakRemi Rampin-0/+2
Fixes #26704
2015-06-26Use Box::into_raw rather than the deprecated boxed::into_raw in tests and ↵Ms2ger-8/+6
documentation.
2015-06-24Make `align_of` behave like `min_align_of`.Huon Wilson-7/+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-17Add comment about stabilizing CString::from_ptrAlex Crichton-0/+2
This naming needs to consider the raw vs ptr naming of Box/CStr/CString/slice/etc.
2015-06-17More test fixes and fallout of stability changesAlex Crichton-24/+21
2015-06-17std: Move free-functions to associated functionsAlex Crichton-35/+153
This commit moves the free functions in the `rc`, `arc`, and `boxed` modules to associated functions on their respective types, following the recent trend towards this pattern. The previous free functions are all left in-place with `#[deprecated]` pointers towards the new locations. This commit also deprecates `arc::get_mut` and `Arc::make_unique` with no replacement as they are racy in the face of weak pointers.
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-33/+30
2015-06-17alloc: Split apart the global `alloc` featureAlex Crichton-25/+34
2015-06-17core: Split apart the global `core` featureAlex Crichton-16/+24
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-06-15Auto merge of #26265 - retep998:heapalloc, r=alexcrichtonbors-17/+102
This removes our dependency on the CRT for memory allocation.
2015-06-13Switch to direct HeapAlloc on Windows when not using jemallocPeter Atashian-17/+102
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-06-12Auto merge of #26160 - alexcrichton:revert-rc-as-ref, r=aturonbors-19/+0
This is a revert of PR #26008 which caused the unintended breakage reported in #26096. We may want to add these implementations in the long run, but for now this revert allows us to take some more time to evaluate the impact of such a change (e.g. run it through crater). Closes #26096
2015-06-09Revert "Added AsRef implementations for Arc and Rc"Alex Crichton-19/+0
This reverts commit 7f3ae0aa26d24100379ae0f3eef29916a32f4e79.
2015-06-09Exise 'owned pointer' from the codebaseSteve Klabnik-3/+3
Still some references left to this old term, I've updated them to say boxes. Related to #25851
2015-06-08Auto merge of #25823 - oli-obk:static_to_const_lint, r=alexcrichtonbors-1/+1
r? @eddyb
2015-06-07change some statics to constantsOliver 'ker' Schneider-1/+1
2015-06-06Remove many unneeded feature annotations in the docsSteve Klabnik-3/+0
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-06-04Added AsRef implementations for Arc and RcMarkus Westerlind-0/+19
2015-05-30Mark Arc function get_mut and method make_unique unsafeUlrik Sverdrup-35/+56
This is a temporary mitigation for issue #24880 which points out that these functions are racy in a particular situation where weak pointers exist. To mitigate this, mark the functions unsafe until this can be fixed or another decision is made. This is a breaking change to unstable API, because the new version requires an `unsafe` block. Review carefully if weak pointers may race for any uses of this API and consider abandoning it. [breaking-change]
2015-05-27Remove #[cfg(stage0)] items.Eduard Burtescu-1115/+6
2015-05-24Mark `boxed::into_raw` as safeMichael Layzell-7/+3
By the same logic that `mem::forget` is safe, `boxed::into_raw` is actually a safe function. Fixes #25755.
2015-05-21she -> they in Dining PhilosophersSteve Klabnik-1/+1
Also, when checking for common gendered words elsewhere, I found one 'he', moved to 'they' as well. https://github.com/rust-lang/rust/pull/25640#issuecomment-104304643
2015-05-20Auto merge of #25588 - bluss:doc-string-from, r=alexcrichtonbors-2/+2
Use stable code in doc examples (libcollections) Main task is to change from String::from_str to String::from in examples for String (the latter constructor is stable). While I'm at it, also remove redundant feature flags, fix some other instances of unstable code in examples (in examples for stable methods), and remove some use of usize in examples too.