File tree 6 files changed +6
-6
lines changed
6 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ fn test_transmute() {
95
95
trait Foo { fn dummy ( & self ) { } }
96
96
impl Foo for isize { }
97
97
98
- let a = box 100isize as Box < Foo > ;
98
+ let a = Box :: new ( 100isize ) as Box < Foo > ;
99
99
unsafe {
100
100
let x: :: core:: raw:: TraitObject = transmute ( a) ;
101
101
assert ! ( * ( x. data as * const isize ) == 100 ) ;
Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ fn test_collect() {
234
234
235
235
// test that it does not take more elements than it needs
236
236
let mut functions: [ Box < Fn ( ) -> Option < ( ) > > ; 3 ] =
237
- [ box || Some ( ( ) ) , box || None , box || panic ! ( ) ] ;
237
+ [ Box :: new ( || Some ( ( ) ) ) , Box :: new ( || None ) , Box :: new ( || panic ! ( ) ) ] ;
238
238
239
239
let v: Option < Vec < ( ) > > = functions. iter_mut ( ) . map ( |f| ( * f) ( ) ) . collect ( ) ;
240
240
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ fn test_collect() {
80
80
81
81
// test that it does not take more elements than it needs
82
82
let mut functions: [ Box < Fn ( ) -> Result < ( ) , isize > > ; 3 ] =
83
- [ box || Ok ( ( ) ) , box || Err ( 1 ) , box || panic ! ( ) ] ;
83
+ [ Box :: new ( || Ok ( ( ) ) ) , Box :: new ( || Err ( 1 ) ) , Box :: new ( || panic ! ( ) ) ] ;
84
84
85
85
let v: Result < Vec < ( ) > , isize > = functions. iter_mut ( ) . map ( |f| ( * f) ( ) ) . collect ( ) ;
86
86
assert ! ( v == Err ( 1 ) ) ;
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ impl Emitter for ExpectErrorEmitter {
92
92
93
93
fn errors ( msgs : & [ & str ] ) -> ( Box < Emitter +Send > , usize ) {
94
94
let v = msgs. iter ( ) . map ( |m| m. to_string ( ) ) . collect ( ) ;
95
- ( box ExpectErrorEmitter { messages : v } as Box < Emitter +Send > , msgs. len ( ) )
95
+ ( Box :: new ( ExpectErrorEmitter { messages : v } ) as Box < Emitter +Send > , msgs. len ( ) )
96
96
}
97
97
98
98
fn test_env < F > ( source_string : & str ,
Original file line number Diff line number Diff line change @@ -967,7 +967,7 @@ mod tests {
967
967
#[ test]
968
968
fn test_try_panic_message_any ( ) {
969
969
match thread:: spawn ( move || {
970
- panic ! ( box 413u16 as Box <Any + Send >) ;
970
+ panic ! ( Box :: new ( 413u16 ) as Box <Any + Send >) ;
971
971
} ) . join ( ) {
972
972
Err ( e) => {
973
973
type T = Box < Any + Send > ;
Original file line number Diff line number Diff line change @@ -33,5 +33,5 @@ impl Trait for Struct {}
33
33
fn main ( ) {
34
34
let stack_struct = Struct { a : 0 , b : 1.0 } ;
35
35
let reference: & Trait = & stack_struct as & Trait ;
36
- let unique: Box < Trait > = box Struct { a : 2 , b : 3.0 } as Box < Trait > ;
36
+ let unique: Box < Trait > = Box :: new ( Struct { a : 2 , b : 3.0 } ) as Box < Trait > ;
37
37
}
You can’t perform that action at this time.
0 commit comments