summary refs log tree commit diff
path: root/src/liballoc/arc.rs
AgeCommit message (Collapse)AuthorLines
2018-01-20Rename Box::into_non_null_raw to Box::into_raw_non_nullSimon Sapin-2/+2
2018-01-20Rename Box::*_nonnull_raw to *_non_null_rawSimon Sapin-2/+2
2018-01-20Replace Box::{from,into}_unique with {from,into}_nonnull_rawSimon Sapin-3/+3
Thew `_raw` prefix is included because the fact that `Box`’s ownership semantics are "dissolved" or recreated seem more important than the exact parameter type or return type.
2018-01-20Rename std::ptr::Shared to NonNullSimon Sapin-9/+9
`Shared` is now a deprecated `type` alias. CC https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629
2017-12-25Remove transmute in From<&str> impls for Arc/RcNikolai Vazquez-1/+2
2017-12-16Move PhantomData<T> from Shared<T> to users of both Shared and #[may_dangle]Simon Sapin-7/+9
After discussing [1] today with @pnkfelix and @Gankro, we concluded that it’s ok for drop checking not to be much smarter than the current `#[may_dangle]` design which requires an explicit unsafe opt-in. [1] https://github.com/rust-lang/rust/issues/27730#issuecomment-316432083
2017-11-20Print the address of the pointed value in Pointer impl for Rc and ArcMarco A L Barbosa-1/+1
2017-10-05Modify Rc/Arc language around mutabilitysteveklabnik-2/+4
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-22Add missing links for ArcGuillaume Gomez-5/+8
2017-09-16Implement `Arc`/`Rc` raw pointer conversions for `?Sized`Murarth-7/+36
* Add `T: ?Sized` bound to {`Arc`,`Rc`}::{`from_raw`,`into_raw`}
2017-08-19Implement `From<&[T]>` and others for `Arc`/`Rc`Murarth-5/+295
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-08-10Fix broken links in Arc documentationJustin Browne-1/+1
2017-07-22Add Box::into_uniqueSimon Sapin-2/+2
2017-07-22Rename {NonZero,Shared,Unique}::new to new_uncheckedSimon Sapin-3/+3
2017-07-20Add test test_weak_count_lockedJacques-Henri Jourdan-0/+19
2017-07-18Fix in weak_count in Arc.Jacques-Henri Jourdan-1/+4
In the case the weak count was locked, the weak_count function could return usize::MAX. We need to test this condition manually.
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-4/+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-13Merge crate `collections` into `alloc`Murarth-2/+3
2017-06-05Use single quotes, and doc the Rc struct itself.Ulysse Carion-2/+2
2017-06-03Explicate what "Rc" and "Arc" stand for.Ulysse Carion-1/+2
2017-05-22Update Rc and Arc documentation.Nicolas Silva-13/+31
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-09Improve docs on Arc<T> and Send/Syncsteveklabnik-10/+29
This is something I always forget, so let's actually explain in the docs.
2017-05-05Rollup merge of #41064 - Gankro:ptr-redux, r=alexcrichtonCorey Farwell-18/+13
refactor NonZero, Shared, and Unique APIs Major difference is that I removed Deref impls, as apparently LLVM has trouble maintaining metadata with a `&ptr -> &ptr` API. This was cited as a blocker for ever stabilizing this API. It wasn't that ergonomic anyway. * Added `get` to NonZero to replace Deref impl * Added `ptr` getter to Shared/Unique to replace Deref impl * Added Unique's `get` and `get_mut` conveniences to Shared * Deprecated `as_mut_ptr` on Shared in favour of `ptr` Note that Shared used to primarily expose only `*const` but there isn't a good justification for that, so I made it `*mut`.
2017-05-04fallout from NonZero/Unique/Shared changesAlexis Beingessner-18/+13
2017-05-03Document the reasoning for the Acquire/Release handshake when dropping Arcs.Bobby Holley-0/+11
2017-04-12Updating docs for std::sync::Weak #29377projektir-33/+33
2017-03-20Fix up various linkssteveklabnik-1/+1
The unstable book, libstd, libcore, and liballoc all needed some adjustment.
2017-03-17Minor fixups to fix tidy errorsAlex Crichton-1/+4
2017-03-17Stabilize rc_raw feature, closes #37197Aaron Turon-13/+9
2017-03-17Stabilize ptr_eq feature, closes #36497Aaron Turon-5/+1
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-27Fix a few links in the docsOliver Middleton-1/+1
2017-01-10Rollup merge of #38664 - apasel422:may-dangle, r=pnkfelixSeo Sanghyeon-2/+1
Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]` CC #34761 r? @pnkfelix
2016-12-28Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]`Andrew Paseltiner-2/+1
CC #34761
2016-12-24Add missing urls in Arc docsGuillaume Gomez-15/+17
2016-12-15Stabilize:Aaron Turon-8/+2
- `std::rc::Rc::{strong_count, weak_count}` - `std::sync::Arc::{strong_count, weak_count}` Deprecate: - `std::rc::Rc::{would_unwrap, is_unique}`
2016-11-09Auto merge of #37657 - steveklabnik:rollup, r=steveklabnikbors-5/+11
Rollup of 8 pull requests - Successful merges: #35102, #37425, #37483, #37588, #37601, #37610, #37650, #37652 - Failed merges:
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-08More proeminent warning in Arc::{strong,weak}_count docs.Simon Sapin-5/+11
2016-11-06Add a comment to `Arc::MAX_REFCOUNT`Daan Sprenkels-0/+4
The constant name `MAX_REFCOUNT` suggests that the value is a _hard_ limit on the amount of references to an `Arc`. This is a more soft limit however. This commit adds a comment to the constant to annotate this. See also: PR #37605
2016-11-05Add `{into,from}_raw` to Rc and ArcCristi Cobzarenco-0/+79
2016-10-04Update Arc docs to match new Rc docsKeegan McAllister-145/+281
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+1
2016-09-28Remove stage0 hacksBrian Anderson-2/+0
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 for default types modifiedathulappadan-1/+1
2016-09-11Documentation of what does for each typeathulappadan-0/+2
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".