summary refs log tree commit diff
path: root/src/liballoc/boxed.rs
AgeCommit message (Collapse)AuthorLines
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
2015-04-01Add `#[fundamental]` annotations into libcore so that `Sized` and theNiko Matsakis-0/+1
`Fn` traits are considered fundamental, along with `Box` (though that is mostly for show; the real type is `~T` in the compiler).
2015-03-31rollup merge of #23919: alexcrichton/stabilize-io-errorAlex Crichton-2/+44
Conflicts: src/libstd/fs/tempdir.rs src/libstd/io/error.rs
2015-03-31std: Stabilize last bits of io::ErrorAlex Crichton-2/+44
This commit stabilizes a few remaining bits of the `io::Error` type: * The `Error::new` method is now stable. The last `detail` parameter was removed and the second `desc` parameter was generalized to `E: Into<Box<Error>>` to allow creating an I/O error from any form of error. Currently there is no form of downcasting, but this will be added in time. * An implementation of `From<&str> for Box<Error>` was added to liballoc to allow construction of errors from raw strings. * The `Error::raw_os_error` method was stabilized as-is. * Trait impls for `Clone`, `Eq`, and `PartialEq` were removed from `Error` as it is not possible to use them with trait objects. This is a breaking change due to the modification of the `new` method as well as the removal of the trait implementations for the `Error` type. [breaking-change]
2015-03-31rollup merge of #23879: seanmonstar/del-from-errorAlex Crichton-3/+3
Conflicts: src/libcore/error.rs
2015-03-30convert: remove FromError, use From<E> insteadSean McArthur-3/+3
This removes the FromError trait, since it can now be expressed using the new convert::Into trait. All implementations of FromError<E> where changed to From<E>, and `try!` was changed to use From::from instead. Because this removes FromError, it is a breaking change, but fixing it simply requires changing the words `FromError` to `From`, and `from_error` to `from`. [breaking-change]
2015-03-30std: Stabilize the rest of Any/BoxAnyAlex Crichton-20/+6
This commit stabilizes the following APIs: * `TypeId::of` - now that it has an `Any` bound it's ready to be stable. * `Box<Any>::downcast` - now that an inherent impl on `Box<Any>` as well as `Box<Any+Send>` is allowed the `BoxAny` trait is removed in favor of these inherent methods. This is a breaking change due to the removal of the `BoxAny` trait, but consumers can simply remove imports to fix crates. [breaking-change]
2015-03-26Implement `Reflect` trait with a variant on the standard OIBITNiko Matsakis-3/+3
semantics that tests the *interface* of trait objects, rather than what they close over.
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+3
2015-03-18Register new snapshotsAlex Crichton-1/+0
2015-03-17Auto merge of #23423 - nikomatsakis:issue-18737-trait-subtyping, r=nrcbors-1/+10
This upcast coercion currently never requires vtable changes. It should be generalized. This is a [breaking-change] -- if you have an impl on an object type like `impl SomeTrait`, then this will no longer be applicable to object types like `SomeTrait+Send`. In the standard library, this primarily affected `Any`, and this PR adds impls for `Any+Send` as to keep the API the same in practice. An alternate workaround is to use UFCS form or standalone fns. For more details, see <https://github.com/rust-lang/rust/issues/18737#issuecomment-78450798>. r? @nrc
2015-03-17Remove subtyping for object types and replace with an *upcast* coercion.Niko Matsakis-1/+10
This upcast coercion currently preserves the vtable for the object, but eventually it can be used to create a derived vtable. The upcast coercion is not introduced into method dispatch; see comment on #18737 for information about why. Fixes #18737.
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-1/+1
2015-03-11Example -> ExamplesSteve Klabnik-1/+1
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown