summary refs log tree commit diff
path: root/src/liballoc/rc.rs
AgeCommit message (Collapse)AuthorLines
2017-10-05Modify Rc/Arc language around mutabilitysteveklabnik-1/+1
There are a few exceptions to the rule that Arc/Rc are immutable. Rather than dig into the details, add "generally" to hint at this difference, as it's kind of a distraction at this point in the docs. Additionally, Arc's docs were slightly different here generally, so add in both the existing language and the exception. Fixes #44105
2017-09-17Rollup merge of #44073 - murarth:rc-into-raw-unsized, r=alexcrichtonTim Neumann-7/+35
Implement `Arc`/`Rc` raw pointer conversions for `?Sized` * Add `T: ?Sized` bound to {`Arc`,`Rc`}::{`from_raw`,`into_raw`}
2017-09-16Implement `Arc`/`Rc` raw pointer conversions for `?Sized`Murarth-7/+35
* Add `T: ?Sized` bound to {`Arc`,`Rc`}::{`from_raw`,`into_raw`}
2017-09-15alloc: Add tracking issue for rc_downcastUlrik Sverdrup-1/+1
2017-09-03alloc: Implement downcast Rc<Any> -> Rc<T>Ulrik Sverdrup-0/+61
Implement downcast the like it exists for Box. The implementation avoids using into_raw/from_raw, because the pointer arithmetic which should cancel does not seem to optimize out at the moment. Since Rc<T> is never Send, only Rc<Any> and not Rc<Any + Send> implements downcast.
2017-08-19Implement `From<&[T]>` and others for `Arc`/`Rc`Murarth-60/+291
Implements RFC 1845, adding implementations of: * `From<&[T]>` for `Rc<[T]>` * `From<&str>` for `Rc<str>` * `From<String>` for `Rc<str>` * `From<Box<T: ?Sized>>` for `Rc<T>` * `From<Vec<T>>` for `Rc<[T]>` * and likewise for `Arc<_>` Also removes now-obsolete internal methods `Rc::__from_array` and `Rc::__from_str`, replacing their use with `Rc::from`.
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-1/+1
Like #43008 (f668999), but _much more aggressive_.
2017-07-22Add Box::into_uniqueSimon Sapin-13/+11
2017-07-22Rename {NonZero,Shared,Unique}::new to new_uncheckedSimon Sapin-5/+5
2017-07-18Fix erroneous reference to Arc instead of RcLynn-1/+1
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-5/+6
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-06-22Fix ref as mutable ref in std::rc::Rc docLetheed-1/+1
2017-06-16Introduce tidy lint to check for inconsistent tracking issuesest31-2/+2
This commit * Refactors the collect_lib_features function to work in a non-checking mode (no bad pointer needed, and list of lang features). * Introduces checking whether unstable/stable tags for a given feature have inconsistent tracking issues. * Fixes such inconsistencies throughout the codebase.
2017-06-05Use single quotes, and doc the Rc struct itself.Ulysse Carion-3/+4
2017-06-03Explicate what "Rc" and "Arc" stand for.Ulysse Carion-1/+2
2017-05-22Update Rc and Arc documentation.Nicolas Silva-15/+33
It was decided in the RFC discussion https://github.com/rust-lang/rfcs/pull/1954 to make the function call syntax Rc::clone(&foo) the idiomatic way to clone a reference counted pointer (over the method call syntax foo.clone(). This change updates the documentation of Rc, Arc and their respoective Weak pointers to reflect it and bring more exposure to the existence of the function call syntax.
2017-05-04fallout from NonZero/Unique/Shared changesAlexis Beingessner-28/+22
2017-04-23Auto merge of #41437 - cuviper:remove-unstable-deprecated, r=alexcrichtonbors-18/+1
Remove items that are unstable and deprecated This removes unstable items that have been deprecated for more than one cycle. - Since 1.16.0, `#![feature(enumset)]` - All of `mod collections::enum_set` - Since 1.15.0, `#![feature(borrow_state)]` - `cell::BorrowState` - `RefCell::borrow_state()` - Since 1.15.0, `#![feature(is_unique)]` - `Rc::is_unique()` (made private like `Arc::is_unique()`) - Since 1.15.0, `#![feature(rc_would_unwrap)]` - `Rc::would_wrap()` - Since 1.13.0, `#![feature(binary_heap_extras)]` - `BinaryHeap::push_pop()` - `BinaryHeap::replace()` - Since 1.12.0, `#![feature(as_unsafe_cell)]` - `Cell::as_unsafe_cell()` - `RefCell::as_unsafe_cell()` - Since 1.12.0, `#![feature(map_entry_recover_keys)]` - `btree_map::OccupiedEntry::remove_pair()` - `hash_map::OccupiedEntry::remove_pair()` - Since 1.11.0, `#![feature(float_extras)]` - `Float::nan()` - `Float::infinity()` - `Float::neg_infinity()` - `Float::neg_zero()` - `Float::zero()` - `Float::one()` - `Float::integer_decode()` - `f32::integer_decode()` - `f32::ldexp()` - `f32::frexp()` - `f32::next_after()` - `f64::integer_decode()` - `f64::ldexp()` - `f64::frexp()` - `f64::next_after()` - Since 1.11.0, `#![feature(zero_one)]` - `num::Zero` - `num::One`
2017-04-22cache attributes of items from foreign cratesAriel Ben-Yehuda-2/+33
this avoids parsing item attributes on each call to `item_attrs`, which takes off 33% (!) of translation time and 50% (!) of trans-item collection time.
2017-04-20Privatize Rc::is_uniqueJosh Stone-5/+1
[unstable, deprecated since 1.15.0]
2017-04-20Remove Rc::would_wrapJosh Stone-13/+0
[unstable, deprecated since 1.15.0]
2017-04-12Updating docs for std::rc::Rcprojektir-33/+33
2017-03-20Fix up various linkssteveklabnik-1/+1
The unstable book, libstd, libcore, and liballoc all needed some adjustment.
2017-03-17Stabilize rc_raw feature, closes #37197Aaron Turon-13/+9
2017-03-17Stabilize ptr_eq feature, closes #36497Aaron Turon-5/+1
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-2/+2
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-02-20Revert "Fix up links"Steve Klabnik-1/+1
This reverts commit 7f1d1c6d9a7be5e427bace30e740b16b25f25c92. The original commit was created because mdBook and rustdoc had different generation algorithms for header links; now with https://github.com/rust-lang/rust/pull/39966 , the algorithms are the same. So let's undo this change. ... when I came across this problem, I said "eh, this isn't fun, but it doesn't take that long." I probably should have just actually taken the time to fix upstream, given that they were amenable. Oh well!
2017-02-13Fix up linksSteve Klabnik-1/+1
mdbook and rustdoc generate links differently, so we need to change all these links.
2017-01-31In std:rc, clarify the lack of mutability inside an RcFederico Mena Quintero-3/+6
Also, point to the example in Cell's docs for how to do it.
2016-12-28Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]`Andrew Paseltiner-2/+1
CC #34761
2016-12-16Address falloutAaron Turon-31/+2
2016-12-15Stabilize:Aaron Turon-8/+5
- `std::rc::Rc::{strong_count, weak_count}` - `std::sync::Arc::{strong_count, weak_count}` Deprecate: - `std::rc::Rc::{would_unwrap, is_unique}`
2016-12-05Add missing links to Rc docGuillaume Gomez-43/+45
2016-11-08Auto merge of #37192 - cristicbz:rust-rc-into-raw, r=brsonbors-0/+79
Add `{into,from}_raw` to Rc and Arc These methods convert to and from a `*const T` for `Rc` and `Arc` similar to the way they work on `Box`. The only slight complication is that `from_raw` needs to offset the pointer back to find the beginning of the `RcBox`/`ArcInner`. I felt this is a fairly small addition, filling in a gap (when compared to `Box`) so it wouldn't need an RFC. The motivation is primarily for FFI. (I'll create an issue and update a PR with the issue number if reviewers agree with the change in principle **Edit: done #37197**) ~~Edit: This was initially `{into,from}_raw` but concerns were raised about the possible footgun if mixed with the methods of the same name of `Box`.~~ Edit: This was went from `{into,from}_raw` to `{into,from}_inner_raw` then back to `{into,from}_raw` during review.
2016-11-05Add `{into,from}_raw` to Rc and ArcCristi Cobzarenco-0/+79
2016-10-13Add assert checking that allocation and deallocation sizes are equalVadim Petrochenkov-3/+4
2016-10-13Add an unstable constructor for creating `Rc<str>` from `str`Vadim Petrochenkov-1/+26
2016-10-04Apply some Arc doc changes to RcKeegan McAllister-11/+21
2016-09-28Remove stage0 hacksBrian Anderson-2/+0
2016-09-21Tweak std::rc docsKeegan McAllister-160/+310
Fixes #29372.
2016-09-15Add `pub fn ptr_eq(this: &Self, other: &Self) -> bool` to `Rc` and `Arc`.Simon Sapin-0/+37
Servo and Kuchiki have had helper functions doing this for some time.
2016-09-11Documentation of what does for each typeathulappadan-0/+1
2016-08-27Doc: explain why Box/Rc/Arc methods do not take selfGeorg Brandl-0/+6
This can be confusing for newcomers, especially due to the argument name "this".
2016-08-24Remove drop flags from structs and enums implementing Drop.Eduard Burtescu-22/+16
2016-08-21add example for `Rc::would_unwrap`Matthew Piziak-0/+17
Part of #29372 r? @steveklabnik
2016-07-08Rollup merge of #34097 - arbitrary-cat:master, r=steveklabnikManish Goregaokar-1/+2
Revise wording in Rc documentation. The term "thread-local" has a widely accepted meaning which is not the meaning it's used for here.
2016-07-07Changed wording per aturon's comments.Sam Payson-1/+2
2016-06-05Update rc.rsFrank McSherry-1/+1
The original description suggests that the original `Rc<T>` itself is downgraded, which doesn't seem to be what the code does. At the same time, `Rc` is one of those types that can do weird things with only a shared reference, so I thought it would be good to be clear.
2016-06-05Revise wording in Rc documentation.Sam Payson-1/+1
The term "thread-local" has a widely-accepted meaning which is not the meaning it's used for here.
2016-05-28rustfmt liballoc folderSrinivas Reddy Thatiparthy-4/+4