From 1acbb0a9350560d951359cc359361b87992a6f2b Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 15 Jun 2018 03:36:34 +0200 Subject: [PATCH 1/7] Make raw_vec perma-unstable and hidden --- src/liballoc/raw_vec.rs | 7 +++++-- src/libarena/lib.rs | 1 + src/test/rustdoc-js/struct-vec.js | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 2369ce648fda5..5095bbe96cc67 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![unstable(feature = "raw_vec_internals", reason = "implemention detail", issue = "0")] +#![doc(hidden)] + use core::cmp; use core::mem; use core::ops::Drop; @@ -264,7 +267,7 @@ impl RawVec { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(alloc, raw_vec_internals)] /// # extern crate alloc; /// # use std::ptr; /// # use alloc::raw_vec::RawVec; @@ -468,7 +471,7 @@ impl RawVec { /// # Examples /// /// ``` - /// # #![feature(alloc)] + /// # #![feature(alloc, raw_vec_internals)] /// # extern crate alloc; /// # use std::ptr; /// # use alloc::raw_vec::RawVec; diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index b6a81596d06cc..0f4a5d16e1759 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -26,6 +26,7 @@ #![feature(alloc)] #![feature(core_intrinsics)] #![feature(dropck_eyepatch)] +#![feature(raw_vec_internals)] #![cfg_attr(test, feature(test))] #![allow(deprecated)] diff --git a/src/test/rustdoc-js/struct-vec.js b/src/test/rustdoc-js/struct-vec.js index a91bc2d0da288..3874e23a2a3c9 100644 --- a/src/test/rustdoc-js/struct-vec.js +++ b/src/test/rustdoc-js/struct-vec.js @@ -14,6 +14,5 @@ const EXPECTED = { 'others': [ { 'path': 'std::vec', 'name': 'Vec' }, { 'path': 'std::collections', 'name': 'VecDeque' }, - { 'path': 'alloc::raw_vec', 'name': 'RawVec' }, ], }; From 26324d0abe1a8df228f8c758b870a38078549ddc Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 15 Jun 2018 03:39:17 +0200 Subject: [PATCH 2/7] Remove the unstable alloc::allocator module reexport, deprecated since 1.27 --- src/liballoc/lib.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index ec9b5eba56106..585e34f58514c 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -141,13 +141,6 @@ extern crate rand; #[macro_use] mod macros; -#[rustc_deprecated(since = "1.27.0", reason = "use the heap module in core, alloc, or std instead")] -#[unstable(feature = "allocator_api", issue = "32838")] -/// Use the `alloc` module instead. -pub mod allocator { - pub use alloc::*; -} - // Heaps provided for low-level allocation strategies pub mod alloc; From 121b57b87ae4b58082f38a450373636286a8d678 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 15 Jun 2018 03:52:25 +0200 Subject: [PATCH 3/7] Move some alloc crate top-level items to a new alloc::collections module This matches std::collections --- src/liballoc/{ => collections}/binary_heap.rs | 0 src/liballoc/{ => collections}/btree/map.rs | 0 src/liballoc/{ => collections}/btree/mod.rs | 0 src/liballoc/{ => collections}/btree/node.rs | 0 .../{ => collections}/btree/search.rs | 0 src/liballoc/{ => collections}/btree/set.rs | 6 +- src/liballoc/{ => collections}/linked_list.rs | 0 src/liballoc/collections/mod.rs | 59 +++++++++++++++++++ src/liballoc/{ => collections}/vec_deque.rs | 4 +- src/liballoc/lib.rs | 37 +----------- src/liballoc/str.rs | 1 - src/libstd/collections/mod.rs | 8 +-- 12 files changed, 69 insertions(+), 46 deletions(-) rename src/liballoc/{ => collections}/binary_heap.rs (100%) rename src/liballoc/{ => collections}/btree/map.rs (100%) rename src/liballoc/{ => collections}/btree/mod.rs (100%) rename src/liballoc/{ => collections}/btree/node.rs (100%) rename src/liballoc/{ => collections}/btree/search.rs (100%) rename src/liballoc/{ => collections}/btree/set.rs (99%) rename src/liballoc/{ => collections}/linked_list.rs (100%) create mode 100644 src/liballoc/collections/mod.rs rename src/liballoc/{ => collections}/vec_deque.rs (99%) diff --git a/src/liballoc/binary_heap.rs b/src/liballoc/collections/binary_heap.rs similarity index 100% rename from src/liballoc/binary_heap.rs rename to src/liballoc/collections/binary_heap.rs diff --git a/src/liballoc/btree/map.rs b/src/liballoc/collections/btree/map.rs similarity index 100% rename from src/liballoc/btree/map.rs rename to src/liballoc/collections/btree/map.rs diff --git a/src/liballoc/btree/mod.rs b/src/liballoc/collections/btree/mod.rs similarity index 100% rename from src/liballoc/btree/mod.rs rename to src/liballoc/collections/btree/mod.rs diff --git a/src/liballoc/btree/node.rs b/src/liballoc/collections/btree/node.rs similarity index 100% rename from src/liballoc/btree/node.rs rename to src/liballoc/collections/btree/node.rs diff --git a/src/liballoc/btree/search.rs b/src/liballoc/collections/btree/search.rs similarity index 100% rename from src/liballoc/btree/search.rs rename to src/liballoc/collections/btree/search.rs diff --git a/src/liballoc/btree/set.rs b/src/liballoc/collections/btree/set.rs similarity index 99% rename from src/liballoc/btree/set.rs rename to src/liballoc/collections/btree/set.rs index 2aad476d3153a..af9a7074e4a4f 100644 --- a/src/liballoc/btree/set.rs +++ b/src/liballoc/collections/btree/set.rs @@ -19,7 +19,7 @@ use core::iter::{Peekable, FromIterator, FusedIterator}; use core::ops::{BitOr, BitAnd, BitXor, Sub, RangeBounds}; use borrow::Borrow; -use btree_map::{BTreeMap, Keys}; +use collections::btree_map::{self, BTreeMap, Keys}; use super::Recover; // FIXME(conventions): implement bounded iterators @@ -104,7 +104,7 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug)] pub struct IntoIter { - iter: ::btree_map::IntoIter, + iter: btree_map::IntoIter, } /// An iterator over a sub-range of items in a `BTreeSet`. @@ -117,7 +117,7 @@ pub struct IntoIter { #[derive(Debug)] #[stable(feature = "btree_range", since = "1.17.0")] pub struct Range<'a, T: 'a> { - iter: ::btree_map::Range<'a, T, ()>, + iter: btree_map::Range<'a, T, ()>, } /// A lazy iterator producing elements in the difference of `BTreeSet`s. diff --git a/src/liballoc/linked_list.rs b/src/liballoc/collections/linked_list.rs similarity index 100% rename from src/liballoc/linked_list.rs rename to src/liballoc/collections/linked_list.rs diff --git a/src/liballoc/collections/mod.rs b/src/liballoc/collections/mod.rs new file mode 100644 index 0000000000000..35c816a1ceb6e --- /dev/null +++ b/src/liballoc/collections/mod.rs @@ -0,0 +1,59 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Collection types. + +#![stable(feature = "rust1", since = "1.0.0")] + +pub mod binary_heap; +mod btree; +pub mod linked_list; +pub mod vec_deque; + +#[stable(feature = "rust1", since = "1.0.0")] +pub mod btree_map { + //! A map based on a B-Tree. + #[stable(feature = "rust1", since = "1.0.0")] + pub use super::btree::map::*; +} + +#[stable(feature = "rust1", since = "1.0.0")] +pub mod btree_set { + //! A set based on a B-Tree. + #[stable(feature = "rust1", since = "1.0.0")] + pub use super::btree::set::*; +} + +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] +pub use self::binary_heap::BinaryHeap; + +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] +pub use self::btree_map::BTreeMap; + +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] +pub use self::btree_set::BTreeSet; + +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] +pub use self::linked_list::LinkedList; + +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] +pub use self::vec_deque::VecDeque; + +/// An intermediate trait for specialization of `Extend`. +#[doc(hidden)] +trait SpecExtend { + /// Extends `self` with the contents of the given iterator. + fn spec_extend(&mut self, iter: I); +} diff --git a/src/liballoc/vec_deque.rs b/src/liballoc/collections/vec_deque.rs similarity index 99% rename from src/liballoc/vec_deque.rs rename to src/liballoc/collections/vec_deque.rs index e917a65c9c5ad..4753d36415c48 100644 --- a/src/liballoc/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -2891,7 +2891,7 @@ mod tests { #[test] fn test_from_vec() { - use super::super::vec::Vec; + use vec::Vec; for cap in 0..35 { for len in 0..cap + 1 { let mut vec = Vec::with_capacity(cap); @@ -2907,7 +2907,7 @@ mod tests { #[test] fn test_vec_from_vecdeque() { - use super::super::vec::Vec; + use vec::Vec; fn create_vec_and_test_convert(cap: usize, offset: usize, len: usize) { let mut vd = VecDeque::with_capacity(cap); diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 585e34f58514c..e8be9ecfa3630 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -162,59 +162,24 @@ mod boxed { } #[cfg(test)] mod boxed_test; +pub mod collections; #[cfg(target_has_atomic = "ptr")] pub mod arc; pub mod rc; pub mod raw_vec; -// collections modules -pub mod binary_heap; -mod btree; pub mod borrow; pub mod fmt; -pub mod linked_list; pub mod slice; pub mod str; pub mod string; pub mod vec; -pub mod vec_deque; - -#[stable(feature = "rust1", since = "1.0.0")] -pub mod btree_map { - //! A map based on a B-Tree. - #[stable(feature = "rust1", since = "1.0.0")] - pub use btree::map::*; -} - -#[stable(feature = "rust1", since = "1.0.0")] -pub mod btree_set { - //! A set based on a B-Tree. - #[stable(feature = "rust1", since = "1.0.0")] - pub use btree::set::*; -} #[cfg(not(test))] mod std { pub use core::ops; // RangeFull } -/// An intermediate trait for specialization of `Extend`. -#[doc(hidden)] -trait SpecExtend { - /// Extends `self` with the contents of the given iterator. - fn spec_extend(&mut self, iter: I); -} - -#[doc(no_inline)] -pub use binary_heap::BinaryHeap; -#[doc(no_inline)] -pub use btree_map::BTreeMap; -#[doc(no_inline)] -pub use btree_set::BTreeSet; -#[doc(no_inline)] -pub use linked_list::LinkedList; -#[doc(no_inline)] -pub use vec_deque::VecDeque; #[doc(no_inline)] pub use string::String; #[doc(no_inline)] diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index ec9c39c916c47..bb99d0401d3cd 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -51,7 +51,6 @@ use boxed::Box; use slice::{SliceConcatExt, SliceIndex}; use string::String; use vec::Vec; -use vec_deque::VecDeque; #[stable(feature = "rust1", since = "1.0.0")] pub use core::str::{FromStr, Utf8Error}; diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs index 421134141837b..643426c377b74 100644 --- a/src/libstd/collections/mod.rs +++ b/src/libstd/collections/mod.rs @@ -424,13 +424,13 @@ #[doc(hidden)] pub use ops::Bound; #[stable(feature = "rust1", since = "1.0.0")] -pub use alloc_crate::{BinaryHeap, BTreeMap, BTreeSet}; +pub use alloc_crate::collections::{BinaryHeap, BTreeMap, BTreeSet}; #[stable(feature = "rust1", since = "1.0.0")] -pub use alloc_crate::{LinkedList, VecDeque}; +pub use alloc_crate::collections::{LinkedList, VecDeque}; #[stable(feature = "rust1", since = "1.0.0")] -pub use alloc_crate::{binary_heap, btree_map, btree_set}; +pub use alloc_crate::collections::{binary_heap, btree_map, btree_set}; #[stable(feature = "rust1", since = "1.0.0")] -pub use alloc_crate::{linked_list, vec_deque}; +pub use alloc_crate::collections::{linked_list, vec_deque}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::hash_map::HashMap; From b0547cea0ae50f49619ded26f43d0d55a1674b14 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 15 Jun 2018 03:56:35 +0200 Subject: [PATCH 4/7] Move core::alloc::CollectionAllocErr to alloc::collections --- src/liballoc/collections/mod.rs | 29 +++++++++++++++++++++++++++ src/liballoc/collections/vec_deque.rs | 2 +- src/liballoc/raw_vec.rs | 4 ++-- src/liballoc/string.rs | 2 +- src/liballoc/vec.rs | 2 +- src/libcore/alloc.rs | 28 -------------------------- src/libstd/collections/hash/map.rs | 2 +- src/libstd/collections/hash/table.rs | 3 ++- src/libstd/collections/mod.rs | 2 +- 9 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/liballoc/collections/mod.rs b/src/liballoc/collections/mod.rs index 35c816a1ceb6e..96e0eb633b2f5 100644 --- a/src/liballoc/collections/mod.rs +++ b/src/liballoc/collections/mod.rs @@ -51,6 +51,35 @@ pub use self::linked_list::LinkedList; #[doc(no_inline)] pub use self::vec_deque::VecDeque; +use alloc::{AllocErr, LayoutErr}; + +/// Augments `AllocErr` with a CapacityOverflow variant. +#[derive(Clone, PartialEq, Eq, Debug)] +#[unstable(feature = "try_reserve", reason = "new API", issue="48043")] +pub enum CollectionAllocErr { + /// Error due to the computed capacity exceeding the collection's maximum + /// (usually `isize::MAX` bytes). + CapacityOverflow, + /// Error due to the allocator (see the `AllocErr` type's docs). + AllocErr, +} + +#[unstable(feature = "try_reserve", reason = "new API", issue="48043")] +impl From for CollectionAllocErr { + #[inline] + fn from(AllocErr: AllocErr) -> Self { + CollectionAllocErr::AllocErr + } +} + +#[unstable(feature = "try_reserve", reason = "new API", issue="48043")] +impl From for CollectionAllocErr { + #[inline] + fn from(_: LayoutErr) -> Self { + CollectionAllocErr::CapacityOverflow + } +} + /// An intermediate trait for specialization of `Extend`. #[doc(hidden)] trait SpecExtend { diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index 4753d36415c48..ba92b886138c0 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -30,7 +30,7 @@ use core::slice; use core::hash::{Hash, Hasher}; use core::cmp; -use alloc::CollectionAllocErr; +use collections::CollectionAllocErr; use raw_vec::RawVec; use vec::Vec; diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 5095bbe96cc67..4f2686abf4515 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -18,8 +18,8 @@ use core::ptr::{self, NonNull, Unique}; use core::slice; use alloc::{Alloc, Layout, Global, handle_alloc_error}; -use alloc::CollectionAllocErr; -use alloc::CollectionAllocErr::*; +use collections::CollectionAllocErr; +use collections::CollectionAllocErr::*; use boxed::Box; /// A low-level utility for more ergonomically allocating, reallocating, and deallocating diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index a988b6a26d9df..6b28687a060de 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -66,7 +66,7 @@ use core::ptr; use core::str::pattern::Pattern; use core::str::lossy; -use alloc::CollectionAllocErr; +use collections::CollectionAllocErr; use borrow::{Cow, ToOwned}; use boxed::Box; use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars}; diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 752a6c966d51a..fbbaced540e70 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -80,7 +80,7 @@ use core::ptr; use core::ptr::NonNull; use core::slice; -use alloc::CollectionAllocErr; +use collections::CollectionAllocErr; use borrow::ToOwned; use borrow::Cow; use boxed::Box; diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index 91447e01ad4fa..01221aecb6284 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -385,34 +385,6 @@ impl fmt::Display for CannotReallocInPlace { } } -/// Augments `AllocErr` with a CapacityOverflow variant. -// FIXME: should this be in libcore or liballoc? -#[derive(Clone, PartialEq, Eq, Debug)] -#[unstable(feature = "try_reserve", reason = "new API", issue="48043")] -pub enum CollectionAllocErr { - /// Error due to the computed capacity exceeding the collection's maximum - /// (usually `isize::MAX` bytes). - CapacityOverflow, - /// Error due to the allocator (see the `AllocErr` type's docs). - AllocErr, -} - -#[unstable(feature = "try_reserve", reason = "new API", issue="48043")] -impl From for CollectionAllocErr { - #[inline] - fn from(AllocErr: AllocErr) -> Self { - CollectionAllocErr::AllocErr - } -} - -#[unstable(feature = "try_reserve", reason = "new API", issue="48043")] -impl From for CollectionAllocErr { - #[inline] - fn from(_: LayoutErr) -> Self { - CollectionAllocErr::CapacityOverflow - } -} - /// A memory allocator that can be registered as the standard library’s default /// though the `#[global_allocator]` attributes. /// diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ee8c1dc81ad75..91912e5f2412e 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -11,7 +11,7 @@ use self::Entry::*; use self::VacantEntryState::*; -use alloc::CollectionAllocErr; +use collections::CollectionAllocErr; use cell::Cell; use borrow::Borrow; use cmp::max; diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index d14b754ddb661..2b319186a8db2 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -8,7 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use alloc::{Global, Alloc, Layout, LayoutErr, CollectionAllocErr, handle_alloc_error}; +use alloc::{Global, Alloc, Layout, LayoutErr, handle_alloc_error}; +use collections::CollectionAllocErr; use hash::{BuildHasher, Hash, Hasher}; use marker; use mem::{size_of, needs_drop}; diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs index 643426c377b74..8d2c82bc0aa84 100644 --- a/src/libstd/collections/mod.rs +++ b/src/libstd/collections/mod.rs @@ -438,7 +438,7 @@ pub use self::hash_map::HashMap; pub use self::hash_set::HashSet; #[unstable(feature = "try_reserve", reason = "new API", issue="48043")] -pub use alloc::CollectionAllocErr; +pub use alloc_crate::collections::CollectionAllocErr; mod hash; From 3394fb7bb7f08c045f9a82bb92272418c855859d Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 15 Jun 2018 03:59:59 +0200 Subject: [PATCH 5/7] Remove the Vec and String reexports at the root of the alloc crate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … since `std` has no corresponding reexports. Use `alloc::vec::Vec` and `alloc::string::String` instead. --- src/liballoc/lib.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index e8be9ecfa3630..9e1740473feab 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -179,8 +179,3 @@ pub mod vec; mod std { pub use core::ops; // RangeFull } - -#[doc(no_inline)] -pub use string::String; -#[doc(no_inline)] -pub use vec::Vec; From c7638edf5293dd471d951e64671d60febd0b628c Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 15 Jun 2018 04:07:09 +0200 Subject: [PATCH 6/7] Rename alloc::arc to alloc::sync, to match std::sync --- src/liballoc/lib.rs | 4 ++-- src/liballoc/{arc.rs => sync.rs} | 0 src/liballoc/task.rs | 2 +- src/libstd/sync/mod.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename src/liballoc/{arc.rs => sync.rs} (100%) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 9e1740473feab..8ec5a9ed19388 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -40,7 +40,7 @@ //! //! ## Atomically reference counted pointers //! -//! The [`Arc`](arc/index.html) type is the threadsafe equivalent of the `Rc` +//! The [`Arc`](sync/index.html) type is the threadsafe equivalent of the `Rc` //! type. It provides all the same functionality of `Rc`, except it requires //! that the contained type `T` is shareable. Additionally, `Arc` is itself //! sendable while `Rc` is not. @@ -164,7 +164,7 @@ mod boxed { mod boxed_test; pub mod collections; #[cfg(target_has_atomic = "ptr")] -pub mod arc; +pub mod sync; pub mod rc; pub mod raw_vec; diff --git a/src/liballoc/arc.rs b/src/liballoc/sync.rs similarity index 100% rename from src/liballoc/arc.rs rename to src/liballoc/sync.rs diff --git a/src/liballoc/task.rs b/src/liballoc/task.rs index 7b1947b56b8c7..f14fe3a20da93 100644 --- a/src/liballoc/task.rs +++ b/src/liballoc/task.rs @@ -18,10 +18,10 @@ pub use self::if_arc::*; #[cfg(target_has_atomic = "ptr")] mod if_arc { use super::*; - use arc::Arc; use core::marker::PhantomData; use core::mem; use core::ptr::{self, NonNull}; + use sync::Arc; /// A way of waking up a specific task. /// diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index 642b284c6c794..e12ef8d9eda2d 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -18,7 +18,7 @@ #![stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")] -pub use alloc_crate::arc::{Arc, Weak}; +pub use alloc_crate::sync::{Arc, Weak}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::sync::atomic; From 15bb6c431da6f486fd048a00ba9c72fe5bc2dd74 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 23 Jun 2018 21:48:56 +0200 Subject: [PATCH 7/7] =?UTF-8?q?liballoc=20docs:=20Remove=20=E2=80=9Cnot=20?= =?UTF-8?q?intended=20for=20general=20usage=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/liballoc/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 8ec5a9ed19388..c054042d5a184 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -13,10 +13,10 @@ //! This library provides smart pointers and collections for managing //! heap-allocated values. //! -//! This library, like libcore, is not intended for general usage, but rather as -//! a building block of other libraries. The types and interfaces in this -//! library are re-exported through the [standard library](../std/index.html), -//! and should not be used through this library. +//! This library, like libcore, normally doesn’t need to be used directly +//! since its contents are re-exported in the [`std` crate](../std/index.html). +//! Crates that use the `#![no_std]` attribute however will typically +//! not depend on `std`, so they’d use this crate instead. //! //! ## Boxed values //!