From b35e17991cc59e73e1e04f70c35dfae8ff3df7be Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 20 Jul 2016 15:55:00 -0700 Subject: [PATCH 1/3] Put `Vec` in with the rest of the collections Tracking issue: #34943 --- src/libstd/collections/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs index 9b13d54230078..f1ed91f591b60 100644 --- a/src/libstd/collections/mod.rs +++ b/src/libstd/collections/mod.rs @@ -419,6 +419,8 @@ pub use core_collections::{LinkedList, VecDeque}; pub use core_collections::{binary_heap, btree_map, btree_set}; #[stable(feature = "rust1", since = "1.0.0")] pub use core_collections::{linked_list, vec_deque}; +#[stable(feature = "rust1", since = "1.0.0")] +pub use core_collections::vec::{self, Vec}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::hash_map::HashMap; From 54267fc8e5a190b0ee7dee9cda8d29cb7bbc4562 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 21 Jul 2016 10:49:04 -0700 Subject: [PATCH 2/3] Update compile-fail test error messages --- src/test/compile-fail/fn-item-type.rs | 4 ++-- src/test/compile-fail/issue-24819.rs | 2 +- src/test/compile-fail/on-unimplemented/on-trait.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/compile-fail/fn-item-type.rs b/src/test/compile-fail/fn-item-type.rs index 6217a9f16b935..9fdf2602240ae 100644 --- a/src/test/compile-fail/fn-item-type.rs +++ b/src/test/compile-fail/fn-item-type.rs @@ -33,8 +33,8 @@ fn main() { eq(bar::, bar::>); //~^ ERROR mismatched types //~| expected type `fn(isize) -> isize {bar::}` - //~| found type `fn(isize) -> isize {bar::>}` - //~| expected struct `std::string::String`, found struct `std::vec::Vec` + //~| found type `fn(isize) -> isize {bar::>}` + //~| expected struct `std::string::String`, found struct `std::collections::Vec` // Make sure we distinguish between trait methods correctly. eq(::foo, ::foo); diff --git a/src/test/compile-fail/issue-24819.rs b/src/test/compile-fail/issue-24819.rs index 52f5f1cd079eb..73c6c392423cc 100644 --- a/src/test/compile-fail/issue-24819.rs +++ b/src/test/compile-fail/issue-24819.rs @@ -14,7 +14,7 @@ fn main() { let mut v = Vec::new(); foo(&mut v); //~^ ERROR mismatched types - //~| expected struct `std::collections::HashSet`, found struct `std::vec::Vec` + //~| expected struct `std::collections::HashSet`, found struct `std::collections::Vec` } fn foo(h: &mut HashSet) { diff --git a/src/test/compile-fail/on-unimplemented/on-trait.rs b/src/test/compile-fail/on-unimplemented/on-trait.rs index 39ce1b33ca131..039768126c4c5 100644 --- a/src/test/compile-fail/on-unimplemented/on-trait.rs +++ b/src/test/compile-fail/on-unimplemented/on-trait.rs @@ -33,7 +33,7 @@ pub fn main() { let x = vec!(1u8, 2, 3, 4); let y: Option> = collect(x.iter()); // this should give approximately the same error for x.iter().collect() //~^ ERROR - //~^^ NOTE a collection of type `std::option::Option>` cannot be built from an iterator over elements of type `&u8` + //~^^ NOTE a collection of type `std::option::Option>` cannot be built from an iterator over elements of type `&u8` //~^^^ NOTE required by `collect` let x: String = foobar(); //~ ERROR //~^ NOTE test error `std::string::String` with `u8` `_` `u32` From d9a8f3bacef8a8652e83ab352a8a6903722ffdf3 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 21 Jul 2016 11:31:52 -0700 Subject: [PATCH 3/3] Deprecate `std::vec` in favor of `std::collections::vec` --- src/libstd/lib.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index d05a5a0961483..379518da512c0 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -135,8 +135,8 @@ //! atomically-reference-counted box, [`Arc`], with a [`Mutex`] to get the same //! effect. //! -//! The [`collections`] module defines maps, sets, linked lists and other -//! typical collection types, including the common [`HashMap`]. +//! The [`collections`] module defines maps, sets, sequences and other typical +//! collection types, including the common [`Vec`] and [`HashMap`]. //! //! ## Platform abstractions and I/O //! @@ -169,7 +169,7 @@ //! [`RefCell`]: cell/struct.RefCell.html //! [`Result`]: result/enum.Result.html //! [`String`]: string/struct.String.html -//! [`Vec`]: vec/index.html +//! [`Vec`]: collections/vec/index.html //! [array]: primitive.array.html //! [slice]: primitive.slice.html //! [`atomic`]: sync/atomic/index.html @@ -367,8 +367,14 @@ pub use core_collections::slice; pub use core_collections::str; #[stable(feature = "rust1", since = "1.0.0")] pub use core_collections::string; +#[rustc_deprecated(since = "1.12.0")] #[stable(feature = "rust1", since = "1.0.0")] -pub use core_collections::vec; +pub mod vec { + //! `Vec` used to be in its own module, separate from the rest of the + //! collections. This re-export is included for backwards compatibility. + #[stable(feature = "rust1", since = "1.0.0")] + pub use core_collections::vec::*; +} #[stable(feature = "rust1", since = "1.0.0")] pub use rustc_unicode::char;