File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2331,7 +2331,7 @@ mod tests {
23312331 fn test_into_vec ( ) {
23322332 let xs = box [ 1 u, 2 , 3 ] ;
23332333 let ys = xs. into_vec ( ) ;
2334- assert_eq ! ( ys. as_slice( ) , [ 1 u, 2 , 3 ] ) ;
2334+ assert_eq ! ( ys. as_slice( ) , [ 1 u, 2 , 3 ] . as_slice ( ) ) ;
23352335 }
23362336}
23372337
Original file line number Diff line number Diff line change @@ -2650,7 +2650,7 @@ mod tests {
26502650 fn test_into_boxed_slice ( ) {
26512651 let xs = vec ! [ 1 u, 2 , 3 ] ;
26522652 let ys = xs. into_boxed_slice ( ) ;
2653- assert_eq ! ( ys. as_slice( ) , [ 1 u, 2 , 3 ] ) ;
2653+ assert_eq ! ( ys. as_slice( ) , [ 1 u, 2 , 3 ] . as_slice ( ) ) ;
26542654 }
26552655
26562656 #[ bench]
Original file line number Diff line number Diff line change 1818//! listener (socket server) implements the `Listener` and `Acceptor` traits.
1919
2020use clone:: Clone ;
21- use collections:: MutableSeq ;
2221use io:: IoResult ;
2322use iter:: Iterator ;
2423use slice:: ImmutableSlice ;
Original file line number Diff line number Diff line change @@ -272,7 +272,9 @@ mod std {
272272 // The test runner calls ::std::os::args() but really wants realstd
273273 #[ cfg( test) ] pub use realstd:: os as os;
274274 // The test runner requires std::slice::Vector, so re-export std::slice just for it.
275- #[ cfg( test) ] pub use slice;
275+ //
276+ // It is also used in vec![]
277+ pub use slice;
276278
277- pub use collections ; // vec!() uses MutableSeq
279+ pub use boxed ; // used for vec![]
278280}
Original file line number Diff line number Diff line change @@ -323,16 +323,14 @@ macro_rules! try(
323323
324324/// Create a `std::vec::Vec` containing the arguments.
325325#[ macro_export]
326- macro_rules! vec(
327- ( $( $e: expr) ,* ) => ( {
328- // leading _ to allow empty construction without a warning.
329- let mut _temp = :: std:: vec:: Vec :: new( ) ;
330- $( _temp. push( $e) ; ) *
331- _temp
326+ macro_rules! vec[
327+ ( $( $x: expr) ,* ) => ( {
328+ use std:: slice:: BoxedSlice ;
329+ let xs: :: std:: boxed:: Box <[ _] > = box [ $( $x) ,* ] ;
330+ xs. into_vec( )
332331 } ) ;
333- ( $( $e: expr) ,+, ) => ( vec!( $( $e) ,+) )
334- )
335-
332+ ( $( $x: expr, ) * ) => ( vec![ $( $x) ,* ] )
333+ ]
336334
337335/// A macro to select an event from a number of receivers.
338336///
You can’t perform that action at this time.
0 commit comments