about summary refs log tree commit diff
path: root/src/liballoc/rc.rs
AgeCommit message (Collapse)AuthorLines
2016-05-28rustfmt liballoc folderSrinivas Reddy Thatiparthy-4/+4
2016-05-24std: Stabilize APIs for the 1.10 releaseAlex Crichton-28/+31
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-05Remove strange names created by lack of privacy-conscious name lookupTobias Bucher-23/+19
The fixed issue that allowed this was #12808.
2016-03-10first round of removal of integer suffixessrinivasreddy-2/+2
2016-03-09Clarify that try_unwrap needs exactly oneSteve Klabnik-2/+3
Fixes #31950
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-01-20Fix incorrect stability annotations for WeakSebastian Hahn-4/+4
This was accidentally introduced in 7e2ffc7090a70fe8c77a0e03fcec3cb1387141f2.
2015-12-31Auto merge of #30593 - steveklabnik:small_rc_refactoring, r=Gankrobors-4/+6
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-1/+38
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/+6
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-19Address review commentsSebastian Hahn-2/+1
2015-12-19Rename Weak::new_downgraded to Weak::newSebastian Hahn-4/+4
2015-12-19use core::mem::unintialized instead of uninit intrinsicSebastian Hahn-3/+3
2015-12-19Fix doctest failureSebastian Hahn-1/+3
2015-12-18Implement Weak::new_downgraded() (#30425)Sebastian Hahn-1/+37
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-10std: Remove deprecated functionality from 1.5Alex Crichton-8/+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-11-25Auto merge of #30017 - nrc:fmt, r=brsonbors-10/+10
2015-11-24rustfmt: liballoc, liballoc_*, libarenaNick Cameron-10/+10
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-14/+0
2015-11-11Fix import warnings for stage0Steve Klabnik-2/+6
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-1/+0
Remove `stable` stability annotations from inherent impls
2015-11-04liballoc: implement From for Box, Rc, ArcAlexander Bulaev-0/+30
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: ``` 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.
2015-11-02remove #![feature(rc_unique)] from Rc docsAlex Burka-3/+0
`Rc::try_unwrap` and `Rc::make_mut` are stable since 1.4.0, but the example code still has `#![feature(rc_unique)]`. Ideally the stable and beta docs would be updated, but I don't think that's possible...
2015-10-30don't use drop_in_place as an intrinsicAlexis Beingessner-2/+2
2015-10-16Add `Shared` pointer and have `{Arc, Rc}` use itAndrew Paseltiner-5/+6
This change has two consequences: 1. It makes `Arc<T>` and `Rc<T>` covariant in `T`. 2. It causes the compiler to reject code that was unsound with respect to dropck. See compile-fail/issue-29106.rs for an example of code that no longer compiles. Because of this, this is a [breaking-change]. Fixes #29037. Fixes #29106.
2015-10-11Run rustfmt on liballoc.Ahmed Charles-7/+5
2015-10-10Auto merge of #28861 - pnkfelix:fsk-nonparam-dropck-issue28498, r=arielb1bors-0/+1
implement RFC 1238: nonparametric dropck. cc #28498 cc @nikomatsakis
2015-10-09Added the param-blindness attribute to `Rc` and `Arc`.Felix S. Klock II-0/+1
This was proven necessary after I added `Rc` and `Arc` to the rpass test `dropck_legal_cycles.rs`; see PR #28929.
2015-10-02std: Add AsRef/AsMut impls to Box/Rc/ArcAlex Crichton-0/+5
These common traits were left off originally by accident from these smart pointers, and a past attempt (#26008) to add them was later reverted (#26160) due to unexpected breakge (#26096) occurring. The specific breakage in worry is the meaning of this return value changed: let a: Box<Option<T>> = ...; a.as_ref() Currently this returns `Option<&T>` but after this change it will return `&Option<T>` because the `AsRef::as_ref` method shares the same name as `Option::as_ref`. A [crater report][crater] of this change, however, has shown that the fallout of this change is quite minimal. These trait implementations are "the right impls to add" to these smart pointers and would enable various generalizations such as those in #27197. [crater]: https://gist.github.com/anonymous/0ba4c3512b07641c0f99 This commit is a breaking change for the above reasons mentioned, and the mitigation strategies look like any of: Option::as_ref(&a) a.as_ref().as_ref() (*a).as_ref()
2015-09-24Better function callsNick Cameron-2/+6
2015-09-24rustfmt liballocNick Cameron-23/+48
2015-09-11std: Stabilize/deprecate features for 1.4Alex Crichton-26/+18
The FCP is coming to a close and 1.4 is coming out soon, so this brings in the libs team decision for all library features this cycle. Stabilized APIs: * `<Box<str>>::into_string` * `Arc::downgrade` * `Arc::get_mut` * `Arc::make_mut` * `Arc::try_unwrap` * `Box::from_raw` * `Box::into_raw` * `CStr::to_str` * `CStr::to_string_lossy` * `CString::from_raw` * `CString::into_raw` * `IntoRawFd::into_raw_fd` * `IntoRawFd` * `IntoRawHandle::into_raw_handle` * `IntoRawHandle` * `IntoRawSocket::into_raw_socket` * `IntoRawSocket` * `Rc::downgrade` * `Rc::get_mut` * `Rc::make_mut` * `Rc::try_unwrap` * `Result::expect` * `String::into_boxed_slice` * `TcpSocket::read_timeout` * `TcpSocket::set_read_timeout` * `TcpSocket::set_write_timeout` * `TcpSocket::write_timeout` * `UdpSocket::read_timeout` * `UdpSocket::set_read_timeout` * `UdpSocket::set_write_timeout` * `UdpSocket::write_timeout` * `Vec::append` * `Vec::split_off` * `VecDeque::append` * `VecDeque::retain` * `VecDeque::split_off` * `rc::Weak::upgrade` * `rc::Weak` * `slice::Iter::as_slice` * `slice::IterMut::into_slice` * `str::CharIndices::as_str` * `str::Chars::as_str` * `str::split_at_mut` * `str::split_at` * `sync::Weak::upgrade` * `sync::Weak` * `thread::park_timeout` * `thread::sleep` Deprecated APIs * `BTreeMap::with_b` * `BTreeSet::with_b` * `Option::as_mut_slice` * `Option::as_slice` * `Result::as_mut_slice` * `Result::as_slice` * `f32::from_str_radix` * `f64::from_str_radix` Closes #27277 Closes #27718 Closes #27736 Closes #27764 Closes #27765 Closes #27766 Closes #27767 Closes #27768 Closes #27769 Closes #27771 Closes #27773 Closes #27775 Closes #27776 Closes #27785 Closes #27792 Closes #27795 Closes #27797
2015-09-03doc: reduce indentation of examples to 4 spacesTshepang Lekhonkhobe-7/+7
Also, add trailing commas
2015-08-22Move the Borrow and BorrowMut traits to libcore.Simon Sapin-0/+5
2015-08-19don't do deprecations yetAlexis Beingessner-3/+0
2015-08-19Rework Rc for FCP of #27718Alexis Beingessner-82/+117
* Add `Rc::would_unwrap(&Self) -> bool` to introspect whether try_unwrap would succeed, because it's destructive (unlike get_mut). * Move `rc.downgrade()` to `Rc::downgrade(&Self)` per conventions. * Deprecate `Rc::weak_count` and `Rc::strong_count` for questionable utility. * Deprecate `Rc::is_unique` for questionable semantics (there are two kinds of uniqueness with Weak pointers in play). * Rename `rc.make_unique()` to `Rc::make_mut(&mut Self)` per conventions, to avoid uniqueness terminology, and to clarify the relation to `Rc::get_mut`.
2015-08-15alloc: Add issues for all unstable featuresAlex Crichton-10/+14
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-106/+28
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-08-11Register new snapshotsAlex Crichton-3/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-03syntax: Implement #![no_core]Alex Crichton-1/+2
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-30Auto merge of #27174 - Gankro:rc-sat, r=alexcrichtonbors-3/+16
See https://internals.rust-lang.org/t/rc-is-unsafe-mostly-on-32-bit-targets-due-to-overflow/2120 for detailed discussion of this problem.
2015-07-29make Rc mem::forget safeAlexis Beingessner-3/+16
2015-07-27Show appropriate feature flags in docsSteve Klabnik-12/+24
2015-07-01Implement CoerceUnsized for rc::WeakRemi Rampin-0/+2
Fixes #26704
2015-06-24Make `align_of` behave like `min_align_of`.Huon Wilson-4/+4
This removes a footgun, since it is a reasonable assumption to make that pointers to `T` will be aligned to `align_of::<T>()`. This also matches the behaviour of C/C++. `min_align_of` is now deprecated. Closes #21611.