Skip to content

Commit 66ee71a

Browse files
committed
Remove deprecated owned vector from rust.md
1 parent f740e8d commit 66ee71a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/doc/rust.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,8 @@ fn main() {
886886
// Equivalent to 'std::iter::range_step(0, 10, 2);'
887887
range_step(0, 10, 2);
888888
889-
// Equivalent to 'foo(~[std::option::Some(1.0), std::option::None]);'
890-
foo(~[Some(1.0), None]);
889+
// Equivalent to 'foo(vec![std::option::Some(1.0), std::option::None]);'
890+
foo(vec![Some(1.0), None]);
891891
}
892892
~~~~
893893

@@ -995,8 +995,8 @@ the function name.
995995
fn iter<T>(seq: &[T], f: |T|) {
996996
for elt in seq.iter() { f(elt); }
997997
}
998-
fn map<T, U>(seq: &[T], f: |T| -> U) -> ~[U] {
999-
let mut acc = ~[];
998+
fn map<T, U>(seq: &[T], f: |T| -> U) -> Vec<U> {
999+
let mut acc = vec![];
10001000
for elt in seq.iter() { acc.push(f(elt)); }
10011001
acc
10021002
}
@@ -1159,19 +1159,19 @@ except that they have the `extern` modifier.
11591159

11601160
~~~~
11611161
// Declares an extern fn, the ABI defaults to "C"
1162-
extern fn new_vec() -> ~[int] { ~[] }
1162+
extern fn new_int() -> int { 0 }
11631163
11641164
// Declares an extern fn with "stdcall" ABI
1165-
extern "stdcall" fn new_vec_stdcall() -> ~[int] { ~[] }
1165+
extern "stdcall" fn new_int_stdcall() -> int { 0 }
11661166
~~~~
11671167

11681168
Unlike normal functions, extern fns have an `extern "ABI" fn()`.
11691169
This is the same type as the functions declared in an extern
11701170
block.
11711171

11721172
~~~~
1173-
# extern fn new_vec() -> ~[int] { ~[] }
1174-
let fptr: extern "C" fn() -> ~[int] = new_vec;
1173+
# extern fn new_int() -> int { 0 }
1174+
let fptr: extern "C" fn() -> int = new_int;
11751175
~~~~
11761176

11771177
Extern functions may be called directly from Rust code as Rust uses large,
@@ -1509,7 +1509,7 @@ Implementation parameters are written after the `impl` keyword.
15091509

15101510
~~~~
15111511
# trait Seq<T> { }
1512-
impl<T> Seq<T> for ~[T] {
1512+
impl<T> Seq<T> for Vec<T> {
15131513
/* ... */
15141514
}
15151515
impl Seq<bool> for u32 {
@@ -3347,7 +3347,7 @@ Such a definite-sized vector type is a first-class type, since its size is known
33473347
A vector without such a size is said to be of _indefinite_ size,
33483348
and is therefore not a _first-class_ type.
33493349
An indefinite-size vector can only be instantiated through a pointer type,
3350-
such as `&[T]` or `~[T]`.
3350+
such as `&[T]` or `Vec<T>`.
33513351
The kind of a vector type depends on the kind of its element type,
33523352
as with other simple structural types.
33533353

0 commit comments

Comments
 (0)