|
8 | 8 | // option. This file may not be copied, modified, or distributed
|
9 | 9 | // except according to those terms.
|
10 | 10 |
|
11 |
| -#[cfg(stage0)] |
12 |
| -/// Creates a `Vec` containing the arguments. |
13 |
| -/// |
14 |
| -/// `vec!` allows `Vec`s to be defined with the same syntax as array expressions. |
15 |
| -/// There are two forms of this macro: |
16 |
| -/// |
17 |
| -/// - Create a `Vec` containing a given list of elements: |
18 |
| -/// |
19 |
| -/// ``` |
20 |
| -/// let v = vec![1, 2, 3]; |
21 |
| -/// assert_eq!(v[0], 1); |
22 |
| -/// assert_eq!(v[1], 2); |
23 |
| -/// assert_eq!(v[2], 3); |
24 |
| -/// ``` |
25 |
| -/// |
26 |
| -/// - Create a `Vec` from a given element and size: |
27 |
| -/// |
28 |
| -/// ``` |
29 |
| -/// let v = vec![1; 3]; |
30 |
| -/// assert_eq!(v, [1, 1, 1]); |
31 |
| -/// ``` |
32 |
| -/// |
33 |
| -/// Note that unlike array expressions this syntax supports all elements |
34 |
| -/// which implement `Clone` and the number of elements doesn't have to be |
35 |
| -/// a constant. |
36 |
| -#[macro_export] |
37 |
| -#[stable(feature = "rust1", since = "1.0.0")] |
38 |
| -macro_rules! vec { |
39 |
| - ($elem:expr; $n:expr) => ( |
40 |
| - $crate::vec::from_elem($elem, $n) |
41 |
| - ); |
42 |
| - ($($x:expr),*) => ( |
43 |
| - <[_] as $crate::slice::SliceExt>::into_vec( |
44 |
| - $crate::boxed::Box::new([$($x),*])) |
45 |
| - ); |
46 |
| - ($($x:expr,)*) => (vec![$($x),*]) |
47 |
| -} |
48 |
| - |
49 |
| -#[cfg(not(stage0))] |
50 | 11 | /// Creates a `Vec` containing the arguments.
|
51 | 12 | ///
|
52 | 13 | /// `vec!` allows `Vec`s to be defined with the same syntax as array expressions.
|
@@ -84,11 +45,10 @@ macro_rules! vec {
|
84 | 45 | ($($x:expr,)*) => (vec![$($x),*])
|
85 | 46 | }
|
86 | 47 |
|
87 |
| -// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is required for this |
88 |
| -// macro definition, is not available. Instead use the `slice::into_vec` function which is only |
89 |
| -// available with cfg(test) |
| 48 | +// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is |
| 49 | +// required for this macro definition, is not available. Instead use the |
| 50 | +// `slice::into_vec` function which is only available with cfg(test) |
90 | 51 | // NB see the slice::hack module in slice.rs for more information
|
91 |
| -#[cfg(not(stage0))] |
92 | 52 | #[cfg(test)]
|
93 | 53 | macro_rules! vec {
|
94 | 54 | ($elem:expr; $n:expr) => (
|
|
0 commit comments