about summary refs log tree commit diff
path: root/src/liballoc/rc.rs
AgeCommit message (Collapse)AuthorLines
2018-09-08Auto merge of #51885 - GuillaumeGomez:trait-impl-show-docs, ↵bors-7/+3
r=Mark-Simulacrum,QuietMisdreavus Trait impl show docs Fixes #51834. <img width="1440" alt="screen shot 2018-06-29 at 00 14 33" src="https://user-images.githubusercontent.com/3050060/42063323-6e6e8cc8-7b31-11e8-88ef-4dd2229df76c.png"> (You can see both commit changes in the screenshot 😄) r? @QuietMisdreavus
2018-09-06Fix invalid urlsGuillaume Gomez-7/+3
2018-09-01Update to a new pinning API.Without Boats-0/+6
2018-09-01Fix Rc impl.Without Boats-1/+1
2018-09-01Implement Unpin for Box, Rc, and ArcWithout Boats-1/+4
2018-08-21Auto merge of #53530 - kennytm:rollup, r=kennytmbors-1/+1
Rollup of 17 pull requests Successful merges: - #53030 (Updated RELEASES.md for 1.29.0) - #53104 (expand the documentation on the `Unpin` trait) - #53213 (Stabilize IP associated constants) - #53296 (When closure with no arguments was expected, suggest wrapping) - #53329 (Replace usages of ptr::offset with ptr::{add,sub}.) - #53363 (add individual docs to `core::num::NonZero*`) - #53370 (Stabilize macro_vis_matcher) - #53393 (Mark libserialize functions as inline) - #53405 (restore the page title after escaping out of a search) - #53452 (Change target triple used to check for lldb in build-manifest) - #53462 (Document Box::into_raw returns non-null ptr) - #53465 (Remove LinkMeta struct) - #53492 (update lld submodule to include RISCV patch) - #53496 (Fix typos found by codespell.) - #53521 (syntax: Optimize some literal parsing) - #53540 (Moved issue-53157.rs into src/test/ui/consts/const-eval/) - #53551 (Avoid some Place clones.) Failed merges: r? @ghost
2018-08-20Replace usages of ptr::offset with ptr::{add,sub}.Corey Farwell-1/+1
2018-08-05Fixed typoDmytro Shynkevych-2/+2
2018-08-04Changed `Rc::inc_{weak,strong}` to better hint optimization to LLVMDmytro Shynkevych-2/+16
2018-07-23typosRalf Jung-2/+2
2018-07-23Don't use NonNull::dangling as sentinel valueRalf Jung-5/+8
Instead, rely on alignment and use usize::MAX as sentinel.
2018-07-11Revert borked changes in last commit.ljedrz-2/+2
2018-07-10Add missing dyn in liballocljedrz-9/+9
2018-07-10Deny bare trait objects in in src/liballocljedrz-2/+2
2018-07-06Rollup merge of #52103 - tmccombs:rc_downcast, r=Mark-SimulacrumMark Rousskov-2/+1
Stabilize rc_downcast Fixes #44608
2018-07-07Fix is_dangling import when Arc is #[cfg]’ed outSimon Sapin-1/+6
2018-07-07Rc: remove unused allocation from Weak::new()Simon Sapin-23/+36
Same as https://github.com/rust-lang/rust/pull/50357
2018-07-06Stabilize rc_downcastThayne McCombs-2/+1
Fixes #44608
2018-06-18Rename OOM to allocation errorSimon Sapin-2/+2
The acronym is not descriptive unless one has seen it before. * Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle. * Rename `set_oom_hook` to `set_alloc_error_hook` * Rename `take_oom_hook` to `take_alloc_error_hook` Bikeshed: `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-11Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAllocMike Hommey-5/+5
2018-05-31Update `Arc` and `Rc` to use `NonNull::cast` to cast the inner pointersJeremy Fitzhardinge-9/+3
This avoids an `unsafe` block in each case.
2018-05-30Pass a `Layout` to `oom`Mike Hommey-1/+1
As discussed in https://github.com/rust-lang/rust/issues/49668#issuecomment-384893456 and subsequent, there are use-cases where the OOM handler needs to know the size of the allocation that failed. The alignment might also be a cause for allocation failure, so providing it as well can be useful.
2018-04-27Auto merge of #50097 - glandium:box_free, r=nikomatsakisbors-2/+3
Partial future-proofing for Box<T, A> In some ways, this is similar to @eddyb's PR #47043 that went stale, but doesn't cover everything. Notably, this still leaves Box internalized as a pointer in places, so practically speaking, only ZSTs can be practically added to the Box type with the changes here (the compiler ICEs otherwise). The Box type is not changed here, that's left for the future because I want to test that further first, but this puts things in place in a way that hopefully will make things easier.
2018-04-25Switch box_free to take the destructured contents of BoxMike Hommey-2/+3
As of now, Box only contains a Unique pointer, so this is the sole argument to box_free. Consequently, we remove the code supporting the previous box_free signature. We however keep the old definition for bootstrapping purpose.
2018-04-22Replace GlobalAlloc::oom with a lang itemSteven Fackler-2/+2
2018-04-12Rename alloc::Void to alloc::OpaqueSimon Sapin-5/+5
2018-04-12Use NonNull<Void> instead of *mut u8 in the Alloc traitMike Hommey-11/+7
Fixes #49608
2018-04-12Remove the now-unit-struct AllocErr parameter of oom()Simon Sapin-1/+1
2018-04-12Actually deprecate the Heap typeSimon Sapin-7/+6
2018-04-02Use Alloc and Layout from core::heap.Mike Hommey-1/+2
94d1970bba87f2d2893f6e934e4c3f02ed50604d moved the alloc::allocator module to core::heap, moving e.g. Alloc and Layout out of the alloc crate. While alloc::heap reexports them, it's better to use them from where they really come from.
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-4/+4
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-10/+10
`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-6/+10
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-21fix some typosMartin Lindhe-1/+1
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-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