summary refs log tree commit diff
path: root/src/liballoc/arc.rs
AgeCommit message (Collapse)AuthorLines
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".
2016-08-24Remove drop flags from structs and enums implementing Drop.Eduard Burtescu-17/+2
2016-07-22std: Ignore tests where threads outlive mainAlex Crichton-1/+6
Long ago we discovered that threads which outlive main and then exit while the rest of the program is exiting causes Windows to hang (#20704). That's what was happening in this test so let's just not run this test any more.
2016-07-12Improve arc doc, fixing #32905Zhen Zhang-43/+46
2016-05-28rustfmt liballoc folderSrinivas Reddy Thatiparthy-9/+13
2016-05-24std: Stabilize APIs for the 1.10 releaseAlex Crichton-29/+32
This commit applies the FCP decisions made by the libs team for the 1.10 cycle, including both new stabilizations and deprecations. Specifically, the list of APIs is: Stabilized: * `os::windows::fs::OpenOptionsExt::access_mode` * `os::windows::fs::OpenOptionsExt::share_mode` * `os::windows::fs::OpenOptionsExt::custom_flags` * `os::windows::fs::OpenOptionsExt::attributes` * `os::windows::fs::OpenOptionsExt::security_qos_flags` * `os::unix::fs::OpenOptionsExt::custom_flags` * `sync::Weak::new` * `Default for sync::Weak` * `panic::set_hook` * `panic::take_hook` * `panic::PanicInfo` * `panic::PanicInfo::payload` * `panic::PanicInfo::location` * `panic::Location` * `panic::Location::file` * `panic::Location::line` * `ffi::CStr::from_bytes_with_nul` * `ffi::CStr::from_bytes_with_nul_unchecked` * `ffi::FromBytesWithNulError` * `fs::Metadata::modified` * `fs::Metadata::accessed` * `fs::Metadata::created` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weak` * `collections::{btree,hash}_map::{Occupied,Vacant,}Entry::key` * `os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}` * `SocketAddr::is_unnamed` * `SocketAddr::as_pathname` * `UnixStream::connect` * `UnixStream::pair` * `UnixStream::try_clone` * `UnixStream::local_addr` * `UnixStream::peer_addr` * `UnixStream::set_read_timeout` * `UnixStream::set_write_timeout` * `UnixStream::read_timeout` * `UnixStream::write_Timeout` * `UnixStream::set_nonblocking` * `UnixStream::take_error` * `UnixStream::shutdown` * Read/Write/RawFd impls for `UnixStream` * `UnixListener::bind` * `UnixListener::accept` * `UnixListener::try_clone` * `UnixListener::local_addr` * `UnixListener::set_nonblocking` * `UnixListener::take_error` * `UnixListener::incoming` * RawFd impls for `UnixListener` * `UnixDatagram::bind` * `UnixDatagram::unbound` * `UnixDatagram::pair` * `UnixDatagram::connect` * `UnixDatagram::try_clone` * `UnixDatagram::local_addr` * `UnixDatagram::peer_addr` * `UnixDatagram::recv_from` * `UnixDatagram::recv` * `UnixDatagram::send_to` * `UnixDatagram::send` * `UnixDatagram::set_read_timeout` * `UnixDatagram::set_write_timeout` * `UnixDatagram::read_timeout` * `UnixDatagram::write_timeout` * `UnixDatagram::set_nonblocking` * `UnixDatagram::take_error` * `UnixDatagram::shutdown` * RawFd impls for `UnixDatagram` * `{BTree,Hash}Map::values_mut` * `<[_]>::binary_search_by_key` Deprecated: * `StaticCondvar` - this, and all other static synchronization primitives below, are usable today through the lazy-static crate on stable Rust today. Additionally, we'd like the non-static versions to be directly usable in a static context one day, so they're unlikely to be the final forms of the APIs in any case. * `CONDVAR_INIT` * `StaticMutex` * `MUTEX_INIT` * `StaticRwLock` * `RWLOCK_INIT` * `iter::Peekable::is_empty` Closes #27717 Closes #27720 cc #27784 (but encode methods still exist) Closes #30014 Closes #30425 Closes #30449 Closes #31190 Closes #31399 Closes #31767 Closes #32111 Closes #32281 Closes #32312 Closes #32551 Closes #33018
2016-04-07Rollup merge of #32741 - tbu-:pr_remove_fixme_12808, r=blussManish Goregaokar-24/+20
Remove strange names created by lack of privacy-conscious name lookup The fixed issue that allowed this was #12808.
2016-04-05Fix infinite loop in Arc::downgradeAmanieu d'Antras-0/+1