Remove the deprecated box(PLACE) syntax.

This commit is contained in:
Eduard Burtescu 2015-09-24 18:00:08 +03:00
parent 07ca1ab1ec
commit f293ea28b4
50 changed files with 117 additions and 282 deletions

View file

@ -22,5 +22,5 @@ pub trait i<T>
pub fn f<T>() -> Box<i<T>+'static> {
impl<T> i<T> for () { }
box() () as Box<i<T>+'static>
box () as Box<i<T>+'static>
}

View file

@ -23,8 +23,7 @@ fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
fn produce<T>() -> T { panic!(); }
fn inc(v: &mut Box<isize>) {
*v = box() (**v + 1);
//~^ WARN deprecated syntax
*v = box (**v + 1);
}
fn pre_freeze_cond() {

View file

@ -22,8 +22,7 @@ fn cond() -> bool { panic!() }
fn produce<T>() -> T { panic!(); }
fn inc(v: &mut Box<isize>) {
*v = box() (**v + 1);
//~^ WARN deprecated syntax
*v = box (**v + 1);
}
fn loop_overarching_alias_mut() {

View file

@ -23,8 +23,7 @@ fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
fn produce<T>() -> T { panic!(); }
fn inc(v: &mut Box<isize>) {
*v = box() (**v + 1);
//~^ WARN deprecated syntax
*v = box (**v + 1);
}
fn pre_freeze() {

View file

@ -22,8 +22,7 @@ impl Add for foo {
fn add(self, f: foo) -> foo {
let foo(box i) = self;
let foo(box j) = f;
foo(box() (i + j))
//~^ WARN deprecated syntax
foo(box (i + j))
}
}

View file

@ -19,8 +19,4 @@
fn main() {
let x = box 'c'; //~ ERROR box expression syntax is experimental
println!("x: {}", x);
let x = box () 'c'; //~ ERROR box expression syntax is experimental
//~^ WARN deprecated syntax
println!("x: {}", x);
}

View file

@ -19,10 +19,6 @@
fn main() {
use std::boxed::HEAP;
let x = box (HEAP) 'c'; //~ ERROR placement-in expression syntax is experimental
//~^ WARN deprecated syntax
println!("x: {}", x);
let x = in HEAP { 'c' }; //~ ERROR placement-in expression syntax is experimental
println!("x: {}", x);
}

View file

@ -12,8 +12,7 @@
#![feature(placement_in_syntax)]
fn main() {
box ( () ) 0;
in () { 0 };
//~^ ERROR: the trait `core::ops::Placer<_>` is not implemented
//~| ERROR: the trait `core::ops::Placer<_>` is not implemented
//~| WARN deprecated syntax
}

View file

@ -11,8 +11,7 @@
#![feature(box_syntax)]
fn dup(x: Box<isize>) -> Box<(Box<isize>,Box<isize>)> {
box() (x, x) //~ ERROR use of moved value
//~^ WARN deprecated syntax
box (x, x) //~ ERROR use of moved value
}
fn main() {
dup(box 3);

View file

@ -50,7 +50,7 @@ fn main() {
let stack_val_ref: &(i16, f32) = &stack_val;
let ref_to_unnamed: &(i16, f32) = &(-15, -20f32);
let unique_val: Box<(i16, f32)> = box() (-17, -22f32);
let unique_val: Box<(i16, f32)> = box (-17, -22f32);
let unique_val_ref: &(i16, f32) = &*unique_val;
zzz(); // #break

View file

@ -37,7 +37,7 @@
fn main() {
let a = box 1;
let b = box() (2, 3.5f64);
let b = box (2, 3.5f64);
zzz(); // #break
}

View file

@ -433,7 +433,7 @@ fn main() {
managed_box(&(34, 35));
borrowed_pointer(&(36, 37));
contained_borrowed_pointer((&38, 39));
unique_pointer(box() (40, 41, 42));
unique_pointer(box (40, 41, 42));
ref_binding((43, 44, 45));
ref_binding_in_tuple((46, (47, 48)));
ref_binding_in_struct(Struct { a: 49, b: 50 });

View file

@ -304,7 +304,7 @@ fn main() {
let (&cc, _) = (&38, 39);
// unique pointer
let box dd = box() (40, 41, 42);
let box dd = box (40, 41, 42);
// ref binding
let ref ee = (43, 44, 45);

View file

@ -1,19 +0,0 @@
// Copyright 2014 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z parse-only
fn main() {
box (1 + 1)
//~^ HELP try using `box ()` instead:
//~| SUGGESTION box () (1 + 1)
//~| WARN deprecated syntax
; //~ ERROR expected expression, found `;`
}

View file

@ -21,6 +21,6 @@ impl double for usize {
}
pub fn main() {
let x: Box<_> = box() (box 3usize as Box<double>);
let x: Box<_> = box (box 3usize as Box<double>);
assert_eq!(x.double(), 6);
}

View file

@ -24,7 +24,7 @@ extern crate crate_method_reexport_grrrrrrr2;
pub fn main() {
use crate_method_reexport_grrrrrrr2::rust::add;
use crate_method_reexport_grrrrrrr2::rust::cx;
let x: Box<_> = box () ();
let x: Box<_> = box ();
x.cx();
let y = ();
y.add("hi".to_string());

View file

@ -16,5 +16,5 @@
pub fn main() {
fn f() {
};
let _: Box<fn()> = box() (f as fn());
let _: Box<fn()> = box (f as fn());
}

View file

@ -28,7 +28,7 @@ pub fn main() {
// let y = box ({a: 4});
// let z = box ({a: 4} as it);
// let z = box ({a: true} as it);
let z: Box<_> = box () (box true as Box<it>);
let z: Box<_> = box (box true as Box<it>);
// x.f();
// y.f();
// (*z).f();

View file

@ -31,10 +31,10 @@ struct Structure {
}
pub fn main() {
let x: Box<isize> = box(HEAP) 2;
let x: Box<isize> = in HEAP { 2 };
let y: Box<isize> = box 2;
let b: Box<isize> = box()(1 + 2);
let c = box()(3 + 4);
let b: Box<isize> = box (1 + 2);
let c = box (3 + 4);
let s: Box<Structure> = box Structure {
x: 3,

View file

@ -83,7 +83,7 @@ impl<'s> Trait<'s> for (isize,isize) {
impl<'t> MakerTrait for Box<Trait<'t>+'static> {
fn mk() -> Box<Trait<'t>+'static> {
let tup: Box<(isize, isize)> = box() (4,5);
let tup: Box<(isize, isize)> = box (4,5);
tup as Box<Trait>
}
}

View file

@ -49,6 +49,6 @@ impl<V> Trait<u8,V> for () {
}
pub fn main() {
let a = box() () as Box<Trait<u8, u8>>;
let a = box () as Box<Trait<u8, u8>>;
assert_eq!(a.method(Type::Constant((1, 2))), 0);
}