about summary refs log tree commit diff
path: root/src/liballoc/boxed.rs
AgeCommit message (Collapse)AuthorLines
2015-10-17Remove some trivial `transmute`sAndrew Paseltiner-1/+1
`rbml::writer::Encoder::unsafe_clone` had no users across the entire repo.
2015-10-11Run rustfmt on liballoc.Ahmed Charles-4/+16
2015-10-02std: Add AsRef/AsMut impls to Box/Rc/ArcAlex Crichton-0/+10
These common traits were left off originally by accident from these smart pointers, and a past attempt (#26008) to add them was later reverted (#26160) due to unexpected breakge (#26096) occurring. The specific breakage in worry is the meaning of this return value changed: let a: Box<Option<T>> = ...; a.as_ref() Currently this returns `Option<&T>` but after this change it will return `&Option<T>` because the `AsRef::as_ref` method shares the same name as `Option::as_ref`. A [crater report][crater] of this change, however, has shown that the fallout of this change is quite minimal. These trait implementations are "the right impls to add" to these smart pointers and would enable various generalizations such as those in #27197. [crater]: https://gist.github.com/anonymous/0ba4c3512b07641c0f99 This commit is a breaking change for the above reasons mentioned, and the mitigation strategies look like any of: Option::as_ref(&a) a.as_ref().as_ref() (*a).as_ref()
2015-09-25Auto merge of #28610 - nrc:fmt6, r=brsonbors-34/+67
2015-09-24Remove the deprecated box(PLACE) syntax.Eduard Burtescu-2/+1
2015-09-24manual fixupsNick Cameron-3/+2
2015-09-24rustfmt liballocNick Cameron-34/+68
2015-09-11std: Stabilize/deprecate features for 1.4Alex Crichton-11/+3
The FCP is coming to a close and 1.4 is coming out soon, so this brings in the libs team decision for all library features this cycle. Stabilized APIs: * `<Box<str>>::into_string` * `Arc::downgrade` * `Arc::get_mut` * `Arc::make_mut` * `Arc::try_unwrap` * `Box::from_raw` * `Box::into_raw` * `CStr::to_str` * `CStr::to_string_lossy` * `CString::from_raw` * `CString::into_raw` * `IntoRawFd::into_raw_fd` * `IntoRawFd` * `IntoRawHandle::into_raw_handle` * `IntoRawHandle` * `IntoRawSocket::into_raw_socket` * `IntoRawSocket` * `Rc::downgrade` * `Rc::get_mut` * `Rc::make_mut` * `Rc::try_unwrap` * `Result::expect` * `String::into_boxed_slice` * `TcpSocket::read_timeout` * `TcpSocket::set_read_timeout` * `TcpSocket::set_write_timeout` * `TcpSocket::write_timeout` * `UdpSocket::read_timeout` * `UdpSocket::set_read_timeout` * `UdpSocket::set_write_timeout` * `UdpSocket::write_timeout` * `Vec::append` * `Vec::split_off` * `VecDeque::append` * `VecDeque::retain` * `VecDeque::split_off` * `rc::Weak::upgrade` * `rc::Weak` * `slice::Iter::as_slice` * `slice::IterMut::into_slice` * `str::CharIndices::as_str` * `str::Chars::as_str` * `str::split_at_mut` * `str::split_at` * `sync::Weak::upgrade` * `sync::Weak` * `thread::park_timeout` * `thread::sleep` Deprecated APIs * `BTreeMap::with_b` * `BTreeSet::with_b` * `Option::as_mut_slice` * `Option::as_slice` * `Result::as_mut_slice` * `Result::as_slice` * `f32::from_str_radix` * `f64::from_str_radix` Closes #27277 Closes #27718 Closes #27736 Closes #27764 Closes #27765 Closes #27766 Closes #27767 Closes #27768 Closes #27769 Closes #27771 Closes #27773 Closes #27775 Closes #27776 Closes #27785 Closes #27792 Closes #27795 Closes #27797
2015-08-22Move the Borrow and BorrowMut traits to libcore.Simon Sapin-0/+8
2015-08-15alloc: Add issues for all unstable featuresAlex Crichton-6/+12
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-26/+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-11Register new snapshotsAlex Crichton-3/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-03syntax: Implement #![no_core]Alex Crichton-1/+2
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-30Auto merge of #27371 - Gankro:str-clone, r=alexcrichtonbors-0/+13
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-29implement Clone for Box<str>, closes #27323Alexis Beingessner-0/+13
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-29Rollup merge of #27326 - steveklabnik:doc_show_use, r=GankroSteve Klabnik-4/+8
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/+54
Closes #25097
2015-07-28Auto merge of #27309 - eddyb:snapshot-infdef, r=alexcrichtonbors-1/+1
FreeBSD i386 snapshot is missing, failed tests (possibly spurious). r? @alexcrichton
2015-07-28Implement Clone for Box<[T]> where T: CloneJonathan Reem-1/+54
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-4/+8
2015-07-27Turn on `box(PLACE) expr` deprecation warning post-snapshot.Eduard Burtescu-1/+1
2015-07-23fix doc-tests by opting into `placement_in_syntax` feature where necessary.Felix S. Klock II-1/+1
2015-07-22prototype Placer protocol for unstable overloaded-box and placement-in.Felix S. Klock II-5/+102
2015-07-17Add RawVec to unify raw Vecish codeAlexis Beingessner-1/+1
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-06-26Use Box::into_raw rather than the deprecated boxed::into_raw in tests and ↵Ms2ger-4/+2
documentation.
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-1/+1
2015-06-17std: Move free-functions to associated functionsAlex Crichton-3/+26
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-4/+4
2015-06-17alloc: Split apart the global `alloc` featureAlex Crichton-3/+3
2015-06-17core: Split apart the global `core` featureAlex Crichton-8/+10
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-07change some statics to constantsOliver 'ker' Schneider-1/+1
2015-05-27Remove #[cfg(stage0)] items.Eduard Burtescu-7/+2
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-13Remove SNAP commentsNick Cameron-3/+3
2015-05-13eddyb's changes for DST coercionsNick Cameron-0/+8
+ lots of rebasing
2015-05-05Update with correct output.Jan Andersson-1/+1
2015-04-30Add downcasting to std::error::ErrorAaron Turon-3/+8
This commit brings the `Error` trait in line with the [Error interoperation RFC](https://github.com/rust-lang/rfcs/pull/201) by adding downcasting, which has long been intended. This change means that for any `Error` trait objects that are `'static`, you can downcast to concrete error types. To make this work, it is necessary for `Error` to inherit from `Reflect` (which is currently used to mark concrete types as "permitted for reflection, aka downcasting"). This is a breaking change: it means that impls like ```rust impl<T> Error for MyErrorType<T> { ... } ``` must change to something like ```rust impl<T: Reflect> Error for MyErrorType<T> { ... } ``` except that `Reflect` is currently unstable (and should remain so for the time being). For now, code can instead bound by `Any`: ```rust impl<T: Any> Error for MyErrorType<T> { ... } ``` which *is* stable and has `Reflect` as a super trait. The downside is that this imposes a `'static` constraint, but that only constrains *when* `Error` is implemented -- it does not actually constrain the types that can implement `Error`. [breaking-change]
2015-04-21rollup merge of #24541: alexcrichton/issue-24538Alex Crichton-1/+0
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-20Clean up Box documentation.Steve Klabnik-8/+13
Without the `box` keyword, one of these two reasons is not correct, so let's just eliminate this section and elaborate on the reason for the legit use case inline. Fixes #24511
2015-04-17std: Add Default/IntoIterator/ToOwned to the preludeAlex Crichton-1/+0
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-07alloc: impl fmt::Pointer for Rc, Arc and BoxRicho Healey-0/+10
Closes #24091
2015-04-01rollup merge of #23939: nikomatsakis/fn-boxAlex Crichton-0/+71
Conflicts: src/liballoc/boxed.rs
2015-04-01Collect the definition of the `Error` trait into `libstd` for now. ThisNiko Matsakis-51/+2
sidesteps a coherence difficulty where `liballoc` had to prove that `&str: !Error`, which didn't involve any local types.
2015-04-01Remove `Thunk` struct and `Invoke` trait; change `Thunk` to be an aliasNiko Matsakis-8/+4
for `Box<FnBox()>`. I found the alias was still handy because it is shorter than the fully written type. This is a [breaking-change]: convert code using `Invoke` to use `FnBox`, which is usually pretty straight-forward. Code using thunk mostly works if you change `Thunk::new => Box::new` and `foo.invoke(arg)` to `foo(arg)`.
2015-04-01Add (unstable) FnBox trait as a nicer replacement for `Thunk`. The docNiko Matsakis-0/+75
comment includes a test that also shows how it can be used.
2015-04-01Fallout in libstd: remove impls now considered to conflict.Niko Matsakis-7/+0