Skip to content

Commit

Permalink
Removes FIXMEs related to #22405
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleywiser committed Feb 1, 2017
1 parent 8e9e055 commit 94687aa
Show file tree
Hide file tree
Showing 65 changed files with 16 additions and 108 deletions.
1 change: 0 additions & 1 deletion src/libcoretest/hash/mod.rs
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions src/libcoretest/iter.rs
Expand Up @@ -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));
Expand All @@ -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));
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs
Expand Up @@ -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)));
}

Expand Down
Expand Up @@ -17,7 +17,6 @@ use std::collections::HashMap;
fn main() {
let tmp: Box<_>;
let mut buggy_map: HashMap<usize, &usize> = 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
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/cross-borrow-trait.rs
Expand Up @@ -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<Trait> = Box::new(Foo);
let _y: &Trait = x; //~ ERROR mismatched types
//~| expected type `&Trait`
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/dst-bad-assign-2.rs
Expand Up @@ -41,7 +41,6 @@ impl ToBar for Bar1 {
pub fn main() {
// Assignment.
let f5: &mut Fat<ToBar> = &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<ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = *z;
//~^ ERROR `ToBar: std::marker::Sized` is not satisfied
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/dst-bad-assign.rs
Expand Up @@ -41,7 +41,6 @@ impl ToBar for Bar1 {
pub fn main() {
// Assignment.
let f5: &mut Fat<ToBar> = &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<ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/issue-10291.rs
Expand Up @@ -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::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
x //~ ERROR E0312
}));
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/issue-11515.rs
Expand Up @@ -15,7 +15,6 @@ struct Test {
}

fn main() {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let closure: Box<Fn()+'static> = Box::new(|| ());
let test = box Test { func: closure }; //~ ERROR mismatched types
}
1 change: 0 additions & 1 deletion src/test/compile-fail/issue-17441.rs
Expand Up @@ -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<usize>` as `std::fmt::Debug`
//~^^ HELP try casting to a `Box` instead
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/issue-17651.rs
Expand Up @@ -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
}
2 changes: 0 additions & 2 deletions src/test/compile-fail/issue-18783.rs
Expand Up @@ -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![]);
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/issue-3763.rs
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/issue-4335.rs
Expand Up @@ -13,7 +13,6 @@
fn id<T>(t: T) -> T { t }

fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
id(Box::new(|| *v))
//~^ ERROR E0373
//~| NOTE `v` is borrowed here
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/map-types.rs
Expand Up @@ -24,7 +24,6 @@ impl<K, V> Map<K, V> for HashMap<K, V> {}
fn main() {
let x: Box<HashMap<isize, isize>> = box HashMap::new();
let x: Box<Map<isize, isize>> = x;
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let y: Box<Map<usize, isize>> = Box::new(x);
//~^ ERROR `std::boxed::Box<Map<isize, isize>>: Map<usize, isize>` is not satisfied
}
Expand Up @@ -38,7 +38,6 @@ fn innocent_looking_victim() {
}

fn conspirator<F>(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
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/region-object-lifetime-in-coercion.rs
Expand Up @@ -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<Foo + 'static> {
let x: Box<Foo + 'static> = Box::new(v);
//~^ ERROR cannot infer an appropriate lifetime due to conflicting
Expand Down
Expand Up @@ -10,8 +10,6 @@

#![feature(box_syntax)]

// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.

trait X {}

trait Iter {
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/regions-close-param-into-object.rs
Expand Up @@ -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<T>(v: T) -> Box<X+'static>
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/regions-nested-fns.rs
Expand Up @@ -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: T) {}

fn nested<'x>(x: &'x isize) {
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/regions-proc-bound-capture.rs
Expand Up @@ -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<FnMut()->(isize) + 'a> {
// This is legal, because the region bound on `proc`
// states that it captures `x`.
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/regions-steal-closure.rs
Expand Up @@ -21,7 +21,6 @@ fn box_it<'r>(x: Box<FnMut() + 'r>) -> 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(());
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/trait-coercion-generic-bad.rs
Expand Up @@ -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<Trait<isize>> = Box::new(Struct { person: "Fred" });
//~^ ERROR `Struct: Trait<isize>` is not satisfied
s.f(1);
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/trait-coercion-generic-regions.rs
Expand Up @@ -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<Trait<&'static str>> = Box::new(Struct { person: person });
}
2 changes: 0 additions & 2 deletions src/test/compile-fail/unboxed-closure-illegal-move.rs
Expand Up @@ -18,8 +18,6 @@ fn to_fn<A,F:Fn<A>>(f: F) -> F { f }
fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }

// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.

fn main() {
// By-ref cases
{
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/unique-pinned-nocopy.rs
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs
Expand Up @@ -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)));
}

Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass-fulldeps/auxiliary/plugin_args.rs
Expand Up @@ -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));
}
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass-valgrind/dst-dtor-1.rs
Expand Up @@ -28,7 +28,6 @@ struct Fat<T: ?Sized> {

pub fn main() {
{
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo });
}
unsafe {
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass-valgrind/dst-dtor-2.rs
Expand Up @@ -25,7 +25,6 @@ struct Fat<T: ?Sized> {

pub fn main() {
{
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let _x: Box<Fat<[Foo]>> = Box::<Fat<[Foo; 3]>>::new(Fat { f: [Foo, Foo, Foo] });
}
unsafe {
Expand Down
Expand Up @@ -26,7 +26,6 @@ fn pairwise_sub(mut t: Box<DoubleEndedIterator<Item=isize>>) -> 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);
}
9 changes: 0 additions & 9 deletions src/test/run-pass/coerce-expect-unsized.rs
Expand Up @@ -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] });
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/deriving-default-box.rs
Expand Up @@ -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);
}
1 change: 0 additions & 1 deletion src/test/run-pass/deriving-eq-ord-boxed-slice.rs
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/dst-deref-mut.rs
Expand Up @@ -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);
}
1 change: 0 additions & 1 deletion src/test/run-pass/dst-deref.rs
Expand Up @@ -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);
}
1 change: 0 additions & 1 deletion src/test/run-pass/dst-struct.rs
Expand Up @@ -127,7 +127,6 @@ pub fn main() {
let f2 : Box<Fat<[isize]>> = f1;
foo(&*f2);

// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let f3 : Box<Fat<[isize]>> =
Box::<Fat<[_; 3]>>::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] });
foo(&*f3);
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/dst-trait.rs
Expand Up @@ -97,7 +97,6 @@ pub fn main() {

// &*
//
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let f7: Box<ToBar> = Box::new(Bar1 {f :42});
bar(&*f7);

Expand Down
3 changes: 0 additions & 3 deletions src/test/run-pass/empty-allocation-non-null.rs
Expand Up @@ -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());

Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/hashmap-memory.rs
Expand Up @@ -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();
}
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/hrtb-precedence-of-plus.rs
Expand Up @@ -17,7 +17,6 @@
// cause a compilation error. Issue #18772.

fn adder(y: isize) -> Box<Fn(isize) -> isize + 'static> {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
Box::new(move |x| y + x)
}

Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/issue-11205.rs
Expand Up @@ -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]) {}
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/issue-11677.rs
Expand Up @@ -27,6 +27,5 @@ impl X<isize> for F {
}

fn main() {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
S {f: Box::new(F), g: Box::new(F) };
}

0 comments on commit 94687aa

Please sign in to comment.