From c6cfa3c4899e46addfe6d04d6aaa2d247056748f Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Tue, 24 Jan 2017 22:44:33 -0500 Subject: Extend Cell to work with non-Copy types Part of #39264 --- src/libcoretest/cell.rs | 31 +++++++++++++++++++++++++++++++ src/libcoretest/lib.rs | 1 + 2 files changed, 32 insertions(+) (limited to 'src/libcoretest') diff --git a/src/libcoretest/cell.rs b/src/libcoretest/cell.rs index 724a312ea79..8585f2f0871 100644 --- a/src/libcoretest/cell.rs +++ b/src/libcoretest/cell.rs @@ -209,6 +209,37 @@ fn cell_default() { assert_eq!(0, cell.get()); } +#[test] +fn cell_set() { + let cell = Cell::new(10); + cell.set(20); + assert_eq!(20, cell.get()); + + let cell = Cell::new("Hello".to_owned()); + cell.set("World".to_owned()); + assert_eq!("World".to_owned(), cell.into_inner()); +} + +#[test] +fn cell_replace() { + let cell = Cell::new(10); + assert_eq!(10, cell.replace(20)); + assert_eq!(20, cell.get()); + + let cell = Cell::new("Hello".to_owned()); + assert_eq!("Hello".to_owned(), cell.replace("World".to_owned())); + assert_eq!("World".to_owned(), cell.into_inner()); +} + +#[test] +fn cell_into_inner() { + let cell = Cell::new(10); + assert_eq!(10, cell.into_inner()); + + let cell = Cell::new("Hello world".to_owned()); + assert_eq!("Hello world".to_owned(), cell.into_inner()); +} + #[test] fn refcell_default() { let cell: RefCell = Default::default(); diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs index ee47b510ee0..ea88d45630c 100644 --- a/src/libcoretest/lib.rs +++ b/src/libcoretest/lib.rs @@ -34,6 +34,7 @@ #![feature(ordering_chaining)] #![feature(result_unwrap_or_default)] #![feature(ptr_unaligned)] +#![feature(move_cell)] extern crate core; extern crate test; -- cgit 1.4.1-3-g733a5 From 671b1c1d895c54903a10555196b789ebd5ff2c90 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 25 Jan 2017 15:37:20 -0800 Subject: std: Stabilize APIs for the 1.16.0 release This commit applies the stabilization/deprecations of the 1.16.0 release, as tracked by the rust-lang/rust issue tracker and the final-comment-period tag. The following APIs were stabilized: * `VecDeque::truncate` * `VecDeque::resize` * `String::insert_str` * `Duration::checked_{add,sub,div,mul}` * `str::replacen` * `SocketAddr::is_ipv{4,6}` * `IpAddr::is_ipv{4,6}` * `str::repeat` * `Vec::dedup_by` * `Vec::dedup_by_key` * `Result::unwrap_or_default` * `<*const T>::wrapping_offset` * `<*mut T>::wrapping_offset` * `CommandExt::creation_flags` (on Windows) * `File::set_permissions` * `String::split_off` The following APIs were deprecated * `EnumSet` - replaced with other ecosystem abstractions, long since unstable Closes #27788 Closes #35553 Closes #35774 Closes #36436 Closes #36949 Closes #37079 Closes #37087 Closes #37516 Closes #37827 Closes #37916 Closes #37966 Closes #38080 --- src/libcollections/enum_set.rs | 2 + src/libcollections/lib.rs | 1 + src/libcollections/str.rs | 10 +- src/libcollections/string.rs | 9 +- src/libcollections/vec.rs | 7 +- src/libcollections/vec_deque.rs | 12 +- src/libcollectionstest/enum_set.rs | 268 ---------------------------------- src/libcollectionstest/lib.rs | 6 - src/libcore/ptr.rs | 6 +- src/libcore/result.rs | 4 +- src/libcoretest/lib.rs | 1 - src/libserialize/collection_impls.rs | 29 ---- src/libserialize/lib.rs | 1 - src/libstd/fs.rs | 3 +- src/libstd/net/addr.rs | 8 +- src/libstd/net/ip.rs | 8 +- src/libstd/sys/windows/ext/process.rs | 6 +- src/libstd/time/duration.rs | 16 +- 18 files changed, 26 insertions(+), 371 deletions(-) delete mode 100644 src/libcollectionstest/enum_set.rs (limited to 'src/libcoretest') diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index 87bc5e59ef7..78b61079777 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -17,6 +17,8 @@ reason = "matches collection reform specification, \ waiting for dust to settle", issue = "37966")] +#![rustc_deprecated(since = "1.16.0", reason = "long since replaced")] +#![allow(deprecated)] use core::marker; use core::fmt; diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 561d8860dc8..39de87c0840 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -79,6 +79,7 @@ pub use btree_set::BTreeSet; #[doc(no_inline)] pub use linked_list::LinkedList; #[doc(no_inline)] +#[allow(deprecated)] pub use enum_set::EnumSet; #[doc(no_inline)] pub use vec_deque::VecDeque; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 70cedce9a90..458d5114829 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1607,7 +1607,6 @@ impl str { /// Basic usage: /// /// ``` - /// # #![feature(str_replacen)] /// let s = "foo foo 123 foo"; /// assert_eq!("new new 123 foo", s.replacen("foo", "new", 2)); /// assert_eq!("faa fao 123 foo", s.replacen('o', "a", 3)); @@ -1617,13 +1616,10 @@ impl str { /// When the pattern doesn't match: /// /// ``` - /// # #![feature(str_replacen)] /// let s = "this is old"; /// assert_eq!(s, s.replacen("cookie monster", "little lamb", 10)); /// ``` - #[unstable(feature = "str_replacen", - issue = "36436", - reason = "only need to replace first N matches")] + #[stable(feature = "str_replacen", since = "1.16.0")] pub fn replacen<'a, P: Pattern<'a>>(&'a self, pat: P, to: &str, count: usize) -> String { // Hope to reduce the times of re-allocation let mut result = String::with_capacity(32); @@ -1795,11 +1791,9 @@ impl str { /// Basic usage: /// /// ``` - /// #![feature(repeat_str)] - /// /// assert_eq!("abc".repeat(4), String::from("abcabcabcabc")); /// ``` - #[unstable(feature = "repeat_str", issue = "37079")] + #[stable(feature = "repeat_str", since = "1.16.0")] pub fn repeat(&self, n: usize) -> String { let mut s = String::with_capacity(self.len() * n); s.extend((0..n).map(|_| self)); diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 5210c25b4e5..b184a8603e6 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1166,8 +1166,6 @@ impl String { /// Basic usage: /// /// ``` - /// #![feature(insert_str)] - /// /// let mut s = String::from("bar"); /// /// s.insert_str(0, "foo"); @@ -1175,9 +1173,7 @@ impl String { /// assert_eq!("foobar", s); /// ``` #[inline] - #[unstable(feature = "insert_str", - reason = "recent addition", - issue = "35553")] + #[stable(feature = "insert_str", since = "1.16.0")] pub fn insert_str(&mut self, idx: usize, string: &str) { assert!(self.is_char_boundary(idx)); @@ -1270,7 +1266,6 @@ impl String { /// # Examples /// /// ``` - /// # #![feature(string_split_off)] /// # fn main() { /// let mut hello = String::from("Hello, World!"); /// let world = hello.split_off(7); @@ -1279,7 +1274,7 @@ impl String { /// # } /// ``` #[inline] - #[unstable(feature = "string_split_off", issue = "38080")] + #[stable(feature = "string_split_off", since = "1.16.0")] pub fn split_off(&mut self, mid: usize) -> String { assert!(self.is_char_boundary(mid)); let other = self.vec.split_off(mid); diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index c5b904c8a2f..1f8fd32da9a 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -820,15 +820,13 @@ impl Vec { /// # Examples /// /// ``` - /// #![feature(dedup_by)] - /// /// let mut vec = vec![10, 20, 21, 30, 20]; /// /// vec.dedup_by_key(|i| *i / 10); /// /// assert_eq!(vec, [10, 20, 30, 20]); /// ``` - #[unstable(feature = "dedup_by", reason = "recently added", issue = "37087")] + #[stable(feature = "dedup_by", since = "1.16.0")] #[inline] pub fn dedup_by_key(&mut self, mut key: F) where F: FnMut(&mut T) -> K, K: PartialEq { self.dedup_by(|a, b| key(a) == key(b)) @@ -841,7 +839,6 @@ impl Vec { /// # Examples /// /// ``` - /// #![feature(dedup_by)] /// use std::ascii::AsciiExt; /// /// let mut vec = vec!["foo", "bar", "Bar", "baz", "bar"]; @@ -850,7 +847,7 @@ impl Vec { /// /// assert_eq!(vec, ["foo", "bar", "baz", "bar"]); /// ``` - #[unstable(feature = "dedup_by", reason = "recently added", issue = "37087")] + #[stable(feature = "dedup_by", since = "1.16.0")] pub fn dedup_by(&mut self, mut same_bucket: F) where F: FnMut(&mut T, &mut T) -> bool { unsafe { // Although we have a mutable reference to `self`, we cannot make diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index fea2d111f47..5b1bc3a3ae4 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -643,8 +643,6 @@ impl VecDeque { /// # Examples /// /// ``` - /// #![feature(deque_extras)] - /// /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -655,9 +653,7 @@ impl VecDeque { /// assert_eq!(buf.len(), 1); /// assert_eq!(Some(&5), buf.get(0)); /// ``` - #[unstable(feature = "deque_extras", - reason = "matches collection reform specification; waiting on panic semantics", - issue = "27788")] + #[stable(feature = "deque_extras", since = "1.16.0")] pub fn truncate(&mut self, len: usize) { for _ in len..self.len() { self.pop_back(); @@ -1779,8 +1775,6 @@ impl VecDeque { /// # Examples /// /// ``` - /// #![feature(deque_extras)] - /// /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -1793,9 +1787,7 @@ impl VecDeque { /// assert_eq!(a, b); /// } /// ``` - #[unstable(feature = "deque_extras", - reason = "matches collection reform specification; waiting on panic semantics", - issue = "27788")] + #[stable(feature = "deque_extras", since = "1.16.0")] pub fn resize(&mut self, new_len: usize, value: T) { let len = self.len(); diff --git a/src/libcollectionstest/enum_set.rs b/src/libcollectionstest/enum_set.rs deleted file mode 100644 index 972361326d7..00000000000 --- a/src/libcollectionstest/enum_set.rs +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright 2012 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. - -use std::mem; - -use collections::enum_set::{CLike, EnumSet}; - -use self::Foo::*; - -#[derive(Copy, Clone, PartialEq, Debug)] -#[repr(usize)] -enum Foo { - A, - B, - C, -} - -impl CLike for Foo { - fn to_usize(&self) -> usize { - *self as usize - } - - fn from_usize(v: usize) -> Foo { - unsafe { mem::transmute(v) } - } -} - -#[test] -fn test_new() { - let e: EnumSet = EnumSet::new(); - assert!(e.is_empty()); -} - -#[test] -fn test_show() { - let mut e = EnumSet::new(); - assert!(format!("{:?}", e) == "{}"); - e.insert(A); - assert!(format!("{:?}", e) == "{A}"); - e.insert(C); - assert!(format!("{:?}", e) == "{A, C}"); -} - -#[test] -fn test_len() { - let mut e = EnumSet::new(); - assert_eq!(e.len(), 0); - e.insert(A); - e.insert(B); - e.insert(C); - assert_eq!(e.len(), 3); - e.remove(&A); - assert_eq!(e.len(), 2); - e.clear(); - assert_eq!(e.len(), 0); -} - -/////////////////////////////////////////////////////////////////////////// -// intersect - -#[test] -fn test_two_empties_do_not_intersect() { - let e1: EnumSet = EnumSet::new(); - let e2: EnumSet = EnumSet::new(); - assert!(e1.is_disjoint(&e2)); -} - -#[test] -fn test_empty_does_not_intersect_with_full() { - let e1: EnumSet = EnumSet::new(); - - let mut e2: EnumSet = EnumSet::new(); - e2.insert(A); - e2.insert(B); - e2.insert(C); - - assert!(e1.is_disjoint(&e2)); -} - -#[test] -fn test_disjoint_intersects() { - let mut e1: EnumSet = EnumSet::new(); - e1.insert(A); - - let mut e2: EnumSet = EnumSet::new(); - e2.insert(B); - - assert!(e1.is_disjoint(&e2)); -} - -#[test] -fn test_overlapping_intersects() { - let mut e1: EnumSet = EnumSet::new(); - e1.insert(A); - - let mut e2: EnumSet = EnumSet::new(); - e2.insert(A); - e2.insert(B); - - assert!(!e1.is_disjoint(&e2)); -} - -/////////////////////////////////////////////////////////////////////////// -// contains and contains_elem - -#[test] -fn test_superset() { - let mut e1: EnumSet = EnumSet::new(); - e1.insert(A); - - let mut e2: EnumSet = EnumSet::new(); - e2.insert(A); - e2.insert(B); - - let mut e3: EnumSet = EnumSet::new(); - e3.insert(C); - - assert!(e1.is_subset(&e2)); - assert!(e2.is_superset(&e1)); - assert!(!e3.is_superset(&e2)); - assert!(!e2.is_superset(&e3)) -} - -#[test] -fn test_contains() { - let mut e1: EnumSet = EnumSet::new(); - e1.insert(A); - assert!(e1.contains(&A)); - assert!(!e1.contains(&B)); - assert!(!e1.contains(&C)); - - e1.insert(A); - e1.insert(B); - assert!(e1.contains(&A)); - assert!(e1.contains(&B)); - assert!(!e1.contains(&C)); -} - -/////////////////////////////////////////////////////////////////////////// -// iter - -#[test] -fn test_iterator() { - let mut e1: EnumSet = EnumSet::new(); - - let elems: Vec = e1.iter().collect(); - assert!(elems.is_empty()); - - e1.insert(A); - let elems: Vec<_> = e1.iter().collect(); - assert_eq!(elems, [A]); - - e1.insert(C); - let elems: Vec<_> = e1.iter().collect(); - assert_eq!(elems, [A, C]); - - e1.insert(C); - let elems: Vec<_> = e1.iter().collect(); - assert_eq!(elems, [A, C]); - - e1.insert(B); - let elems: Vec<_> = e1.iter().collect(); - assert_eq!(elems, [A, B, C]); -} - -/////////////////////////////////////////////////////////////////////////// -// operators - -#[test] -fn test_operators() { - let mut e1: EnumSet = EnumSet::new(); - e1.insert(A); - e1.insert(C); - - let mut e2: EnumSet = EnumSet::new(); - e2.insert(B); - e2.insert(C); - - let e_union = e1 | e2; - let elems: Vec<_> = e_union.iter().collect(); - assert_eq!(elems, [A, B, C]); - - let e_intersection = e1 & e2; - let elems: Vec<_> = e_intersection.iter().collect(); - assert_eq!(elems, [C]); - - // Another way to express intersection - let e_intersection = e1 - (e1 - e2); - let elems: Vec<_> = e_intersection.iter().collect(); - assert_eq!(elems, [C]); - - let e_subtract = e1 - e2; - let elems: Vec<_> = e_subtract.iter().collect(); - assert_eq!(elems, [A]); - - // Bitwise XOR of two sets, aka symmetric difference - let e_symmetric_diff = e1 ^ e2; - let elems: Vec<_> = e_symmetric_diff.iter().collect(); - assert_eq!(elems, [A, B]); - - // Another way to express symmetric difference - let e_symmetric_diff = (e1 - e2) | (e2 - e1); - let elems: Vec<_> = e_symmetric_diff.iter().collect(); - assert_eq!(elems, [A, B]); - - // Yet another way to express symmetric difference - let e_symmetric_diff = (e1 | e2) - (e1 & e2); - let elems: Vec<_> = e_symmetric_diff.iter().collect(); - assert_eq!(elems, [A, B]); -} - -#[test] -#[should_panic] -fn test_overflow() { - #[allow(dead_code)] - #[derive(Copy, Clone)] - #[repr(usize)] - enum Bar { - V00, V01, V02, V03, V04, V05, V06, V07, V08, V09, - V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, - V20, V21, V22, V23, V24, V25, V26, V27, V28, V29, - V30, V31, V32, V33, V34, V35, V36, V37, V38, V39, - V40, V41, V42, V43, V44, V45, V46, V47, V48, V49, - V50, V51, V52, V53, V54, V55, V56, V57, V58, V59, - V60, V61, V62, V63, V64, V65, V66, V67, V68, V69, - } - - impl CLike for Bar { - fn to_usize(&self) -> usize { - *self as usize - } - - fn from_usize(v: usize) -> Bar { - unsafe { mem::transmute(v) } - } - } - let mut set = EnumSet::new(); - set.insert(Bar::V64); -} - -#[test] -fn test_extend_ref() { - let mut a = EnumSet::new(); - a.insert(A); - - a.extend(&[A, C]); - - assert_eq!(a.len(), 2); - assert!(a.contains(&A)); - assert!(a.contains(&C)); - - let mut b = EnumSet::new(); - b.insert(B); - - a.extend(&b); - - assert_eq!(a.len(), 3); - assert!(a.contains(&A)); - assert!(a.contains(&B)); - assert!(a.contains(&C)); -} diff --git a/src/libcollectionstest/lib.rs b/src/libcollectionstest/lib.rs index bec3965a958..b146672893f 100644 --- a/src/libcollectionstest/lib.rs +++ b/src/libcollectionstest/lib.rs @@ -18,17 +18,12 @@ #![feature(collections)] #![feature(collections_bound)] #![feature(const_fn)] -#![feature(dedup_by)] -#![feature(enumset)] #![feature(exact_size_is_empty)] #![feature(pattern)] #![feature(placement_in_syntax)] #![feature(rand)] -#![feature(repeat_str)] #![feature(step_by)] #![feature(str_escape)] -#![feature(str_replacen)] -#![feature(string_split_off)] #![feature(test)] #![feature(unboxed_closures)] #![feature(unicode)] @@ -47,7 +42,6 @@ mod bench; mod binary_heap; mod btree; mod cow_str; -mod enum_set; mod fmt; mod linked_list; mod slice; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index bf5a59c45e4..02851c224e2 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -448,7 +448,6 @@ impl *const T { /// Basic usage: /// /// ``` - /// #![feature(ptr_wrapping_offset)] /// // Iterate using a raw pointer in increments of two elements /// let data = [1u8, 2, 3, 4, 5]; /// let mut ptr: *const u8 = data.as_ptr(); @@ -463,7 +462,7 @@ impl *const T { /// ptr = ptr.wrapping_offset(step); /// } /// ``` - #[unstable(feature = "ptr_wrapping_offset", issue = "37570")] + #[stable(feature = "ptr_wrapping_offset", since = "1.16.0")] #[inline] pub fn wrapping_offset(self, count: isize) -> *const T where T: Sized { unsafe { @@ -572,7 +571,6 @@ impl *mut T { /// Basic usage: /// /// ``` - /// #![feature(ptr_wrapping_offset)] /// // Iterate using a raw pointer in increments of two elements /// let mut data = [1u8, 2, 3, 4, 5]; /// let mut ptr: *mut u8 = data.as_mut_ptr(); @@ -587,7 +585,7 @@ impl *mut T { /// } /// assert_eq!(&data, &[0, 2, 0, 4, 0]); /// ``` - #[unstable(feature = "ptr_wrapping_offset", issue = "37570")] + #[stable(feature = "ptr_wrapping_offset", since = "1.16.0")] #[inline] pub fn wrapping_offset(self, count: isize) -> *mut T where T: Sized { unsafe { diff --git a/src/libcore/result.rs b/src/libcore/result.rs index f02df88bb2e..0a2e3639653 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -840,8 +840,6 @@ impl Result { /// `Err` on error. /// /// ``` - /// #![feature(result_unwrap_or_default)] - /// /// let good_year_from_input = "1909"; /// let bad_year_from_input = "190blarg"; /// let good_year = good_year_from_input.parse().unwrap_or_default(); @@ -854,7 +852,7 @@ impl Result { /// [`FromStr`]: ../../std/str/trait.FromStr.html /// ``` #[inline] - #[unstable(feature = "result_unwrap_or_default", issue = "37516")] + #[stable(feature = "result_unwrap_or_default", since = "1.16.0")] pub fn unwrap_or_default(self) -> T { match self { Ok(x) => x, diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs index ee47b510ee0..8e5893b5ecb 100644 --- a/src/libcoretest/lib.rs +++ b/src/libcoretest/lib.rs @@ -32,7 +32,6 @@ #![feature(unicode)] #![feature(unique)] #![feature(ordering_chaining)] -#![feature(result_unwrap_or_default)] #![feature(ptr_unaligned)] extern crate core; diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs index ba9bf2b86a6..05cfb6352fb 100644 --- a/src/libserialize/collection_impls.rs +++ b/src/libserialize/collection_impls.rs @@ -11,11 +11,9 @@ //! Implementations of serialization for structures found in libcollections use std::hash::{Hash, BuildHasher}; -use std::mem; use {Decodable, Encodable, Decoder, Encoder}; use std::collections::{LinkedList, VecDeque, BTreeMap, BTreeSet, HashMap, HashSet}; -use collections::enum_set::{EnumSet, CLike}; impl< T: Encodable @@ -128,33 +126,6 @@ impl< } } -impl< - T: Encodable + CLike -> Encodable for EnumSet { - fn encode(&self, s: &mut S) -> Result<(), S::Error> { - let mut bits = 0; - for item in self { - bits |= 1 << item.to_usize(); - } - s.emit_usize(bits) - } -} - -impl< - T: Decodable + CLike -> Decodable for EnumSet { - fn decode(d: &mut D) -> Result, D::Error> { - let bits = d.read_usize()?; - let mut set = EnumSet::new(); - for bit in 0..(mem::size_of::()*8) { - if bits & (1 << bit) != 0 { - set.insert(CLike::from_usize(bit)); - } - } - Ok(set) - } -} - impl Encodable for HashMap where K: Encodable + Hash + Eq, V: Encodable, diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 2cfc3924c03..1cb83fa33da 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -30,7 +30,6 @@ Core encoding and decoding interfaces. #![feature(box_syntax)] #![feature(collections)] #![feature(core_intrinsics)] -#![feature(enumset)] #![feature(specialization)] #![feature(staged_api)] #![cfg_attr(test, feature(test))] diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index f1dc36ae793..249627c430c 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -404,7 +404,6 @@ impl File { /// # Examples /// /// ``` - /// #![feature(set_permissions_atomic)] /// # fn foo() -> std::io::Result<()> { /// use std::fs::File; /// @@ -415,7 +414,7 @@ impl File { /// # Ok(()) /// # } /// ``` - #[unstable(feature = "set_permissions_atomic", issue="37916")] + #[stable(feature = "set_permissions_atomic", since = "1.16.0")] pub fn set_permissions(&self, perm: Permissions) -> io::Result<()> { self.inner.set_permissions(perm.0) } diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index d186a53311d..751878c687c 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -148,8 +148,6 @@ impl SocketAddr { /// # Examples /// /// ``` - /// #![feature(sockaddr_checker)] - /// /// use std::net::{IpAddr, Ipv4Addr, SocketAddr}; /// /// fn main() { @@ -158,7 +156,7 @@ impl SocketAddr { /// assert_eq!(socket.is_ipv6(), false); /// } /// ``` - #[unstable(feature = "sockaddr_checker", issue = "36949")] + #[stable(feature = "sockaddr_checker", since = "1.16.0")] pub fn is_ipv4(&self) -> bool { match *self { SocketAddr::V4(_) => true, @@ -172,8 +170,6 @@ impl SocketAddr { /// # Examples /// /// ``` - /// #![feature(sockaddr_checker)] - /// /// use std::net::{IpAddr, Ipv6Addr, SocketAddr}; /// /// fn main() { @@ -183,7 +179,7 @@ impl SocketAddr { /// assert_eq!(socket.is_ipv6(), true); /// } /// ``` - #[unstable(feature = "sockaddr_checker", issue = "36949")] + #[stable(feature = "sockaddr_checker", since = "1.16.0")] pub fn is_ipv6(&self) -> bool { match *self { SocketAddr::V4(_) => false, diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 05e3d38b17e..7803cf728f2 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -196,8 +196,6 @@ impl IpAddr { /// # Examples /// /// ``` - /// #![feature(ipaddr_checker)] - /// /// use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; /// /// fn main() { @@ -206,7 +204,7 @@ impl IpAddr { /// false); /// } /// ``` - #[unstable(feature = "ipaddr_checker", issue = "36949")] + #[stable(feature = "ipaddr_checker", since = "1.16.0")] pub fn is_ipv4(&self) -> bool { match *self { IpAddr::V4(_) => true, @@ -219,8 +217,6 @@ impl IpAddr { /// # Examples /// /// ``` - /// #![feature(ipaddr_checker)] - /// /// use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; /// /// fn main() { @@ -229,7 +225,7 @@ impl IpAddr { /// true); /// } /// ``` - #[unstable(feature = "ipaddr_checker", issue = "36949")] + #[stable(feature = "ipaddr_checker", since = "1.16.0")] pub fn is_ipv6(&self) -> bool { match *self { IpAddr::V4(_) => false, diff --git a/src/libstd/sys/windows/ext/process.rs b/src/libstd/sys/windows/ext/process.rs index 0a3221aeae6..1419a4af427 100644 --- a/src/libstd/sys/windows/ext/process.rs +++ b/src/libstd/sys/windows/ext/process.rs @@ -99,17 +99,17 @@ impl ExitStatusExt for process::ExitStatus { } /// Windows-specific extensions to the `std::process::Command` builder -#[unstable(feature = "windows_process_extensions", issue = "37827")] +#[stable(feature = "windows_process_extensions", since = "1.16.0")] pub trait CommandExt { /// Sets the [process creation flags][1] to be passed to `CreateProcess`. /// /// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`. /// [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx - #[unstable(feature = "windows_process_extensions", issue = "37827")] + #[stable(feature = "windows_process_extensions", since = "1.16.0")] fn creation_flags(&mut self, flags: u32) -> &mut process::Command; } -#[unstable(feature = "windows_process_extensions", issue = "37827")] +#[stable(feature = "windows_process_extensions", since = "1.16.0")] impl CommandExt for process::Command { fn creation_flags(&mut self, flags: u32) -> &mut process::Command { self.as_inner_mut().creation_flags(flags); diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 2c4e2bbff93..af7eaeb3106 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -154,14 +154,12 @@ impl Duration { /// Basic usage: /// /// ``` - /// #![feature(duration_checked_ops)] - /// /// use std::time::Duration; /// /// assert_eq!(Duration::new(0, 0).checked_add(Duration::new(0, 1)), Some(Duration::new(0, 1))); /// assert_eq!(Duration::new(1, 0).checked_add(Duration::new(std::u64::MAX, 0)), None); /// ``` - #[unstable(feature = "duration_checked_ops", issue = "35774")] + #[stable(feature = "duration_checked_ops", since = "1.16.0")] #[inline] pub fn checked_add(self, rhs: Duration) -> Option { if let Some(mut secs) = self.secs.checked_add(rhs.secs) { @@ -194,14 +192,12 @@ impl Duration { /// Basic usage: /// /// ``` - /// #![feature(duration_checked_ops)] - /// /// use std::time::Duration; /// /// assert_eq!(Duration::new(0, 1).checked_sub(Duration::new(0, 0)), Some(Duration::new(0, 1))); /// assert_eq!(Duration::new(0, 0).checked_sub(Duration::new(0, 1)), None); /// ``` - #[unstable(feature = "duration_checked_ops", issue = "35774")] + #[stable(feature = "duration_checked_ops", since = "1.16.0")] #[inline] pub fn checked_sub(self, rhs: Duration) -> Option { if let Some(mut secs) = self.secs.checked_sub(rhs.secs) { @@ -232,14 +228,12 @@ impl Duration { /// Basic usage: /// /// ``` - /// #![feature(duration_checked_ops)] - /// /// use std::time::Duration; /// /// assert_eq!(Duration::new(0, 500_000_001).checked_mul(2), Some(Duration::new(1, 2))); /// assert_eq!(Duration::new(std::u64::MAX - 1, 0).checked_mul(2), None); /// ``` - #[unstable(feature = "duration_checked_ops", issue = "35774")] + #[stable(feature = "duration_checked_ops", since = "1.16.0")] #[inline] pub fn checked_mul(self, rhs: u32) -> Option { // Multiply nanoseconds as u64, because it cannot overflow that way. @@ -269,15 +263,13 @@ impl Duration { /// Basic usage: /// /// ``` - /// #![feature(duration_checked_ops)] - /// /// use std::time::Duration; /// /// assert_eq!(Duration::new(2, 0).checked_div(2), Some(Duration::new(1, 0))); /// assert_eq!(Duration::new(1, 0).checked_div(2), Some(Duration::new(0, 500_000_000))); /// assert_eq!(Duration::new(2, 0).checked_div(0), None); /// ``` - #[unstable(feature = "duration_checked_ops", issue = "35774")] + #[stable(feature = "duration_checked_ops", since = "1.16.0")] #[inline] pub fn checked_div(self, rhs: u32) -> Option { if rhs != 0 { -- cgit 1.4.1-3-g733a5 From 94687aaf58c9a935ed3efb84d0f3b60e00342dcc Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Mon, 30 Jan 2017 21:38:13 -0500 Subject: Removes FIXMEs related to #22405 --- src/libcoretest/hash/mod.rs | 1 - src/libcoretest/iter.rs | 2 -- .../auxiliary/macro_crate_test.rs | 2 -- .../borrowck/borrowck-borrowed-uniq-rvalue.rs | 1 - src/test/compile-fail/cross-borrow-trait.rs | 1 - src/test/compile-fail/dst-bad-assign-2.rs | 1 - src/test/compile-fail/dst-bad-assign.rs | 1 - src/test/compile-fail/issue-10291.rs | 1 - src/test/compile-fail/issue-11515.rs | 1 - src/test/compile-fail/issue-17441.rs | 1 - src/test/compile-fail/issue-17651.rs | 1 - src/test/compile-fail/issue-18783.rs | 2 -- src/test/compile-fail/issue-3763.rs | 2 -- src/test/compile-fail/issue-4335.rs | 1 - src/test/compile-fail/map-types.rs | 1 - ...ves-based-on-type-no-recursive-stack-closure.rs | 1 - .../region-object-lifetime-in-coercion.rs | 2 -- .../regions-close-associated-type-into-object.rs | 2 -- .../regions-close-param-into-object.rs | 2 -- src/test/compile-fail/regions-nested-fns.rs | 2 -- .../compile-fail/regions-proc-bound-capture.rs | 2 -- src/test/compile-fail/regions-steal-closure.rs | 1 - .../compile-fail/trait-coercion-generic-bad.rs | 1 - .../compile-fail/trait-coercion-generic-regions.rs | 1 - .../compile-fail/unboxed-closure-illegal-move.rs | 2 -- src/test/compile-fail/unique-pinned-nocopy.rs | 1 - .../auxiliary/macro_crate_test.rs | 3 -- .../run-pass-fulldeps/auxiliary/plugin_args.rs | 1 - .../deriving-encodable-decodable-box.rs | 1 - src/test/run-pass-valgrind/dst-dtor-1.rs | 1 - src/test/run-pass-valgrind/dst-dtor-2.rs | 1 - .../associated-types-doubleendediterator-object.rs | 1 - src/test/run-pass/coerce-expect-unsized.rs | 9 ------ src/test/run-pass/deriving-default-box.rs | 1 - src/test/run-pass/deriving-eq-ord-boxed-slice.rs | 1 - src/test/run-pass/dst-deref-mut.rs | 1 - src/test/run-pass/dst-deref.rs | 1 - src/test/run-pass/dst-struct.rs | 1 - src/test/run-pass/dst-trait.rs | 1 - src/test/run-pass/empty-allocation-non-null.rs | 3 -- src/test/run-pass/hashmap-memory.rs | 1 - src/test/run-pass/hrtb-precedence-of-plus.rs | 1 - src/test/run-pass/issue-11205.rs | 2 -- src/test/run-pass/issue-11677.rs | 1 - src/test/run-pass/issue-12744.rs | 1 - src/test/run-pass/issue-13808.rs | 1 - src/test/run-pass/issue-14589.rs | 2 -- src/test/run-pass/issue-14919.rs | 1 - src/test/run-pass/issue-16668.rs | 1 - src/test/run-pass/issue-17734.rs | 2 -- src/test/run-pass/issue-20575.rs | 1 - src/test/run-pass/issue-3052.rs | 1 - src/test/run-pass/issue-3609.rs | 1 - src/test/run-pass/newlambdas-ret-infer.rs | 1 - src/test/run-pass/newlambdas-ret-infer2.rs | 1 - src/test/run-pass/regions-fn-subtyping.rs | 2 -- ...d-regions-on-closures-to-inference-variables.rs | 1 - src/test/run-pass/show-boxed-slice.rs | 1 - src/test/run-pass/trait-bounds-in-arc.rs | 1 - src/test/run-pass/trait-coercion-generic.rs | 1 - src/test/run-pass/trait-coercion.rs | 2 -- ...unboxed-closures-call-sugar-object-autoderef.rs | 1 - .../run-pass/unboxed-closures-call-sugar-object.rs | 1 - .../ui/span/borrowck-call-is-borrow-issue-12224.rs | 2 -- .../borrowck-call-is-borrow-issue-12224.stderr | 32 +++++++++++----------- 65 files changed, 16 insertions(+), 108 deletions(-) (limited to 'src/libcoretest') diff --git a/src/libcoretest/hash/mod.rs b/src/libcoretest/hash/mod.rs index 0d124338133..53ac17c052f 100644 --- a/src/libcoretest/hash/mod.rs +++ b/src/libcoretest/hash/mod.rs @@ -66,7 +66,6 @@ fn test_writer_hasher() { assert_eq!(hash(& s), 97 + 0xFF); let cs: &[u8] = &[1, 2, 3]; assert_eq!(hash(& cs), 9); - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let cs: Box<[u8]> = Box::new([1, 2, 3]); assert_eq!(hash(& cs), 9); diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index 99d31293053..6d02f76c33d 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -700,7 +700,6 @@ fn test_collect() { #[test] fn test_all() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let v: Box<[isize]> = Box::new([1, 2, 3, 4, 5]); assert!(v.iter().all(|&x| x < 10)); assert!(!v.iter().all(|&x| x % 2 == 0)); @@ -710,7 +709,6 @@ fn test_all() { #[test] fn test_any() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let v: Box<[isize]> = Box::new([1, 2, 3, 4, 5]); assert!(v.iter().any(|&x| x < 10)); assert!(v.iter().any(|&x| x % 2 == 0)); diff --git a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs b/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs index dc88bfc4059..61b1a0a0b4d 100644 --- a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs +++ b/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs @@ -36,11 +36,9 @@ pub fn plugin_registrar(reg: &mut Registry) { reg.register_macro("identity", expand_identity); reg.register_syntax_extension( Symbol::intern("into_multi_foo"), - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. MultiModifier(Box::new(expand_into_foo_multi))); reg.register_syntax_extension( Symbol::intern("duplicate"), - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. MultiDecorator(Box::new(expand_duplicate))); } diff --git a/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs b/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs index e4eca7e7ece..f58eca7c8ae 100644 --- a/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs +++ b/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs @@ -17,7 +17,6 @@ use std::collections::HashMap; fn main() { let tmp: Box<_>; let mut buggy_map: HashMap = HashMap::new(); - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough // but it is ok if we use a temporary diff --git a/src/test/compile-fail/cross-borrow-trait.rs b/src/test/compile-fail/cross-borrow-trait.rs index f389380584b..e5afccb9cf3 100644 --- a/src/test/compile-fail/cross-borrow-trait.rs +++ b/src/test/compile-fail/cross-borrow-trait.rs @@ -16,7 +16,6 @@ trait Trait { fn foo(&self) {} } impl Trait for Foo {} pub fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let x: Box = Box::new(Foo); let _y: &Trait = x; //~ ERROR mismatched types //~| expected type `&Trait` diff --git a/src/test/compile-fail/dst-bad-assign-2.rs b/src/test/compile-fail/dst-bad-assign-2.rs index 241fabf053c..10c8f1eed00 100644 --- a/src/test/compile-fail/dst-bad-assign-2.rs +++ b/src/test/compile-fail/dst-bad-assign-2.rs @@ -41,7 +41,6 @@ impl ToBar for Bar1 { pub fn main() { // Assignment. let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = *z; //~^ ERROR `ToBar: std::marker::Sized` is not satisfied diff --git a/src/test/compile-fail/dst-bad-assign.rs b/src/test/compile-fail/dst-bad-assign.rs index 9e71ad24177..4f7d07600ad 100644 --- a/src/test/compile-fail/dst-bad-assign.rs +++ b/src/test/compile-fail/dst-bad-assign.rs @@ -41,7 +41,6 @@ impl ToBar for Bar1 { pub fn main() { // Assignment. let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box = Box::new(Bar1 {f: 36}); f5.ptr = Bar1 {f: 36}; //~^ ERROR mismatched types diff --git a/src/test/compile-fail/issue-10291.rs b/src/test/compile-fail/issue-10291.rs index 43255db2ff3..d4e7dc7e9a3 100644 --- a/src/test/compile-fail/issue-10291.rs +++ b/src/test/compile-fail/issue-10291.rs @@ -9,7 +9,6 @@ // except according to those terms. fn test<'x>(x: &'x isize) { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { x //~ ERROR E0312 })); diff --git a/src/test/compile-fail/issue-11515.rs b/src/test/compile-fail/issue-11515.rs index f682d618ab6..7afb8314ea6 100644 --- a/src/test/compile-fail/issue-11515.rs +++ b/src/test/compile-fail/issue-11515.rs @@ -15,7 +15,6 @@ struct Test { } fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let closure: Box = Box::new(|| ()); let test = box Test { func: closure }; //~ ERROR mismatched types } diff --git a/src/test/compile-fail/issue-17441.rs b/src/test/compile-fail/issue-17441.rs index 45ab9903532..bddc9c13815 100644 --- a/src/test/compile-fail/issue-17441.rs +++ b/src/test/compile-fail/issue-17441.rs @@ -13,7 +13,6 @@ fn main() { //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` //~^^ HELP consider using an implicit coercion to `&[usize]` instead - // FIXME (#22405): Replace `std::boxed::Box::new` with `box` here when/if possible. let _bar = Box::new(1_usize) as std::fmt::Debug; //~^ ERROR cast to unsized type: `std::boxed::Box` as `std::fmt::Debug` //~^^ HELP try casting to a `Box` instead diff --git a/src/test/compile-fail/issue-17651.rs b/src/test/compile-fail/issue-17651.rs index 3ea136aca4b..4996da057dd 100644 --- a/src/test/compile-fail/issue-17651.rs +++ b/src/test/compile-fail/issue-17651.rs @@ -12,7 +12,6 @@ // and rejected. fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. (|| Box::new(*(&[0][..])))(); //~^ ERROR `[{integer}]: std::marker::Sized` is not satisfied } diff --git a/src/test/compile-fail/issue-18783.rs b/src/test/compile-fail/issue-18783.rs index 5eb3c439df2..9a7b3781f1e 100644 --- a/src/test/compile-fail/issue-18783.rs +++ b/src/test/compile-fail/issue-18783.rs @@ -10,8 +10,6 @@ use std::cell::RefCell; -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - fn main() { let mut y = 1; let c = RefCell::new(vec![]); diff --git a/src/test/compile-fail/issue-3763.rs b/src/test/compile-fail/issue-3763.rs index 085b4e76afb..851f5dfeabe 100644 --- a/src/test/compile-fail/issue-3763.rs +++ b/src/test/compile-fail/issue-3763.rs @@ -25,13 +25,11 @@ fn main() { let _woohoo = (&my_struct).priv_field; //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _woohoo = (Box::new(my_struct)).priv_field; //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private (&my_struct).happyfun(); //~ ERROR method `happyfun` is private - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private let nope = my_struct.priv_field; //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/compile-fail/issue-4335.rs index 51f5fc5ee98..c5aae894c3e 100644 --- a/src/test/compile-fail/issue-4335.rs +++ b/src/test/compile-fail/issue-4335.rs @@ -13,7 +13,6 @@ fn id(t: T) -> T { t } fn f<'r, T>(v: &'r T) -> Box T + 'r> { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. id(Box::new(|| *v)) //~^ ERROR E0373 //~| NOTE `v` is borrowed here diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index eaafc312379..9dcf902a69f 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -24,7 +24,6 @@ impl Map for HashMap {} fn main() { let x: Box> = box HashMap::new(); let x: Box> = x; - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let y: Box> = Box::new(x); //~^ ERROR `std::boxed::Box>: Map` is not satisfied } diff --git a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs index df9a3519d5d..d5296065999 100644 --- a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs @@ -38,7 +38,6 @@ fn innocent_looking_victim() { } fn conspirator(mut f: F) where F: FnMut(&mut R, bool) { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let mut r = R {c: Box::new(f)}; f(&mut r, false) //~ ERROR use of moved value } diff --git a/src/test/compile-fail/region-object-lifetime-in-coercion.rs b/src/test/compile-fail/region-object-lifetime-in-coercion.rs index f95ee405895..687b2c344a3 100644 --- a/src/test/compile-fail/region-object-lifetime-in-coercion.rs +++ b/src/test/compile-fail/region-object-lifetime-in-coercion.rs @@ -14,8 +14,6 @@ trait Foo {} impl<'a> Foo for &'a [u8] {} -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - fn a(v: &[u8]) -> Box { let x: Box = Box::new(v); //~^ ERROR cannot infer an appropriate lifetime due to conflicting diff --git a/src/test/compile-fail/regions-close-associated-type-into-object.rs b/src/test/compile-fail/regions-close-associated-type-into-object.rs index 61897aac187..6b88abfca6c 100644 --- a/src/test/compile-fail/regions-close-associated-type-into-object.rs +++ b/src/test/compile-fail/regions-close-associated-type-into-object.rs @@ -10,8 +10,6 @@ #![feature(box_syntax)] -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - trait X {} trait Iter { diff --git a/src/test/compile-fail/regions-close-param-into-object.rs b/src/test/compile-fail/regions-close-param-into-object.rs index 7324d4a4a0e..c9063405bd7 100644 --- a/src/test/compile-fail/regions-close-param-into-object.rs +++ b/src/test/compile-fail/regions-close-param-into-object.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - trait X { fn foo(&self) {} } fn p1(v: T) -> Box diff --git a/src/test/compile-fail/regions-nested-fns.rs b/src/test/compile-fail/regions-nested-fns.rs index 5ef2a701a60..010b7d17688 100644 --- a/src/test/compile-fail/regions-nested-fns.rs +++ b/src/test/compile-fail/regions-nested-fns.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - fn ignore(t: T) {} fn nested<'x>(x: &'x isize) { diff --git a/src/test/compile-fail/regions-proc-bound-capture.rs b/src/test/compile-fail/regions-proc-bound-capture.rs index 48b6e8b773f..fb726e31af5 100644 --- a/src/test/compile-fail/regions-proc-bound-capture.rs +++ b/src/test/compile-fail/regions-proc-bound-capture.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { // This is legal, because the region bound on `proc` // states that it captures `x`. diff --git a/src/test/compile-fail/regions-steal-closure.rs b/src/test/compile-fail/regions-steal-closure.rs index 59fe1ce3af1..7ca63b9896f 100644 --- a/src/test/compile-fail/regions-steal-closure.rs +++ b/src/test/compile-fail/regions-steal-closure.rs @@ -21,7 +21,6 @@ fn box_it<'r>(x: Box) -> closure_box<'r> { fn main() { let mut cl_box = { let mut i = 3; - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough }; cl_box.cl.call_mut(()); diff --git a/src/test/compile-fail/trait-coercion-generic-bad.rs b/src/test/compile-fail/trait-coercion-generic-bad.rs index dd64085f6f6..3839e90ed9f 100644 --- a/src/test/compile-fail/trait-coercion-generic-bad.rs +++ b/src/test/compile-fail/trait-coercion-generic-bad.rs @@ -23,7 +23,6 @@ impl Trait<&'static str> for Struct { } fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let s: Box> = Box::new(Struct { person: "Fred" }); //~^ ERROR `Struct: Trait` is not satisfied s.f(1); diff --git a/src/test/compile-fail/trait-coercion-generic-regions.rs b/src/test/compile-fail/trait-coercion-generic-regions.rs index 9ba017e150e..18d3ded77f8 100644 --- a/src/test/compile-fail/trait-coercion-generic-regions.rs +++ b/src/test/compile-fail/trait-coercion-generic-regions.rs @@ -25,6 +25,5 @@ impl Trait<&'static str> for Struct { fn main() { let person = "Fred".to_string(); let person: &str = &person; //~ ERROR `person` does not live long enough - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let s: Box> = Box::new(Struct { person: person }); } diff --git a/src/test/compile-fail/unboxed-closure-illegal-move.rs b/src/test/compile-fail/unboxed-closure-illegal-move.rs index 564b1b4669f..427be560760 100644 --- a/src/test/compile-fail/unboxed-closure-illegal-move.rs +++ b/src/test/compile-fail/unboxed-closure-illegal-move.rs @@ -18,8 +18,6 @@ fn to_fn>(f: F) -> F { f } fn to_fn_mut>(f: F) -> F { f } fn to_fn_once>(f: F) -> F { f } -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - fn main() { // By-ref cases { diff --git a/src/test/compile-fail/unique-pinned-nocopy.rs b/src/test/compile-fail/unique-pinned-nocopy.rs index d971940db38..c09feec1d4a 100644 --- a/src/test/compile-fail/unique-pinned-nocopy.rs +++ b/src/test/compile-fail/unique-pinned-nocopy.rs @@ -18,7 +18,6 @@ impl Drop for r { } fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let i = Box::new(r { b: true }); let _j = i.clone(); //~ ERROR no method named `clone` found println!("{:?}", i); diff --git a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs index 29cc6b7db94..aa2f1626a6a 100644 --- a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs +++ b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs @@ -38,15 +38,12 @@ pub fn plugin_registrar(reg: &mut Registry) { reg.register_macro("identity", expand_identity); reg.register_syntax_extension( Symbol::intern("into_multi_foo"), - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. MultiModifier(Box::new(expand_into_foo_multi))); reg.register_syntax_extension( Symbol::intern("duplicate"), - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. MultiDecorator(Box::new(expand_duplicate))); reg.register_syntax_extension( Symbol::intern("caller"), - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. MultiDecorator(Box::new(expand_caller))); } diff --git a/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs b/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs index ba2af77cdb2..3c8868f1664 100644 --- a/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs +++ b/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs @@ -48,6 +48,5 @@ impl TTMacroExpander for Expander { pub fn plugin_registrar(reg: &mut Registry) { let args = reg.args().to_owned(); reg.register_syntax_extension(Symbol::intern("plugin_args"), - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. NormalTT(Box::new(Expander { args: args, }), None, false)); } diff --git a/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs b/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs index 328cc134f3b..1573b080717 100644 --- a/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs +++ b/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs @@ -24,7 +24,6 @@ struct A { } fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let obj = A { foo: Box::new([true, false]) }; let s = json::encode(&obj).unwrap(); let obj2: A = json::decode(&s).unwrap(); diff --git a/src/test/run-pass-valgrind/dst-dtor-1.rs b/src/test/run-pass-valgrind/dst-dtor-1.rs index 995da8c73fa..4af642a106c 100644 --- a/src/test/run-pass-valgrind/dst-dtor-1.rs +++ b/src/test/run-pass-valgrind/dst-dtor-1.rs @@ -28,7 +28,6 @@ struct Fat { pub fn main() { { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _x: Box> = Box::>::new(Fat { f: Foo }); } unsafe { diff --git a/src/test/run-pass-valgrind/dst-dtor-2.rs b/src/test/run-pass-valgrind/dst-dtor-2.rs index 471169340d7..283b8202b35 100644 --- a/src/test/run-pass-valgrind/dst-dtor-2.rs +++ b/src/test/run-pass-valgrind/dst-dtor-2.rs @@ -25,7 +25,6 @@ struct Fat { pub fn main() { { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _x: Box> = Box::>::new(Fat { f: [Foo, Foo, Foo] }); } unsafe { diff --git a/src/test/run-pass/associated-types-doubleendediterator-object.rs b/src/test/run-pass/associated-types-doubleendediterator-object.rs index dd194447740..0a6135080bb 100644 --- a/src/test/run-pass/associated-types-doubleendediterator-object.rs +++ b/src/test/run-pass/associated-types-doubleendediterator-object.rs @@ -26,7 +26,6 @@ fn pairwise_sub(mut t: Box>) -> isize { fn main() { let v = vec![1, 2, 3, 4, 5, 6]; - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let r = pairwise_sub(Box::new(v.into_iter())); assert_eq!(r, 9); } diff --git a/src/test/run-pass/coerce-expect-unsized.rs b/src/test/run-pass/coerce-expect-unsized.rs index e4792e7936b..a074aea9caa 100644 --- a/src/test/run-pass/coerce-expect-unsized.rs +++ b/src/test/run-pass/coerce-expect-unsized.rs @@ -19,15 +19,6 @@ use std::rc::Rc; // rvalue expressions to be unsized. See #20169 for more information. pub fn main() { - // FIXME #22405: We cannot infer the type `Box<[isize; k]>` for - // the r-value expression from the context `Box<[isize]>`, and - // therefore the `box EXPR` desugaring breaks down. - // - // One could reasonably claim that the `box EXPR` desugaring is - // effectively regressing half of Issue #20169. Hopefully we will - // eventually fix that, at which point the `Box::new` calls below - // should be replaced wth uses of `box`. - let _: Box<[isize]> = Box::new({ [1, 2, 3] }); let _: Box<[isize]> = Box::new(if true { [1, 2, 3] } else { [1, 3, 4] }); let _: Box<[isize]> = Box::new(match true { true => [1, 2, 3], false => [1, 3, 4] }); diff --git a/src/test/run-pass/deriving-default-box.rs b/src/test/run-pass/deriving-default-box.rs index dc31e71aad8..c9e5b014da3 100644 --- a/src/test/run-pass/deriving-default-box.rs +++ b/src/test/run-pass/deriving-default-box.rs @@ -21,7 +21,6 @@ struct A { pub fn main() { let a: A = Default::default(); - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let b: Box<[_]> = Box::<[bool; 0]>::new([]); assert_eq!(a.foo, b); } diff --git a/src/test/run-pass/deriving-eq-ord-boxed-slice.rs b/src/test/run-pass/deriving-eq-ord-boxed-slice.rs index f490cca6a69..16c49065008 100644 --- a/src/test/run-pass/deriving-eq-ord-boxed-slice.rs +++ b/src/test/run-pass/deriving-eq-ord-boxed-slice.rs @@ -12,7 +12,6 @@ struct Foo(Box<[u8]>); pub fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let a = Foo(Box::new([0, 1, 2])); let b = Foo(Box::new([0, 1, 2])); assert_eq!(a, b); diff --git a/src/test/run-pass/dst-deref-mut.rs b/src/test/run-pass/dst-deref-mut.rs index 0666e41738e..9fb4635765c 100644 --- a/src/test/run-pass/dst-deref-mut.rs +++ b/src/test/run-pass/dst-deref-mut.rs @@ -39,7 +39,6 @@ pub fn foo(arr: &mut Arr) { } fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let mut a = Arr { ptr: Box::new([1, 2, 3]) }; foo(&mut a); } diff --git a/src/test/run-pass/dst-deref.rs b/src/test/run-pass/dst-deref.rs index 957ed13a3d8..4a143873e6e 100644 --- a/src/test/run-pass/dst-deref.rs +++ b/src/test/run-pass/dst-deref.rs @@ -34,7 +34,6 @@ pub fn foo(arr: &Arr) { } fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let a = Arr { ptr: Box::new([1, 2, 3]) }; foo(&a); } diff --git a/src/test/run-pass/dst-struct.rs b/src/test/run-pass/dst-struct.rs index 94efa7a256b..56199c1aa61 100644 --- a/src/test/run-pass/dst-struct.rs +++ b/src/test/run-pass/dst-struct.rs @@ -127,7 +127,6 @@ pub fn main() { let f2 : Box> = f1; foo(&*f2); - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let f3 : Box> = Box::>::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }); foo(&*f3); diff --git a/src/test/run-pass/dst-trait.rs b/src/test/run-pass/dst-trait.rs index 9d12a4a34b7..d8d7d9a28bf 100644 --- a/src/test/run-pass/dst-trait.rs +++ b/src/test/run-pass/dst-trait.rs @@ -97,7 +97,6 @@ pub fn main() { // &* // - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let f7: Box = Box::new(Bar1 {f :42}); bar(&*f7); diff --git a/src/test/run-pass/empty-allocation-non-null.rs b/src/test/run-pass/empty-allocation-non-null.rs index af6e321e40a..3dbe7da6ac7 100644 --- a/src/test/run-pass/empty-allocation-non-null.rs +++ b/src/test/run-pass/empty-allocation-non-null.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - - pub fn main() { assert!(Some(Box::new(())).is_some()); diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 2306fa9afa2..bd90ce683c4 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -62,7 +62,6 @@ mod map_reduce { } let ctrl_clone = ctrl.clone(); - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. ::map(input, Box::new(|a,b| emit(&mut intermediates, ctrl.clone(), a, b))); ctrl_clone.send(ctrl_proto::mapper_done).unwrap(); } diff --git a/src/test/run-pass/hrtb-precedence-of-plus.rs b/src/test/run-pass/hrtb-precedence-of-plus.rs index d93e52a8f5f..516278df178 100644 --- a/src/test/run-pass/hrtb-precedence-of-plus.rs +++ b/src/test/run-pass/hrtb-precedence-of-plus.rs @@ -17,7 +17,6 @@ // cause a compilation error. Issue #18772. fn adder(y: isize) -> Box isize + 'static> { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. Box::new(move |x| y + x) } diff --git a/src/test/run-pass/issue-11205.rs b/src/test/run-pass/issue-11205.rs index 679d494a473..25c66bf8d48 100644 --- a/src/test/run-pass/issue-11205.rs +++ b/src/test/run-pass/issue-11205.rs @@ -12,8 +12,6 @@ #![allow(dead_code)] -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - trait Foo { fn dummy(&self) { } } impl Foo for isize {} fn foo(_: [&Foo; 2]) {} diff --git a/src/test/run-pass/issue-11677.rs b/src/test/run-pass/issue-11677.rs index d4244d44439..62da3b14675 100644 --- a/src/test/run-pass/issue-11677.rs +++ b/src/test/run-pass/issue-11677.rs @@ -27,6 +27,5 @@ impl X for F { } fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. S {f: Box::new(F), g: Box::new(F) }; } diff --git a/src/test/run-pass/issue-12744.rs b/src/test/run-pass/issue-12744.rs index 56d1d3599c7..aec45216b1b 100644 --- a/src/test/run-pass/issue-12744.rs +++ b/src/test/run-pass/issue-12744.rs @@ -9,7 +9,6 @@ // except according to those terms. fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. fn test() -> Box { Box::new(1) } println!("{:?}", test()) } diff --git a/src/test/run-pass/issue-13808.rs b/src/test/run-pass/issue-13808.rs index c85c0117581..ccdfa0646c6 100644 --- a/src/test/run-pass/issue-13808.rs +++ b/src/test/run-pass/issue-13808.rs @@ -16,7 +16,6 @@ struct Foo<'a> { impl<'a> Foo<'a> { fn new(listener: F) -> Foo<'a> where F: FnMut() + 'a { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. Foo { listener: Box::new(listener) } } } diff --git a/src/test/run-pass/issue-14589.rs b/src/test/run-pass/issue-14589.rs index b0893e21af7..8aaa24e991e 100644 --- a/src/test/run-pass/issue-14589.rs +++ b/src/test/run-pass/issue-14589.rs @@ -11,8 +11,6 @@ // All 3 expressions should work in that the argument gets // coerced to a trait object -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - // pretty-expanded FIXME #23616 fn main() { diff --git a/src/test/run-pass/issue-14919.rs b/src/test/run-pass/issue-14919.rs index d3c9fe9161c..df5d62e7699 100644 --- a/src/test/run-pass/issue-14919.rs +++ b/src/test/run-pass/issue-14919.rs @@ -31,7 +31,6 @@ trait IntoMatcher<'a, T> { impl<'a, 'b, F> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for F where F: FnMut(char) -> bool + 'b { fn into_matcher(self, s: &'a str) -> CharPredMatcher<'a, 'b> { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. CharPredMatcher { str: s, pred: Box::new(self), diff --git a/src/test/run-pass/issue-16668.rs b/src/test/run-pass/issue-16668.rs index 18861feb199..5613211b31d 100644 --- a/src/test/run-pass/issue-16668.rs +++ b/src/test/run-pass/issue-16668.rs @@ -16,7 +16,6 @@ struct Parser<'a, I, O> { impl<'a, I: 'a, O: 'a> Parser<'a, I, O> { fn compose(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. Parser { parse: Box::new(move |x: I| { match (self.parse)(x) { diff --git a/src/test/run-pass/issue-17734.rs b/src/test/run-pass/issue-17734.rs index 0fc8eea778d..8178c1fd7c8 100644 --- a/src/test/run-pass/issue-17734.rs +++ b/src/test/run-pass/issue-17734.rs @@ -17,8 +17,6 @@ fn f(s: Box) -> Box { fn main() { // There is currently no safe way to construct a `Box`, so improvise - // - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let box_arr: Box<[u8]> = Box::new(['h' as u8, 'e' as u8, 'l' as u8, 'l' as u8, 'o' as u8]); let box_str: Box = unsafe { std::mem::transmute(box_arr) }; assert_eq!(&*box_str, "hello"); diff --git a/src/test/run-pass/issue-20575.rs b/src/test/run-pass/issue-20575.rs index e73492e7a7e..7db7e3b28e8 100644 --- a/src/test/run-pass/issue-20575.rs +++ b/src/test/run-pass/issue-20575.rs @@ -13,7 +13,6 @@ // pretty-expanded FIXME #23616 fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let functions: [Box Option<()>>; 1] = [Box::new(|| None)]; let _: Option> = functions.iter().map(|f| (*f)()).collect(); diff --git a/src/test/run-pass/issue-3052.rs b/src/test/run-pass/issue-3052.rs index 8f013ee4f3a..3b56b2e28ff 100644 --- a/src/test/run-pass/issue-3052.rs +++ b/src/test/run-pass/issue-3052.rs @@ -13,7 +13,6 @@ type Connection = Box) + 'static>; fn f() -> Option { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let mock_connection: Connection = Box::new(|_| {}); Some(mock_connection) } diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index 61de3c6385e..d1bf7e066cb 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -26,7 +26,6 @@ fn foo(name: String, samples_chan: Sender) { thread::spawn(move|| { let mut samples_chan = samples_chan; - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let callback: SamplesFn = Box::new(move |buffer| { for i in 0..buffer.len() { println!("{}: {}", i, buffer[i]) diff --git a/src/test/run-pass/newlambdas-ret-infer.rs b/src/test/run-pass/newlambdas-ret-infer.rs index 543dbb36b28..428eed0787a 100644 --- a/src/test/run-pass/newlambdas-ret-infer.rs +++ b/src/test/run-pass/newlambdas-ret-infer.rs @@ -11,7 +11,6 @@ // Test that the lambda kind is inferred correctly as a return // expression -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. // pretty-expanded FIXME #23616 fn unique() -> Box { return Box::new(|| ()); } diff --git a/src/test/run-pass/newlambdas-ret-infer2.rs b/src/test/run-pass/newlambdas-ret-infer2.rs index e8297173a58..439ea3f2b57 100644 --- a/src/test/run-pass/newlambdas-ret-infer2.rs +++ b/src/test/run-pass/newlambdas-ret-infer2.rs @@ -11,7 +11,6 @@ // Test that the lambda kind is inferred correctly as a return // expression -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. // pretty-expanded FIXME #23616 fn unique() -> Box { Box::new(|| ()) } diff --git a/src/test/run-pass/regions-fn-subtyping.rs b/src/test/run-pass/regions-fn-subtyping.rs index fc42fbc714c..c7a4accff85 100644 --- a/src/test/run-pass/regions-fn-subtyping.rs +++ b/src/test/run-pass/regions-fn-subtyping.rs @@ -16,8 +16,6 @@ #![allow(unused_variables)] #![allow(unknown_features)] -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - // Should pass region checking. fn ok(f: Box) { // Here, g is a function that can accept a usize pointer with diff --git a/src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs b/src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs index 8eee54b3fec..ae4adbfb1f4 100644 --- a/src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs +++ b/src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs @@ -31,7 +31,6 @@ struct Foo<'a,'tcx:'a> { impl<'a,'tcx> Foo<'a,'tcx> { fn bother(&mut self) -> isize { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. self.elaborate_bounds(Box::new(|this| { // (*) Here: type of `this` is `&'f0 Foo<&'f1, '_2>`, // where `'f0` and `'f1` are fresh, free regions that diff --git a/src/test/run-pass/show-boxed-slice.rs b/src/test/run-pass/show-boxed-slice.rs index 03971668182..47d0737dfc4 100644 --- a/src/test/run-pass/show-boxed-slice.rs +++ b/src/test/run-pass/show-boxed-slice.rs @@ -12,6 +12,5 @@ struct Foo(Box<[u8]>); pub fn main() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. println!("{:?}", Foo(Box::new([0, 1, 2]))); } diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index 9877dffe9df..c58442aa58f 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -105,7 +105,6 @@ fn check_legs(arc: Arc>>) { } fn check_names(arc: Arc>>) { for pet in arc.iter() { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. pet.name(Box::new(|name| { assert!(name.as_bytes()[0] == 'a' as u8 && name.as_bytes()[1] == 'l' as u8); })) diff --git a/src/test/run-pass/trait-coercion-generic.rs b/src/test/run-pass/trait-coercion-generic.rs index f9a22d5ccec..40453262ddf 100644 --- a/src/test/run-pass/trait-coercion-generic.rs +++ b/src/test/run-pass/trait-coercion-generic.rs @@ -26,7 +26,6 @@ impl Trait<&'static str> for Struct { pub fn main() { let a = Struct { x: 1, y: 2 }; - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let b: Box> = Box::new(a); b.f("Mary"); let c: &Trait<&'static str> = &a; diff --git a/src/test/run-pass/trait-coercion.rs b/src/test/run-pass/trait-coercion.rs index d40d9c89f89..130c6ee7521 100644 --- a/src/test/run-pass/trait-coercion.rs +++ b/src/test/run-pass/trait-coercion.rs @@ -30,8 +30,6 @@ impl Trait for Struct { fn foo(mut a: Box) {} -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. - pub fn main() { let a = Struct { x: 1, y: 2 }; let b: Box = Box::new(a); diff --git a/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs b/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs index a92fb05306f..789d2237c54 100644 --- a/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs +++ b/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs @@ -15,7 +15,6 @@ use std::ops::FnMut; fn make_adder(x: isize) -> Boxisize + 'static> { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. Box::new(move |y| { x + y }) } diff --git a/src/test/run-pass/unboxed-closures-call-sugar-object.rs b/src/test/run-pass/unboxed-closures-call-sugar-object.rs index 5dd2343cfd1..e7307715471 100644 --- a/src/test/run-pass/unboxed-closures-call-sugar-object.rs +++ b/src/test/run-pass/unboxed-closures-call-sugar-object.rs @@ -13,7 +13,6 @@ use std::ops::FnMut; fn make_adder(x: isize) -> Boxisize + 'static> { - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. Box::new(move |y| { x + y }) } diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs index ba1ae64ec33..6264d111864 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs @@ -18,7 +18,6 @@ struct Test<'a> { f: Box } -// FIXME (#22405): Replace `Box::new` with `box` here when/if possible. fn call(mut f: F) where F: FnMut(Fn) { f(Box::new(|| { //~^ ERROR: cannot borrow `f` as mutable more than once @@ -58,7 +57,6 @@ fn test6() { fn test7() { fn foo(_: F) where F: FnMut(Box, isize) {} let mut f = |g: Box, b: isize| {}; - // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. f(Box::new(|a| { foo(f); //~^ ERROR cannot move `f` into closure because it is borrowed diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr index f2f0e027f01..58b3f205fe3 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -1,44 +1,44 @@ error[E0499]: cannot borrow `f` as mutable more than once at a time - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:23:16 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:22:16 | -23 | f(Box::new(|| { +22 | f(Box::new(|| { | - ^^ second mutable borrow occurs here | | | first mutable borrow occurs here -24 | //~^ ERROR: cannot borrow `f` as mutable more than once -25 | f((Box::new(|| {}))) +23 | //~^ ERROR: cannot borrow `f` as mutable more than once +24 | f((Box::new(|| {}))) | - borrow occurs due to use of `f` in closure -26 | })); +25 | })); | - first borrow ends here error: cannot borrow immutable borrowed content `*f` as mutable - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:36:5 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:35:5 | -35 | fn test2(f: &F) where F: FnMut() { +34 | fn test2(f: &F) where F: FnMut() { | -- use `&mut F` here to make mutable -36 | (*f)(); //~ ERROR: cannot borrow immutable borrowed content `*f` as mutable +35 | (*f)(); //~ ERROR: cannot borrow immutable borrowed content `*f` as mutable | ^^^^ cannot borrow as mutable error: cannot borrow immutable `Box` content `*f.f` as mutable - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:44:5 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:43:5 | -43 | fn test4(f: &Test) { +42 | fn test4(f: &Test) { | ----- use `&mut Test` here to make mutable -44 | f.f.call_mut(()) //~ ERROR: cannot borrow immutable `Box` content `*f.f` as mutable +43 | f.f.call_mut(()) //~ ERROR: cannot borrow immutable `Box` content `*f.f` as mutable | ^^^ cannot borrow as mutable error[E0504]: cannot move `f` into closure because it is borrowed - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:61:13 | -62 | f(Box::new(|a| { +60 | f(Box::new(|a| { | - borrow of `f` occurs here -63 | foo(f); +61 | foo(f); | ^ move into closure occurs here error[E0507]: cannot move out of captured outer variable in an `FnMut` closure - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:61:13 | -63 | foo(f); +61 | foo(f); | ^ cannot move out of captured outer variable in an `FnMut` closure error: aborting due to 5 previous errors -- cgit 1.4.1-3-g733a5