about summary refs log tree commit diff
path: root/src/liballoc/arc.rs
AgeCommit message (Collapse)AuthorLines
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
2016-04-05Remove strange names created by lack of privacy-conscious name lookupTobias Bucher-24/+20
The fixed issue that allowed this was #12808.
2016-03-31Change Arc to use compare_exchange instead of compare_and_swapAmanieu d'Antras-17/+20
2016-03-10first round of removal of integer suffixessrinivasreddy-4/+4
2016-03-09Clarify that try_unwrap needs exactly oneSteve Klabnik-2/+3
Fixes #31950
2016-02-11Auto merge of #31479 - kamalmarhubi:fmt-pointer-unsized, r=alexcrichtonbors-1/+1
This allows printing pointers to unsized types with the {:p} formatting directive. The following impls are extended to unsized types: - impl<'a, T: ?Sized> Pointer for &'a T - impl<'a, T: ?Sized> Pointer for &'a mut T - impl<T: ?Sized> Pointer for *const T - impl<T: ?Sized> Pointer for *mut T - impl<T: ?Sized> fmt::Pointer for Box<T> - impl<T: ?Sized> fmt::Pointer for Rc<T> - impl<T: ?Sized> fmt::Pointer for Arc<T>
2016-02-08Implement fmt::Pointer for pointers to unsized typesKamal Marhubi-1/+1
This allows printing pointers to unsized types with the {:p} formatting directive. The following impls are extended to unsized types: - impl<'a, T: ?Sized> Pointer for &'a T - impl<'a, T: ?Sized> Pointer for &'a mut T - impl<T: ?Sized> Pointer for *const T - impl<T: ?Sized> Pointer for *mut T - impl<T: ?Sized> fmt::Pointer for Box<T> - impl<T: ?Sized> fmt::Pointer for Rc<T> - impl<T: ?Sized> fmt::Pointer for Arc<T>
2016-02-04Fix unclear make_mut docsRichard Bradfield-3/+3
Changed the description of the `make_mut` copy-on-write behaviour in arc.rs The sentence "doesn't have one strong reference and no weak references." is a hard to understand double negative, which can be much more easily explained.
2016-01-20Fix incorrect stability annotations for arc::WeakSebastian Hahn-4/+4
This was accidentally introduced in 7e2ffc7090a70fe8c77a0e03fcec3cb1387141f2, b44ee371b8beea77aa1364460acbba14a8516559 and 36ba96ea3cfef575ddc5eea7754a1b70b50e2080.
2015-12-31Auto merge of #30593 - steveklabnik:small_rc_refactoring, r=Gankrobors-4/+5
This hairy conditional doesn't need to be so. It _does_ need to be a thin pointer, otherwise, it will fail to compile, so let's pull that out into a temporary for future readers of the source. /cc @nrc @SimonSapin @Gankro @durka , who brought this up on IRC
2015-12-30Auto merge of #30467 - shahn:master, r=brsonbors-0/+36
This adds a constructor for a Weak that can never be upgraded. These are mostly useless, but for example are required when deserializing.
2015-12-30Small refactoring to make this code more clearSteve Klabnik-4/+5
This hairy conditional doesn't need to be so. It _does_ need to be a thin pointer, otherwise, it will fail to compile, so let's pull that out into a temporary for future readers of the source. Also, after a discussion with @pnkfelix and @gankro, we don't need these null checks anymore, as zero-on-drop has been gone for a while now.
2015-12-21Register new snapshotsAlex Crichton-6/+0
Lots of cruft to remove!
2015-12-19Have to use Weak instead of Arc in Weak::new() exampleSebastian Hahn-1/+1
2015-12-19Address review commentsSebastian Hahn-4/+3
2015-12-19Implement arc::Weak::new()Sebastian Hahn-0/+37
2015-12-10Auto merge of #30182 - alexcrichton:remove-deprecated, r=aturonbors-7/+0
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-12-10std: Remove deprecated functionality from 1.5Alex Crichton-7/+0
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-12-09fixed a typo in commentsTianyi Wang-1/+1
srong -> strong in liballoc/arc.rs
2015-11-25Auto merge of #30017 - nrc:fmt, r=brsonbors-18/+19
2015-11-24Add overflow check to `arc::Weak::upgrade`Andrew Paseltiner-0/+5
Closes #30031.
2015-11-24rustfmt: liballoc, liballoc_*, libarenaNick Cameron-18/+19
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-1/+1
2015-11-18Add missing annotations and some testsVadim Petrochenkov-0/+7
2015-11-16Auto merge of #29580 - alexbool:smart-pointer-conversion, r=alexcrichtonbors-0/+16
Sometimes when writing generic code you want to abstract over owning/pointer type so that calling code isn't restricted by one concrete owning/pointer type. This commit makes possible such code: ```rust fn i_will_work_with_arc<T: Into<Arc<MyTy>>>(t: T) { let the_arc = t.into(); // Do something } i_will_work_with_arc(MyTy::new()); i_will_work_with_arc(Box::new(MyTy::new())); let arc_that_i_already_have = Arc::new(MyTy::new()); i_will_work_with_arc(arc_that_i_already_have); ``` Please note that this patch doesn't work with DSTs. Also to mention, I made those impls stable, and I don't know whether they should be actually stable from the beginning. Please tell me if this should be feature-gated.
2015-11-16Fix feature nameAlexander Bulaev-1/+1
2015-11-12Remove impls for cases considered `niche`Alexander Bulaev-15/+0
2015-11-11Fix import warnings for stage0Steve Klabnik-1/+4