about summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-03-08 16:21:58 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-03-11 09:36:00 -0700
commit08c840205ea477d4f76216abac45be6a4ce9fa4b (patch)
tree7c5b611ac00f1054d51fd657d7fb7d143291fce2 /doc
parent7353568cd8d079fd4d9f928bc49a228276e86d19 (diff)
downloadrust-08c840205ea477d4f76216abac45be6a4ce9fa4b.tar.gz
rust-08c840205ea477d4f76216abac45be6a4ce9fa4b.zip
librustc: Lint the old `drop` destructor notation off
Diffstat (limited to 'doc')
-rw-r--r--doc/rust.md12
-rw-r--r--doc/tutorial.md18
2 files changed, 15 insertions, 15 deletions
diff --git a/doc/rust.md b/doc/rust.md
index 8924ee6f4f6..e559af62e36 100644
--- a/doc/rust.md
+++ b/doc/rust.md
@@ -889,10 +889,10 @@ declared, in an angle-bracket-enclosed, comma-separated list following
 the function name.
 
 ~~~~ {.xfail-test}
-fn iter<T>(seq: &[T], f: fn(T)) {
+fn iter<T>(seq: &[T], f: &fn(T)) {
     for seq.each |elt| { f(elt); }
 }
-fn map<T, U>(seq: &[T], f: fn(T) -> U) -> ~[U] {
+fn map<T, U>(seq: &[T], f: &fn(T) -> U) -> ~[U] {
     let mut acc = ~[];
     for seq.each |elt| { acc.push(f(elt)); }
     acc
@@ -1198,7 +1198,7 @@ These appear after the trait name, using the same syntax used in [generic functi
 trait Seq<T> {
    fn len() -> uint;
    fn elt_at(n: uint) -> T;
-   fn iter(fn(T));
+   fn iter(&fn(T));
 }
 ~~~~
 
@@ -2074,7 +2074,7 @@ and moving values from the environment into the lambda expression's captured env
 An example of a lambda expression:
 
 ~~~~
-fn ten_times(f: fn(int)) {
+fn ten_times(f: &fn(int)) {
     let mut i = 0;
     while i < 10 {
         f(i);
@@ -2177,7 +2177,7 @@ If the `expr` is a [field expression](#field-expressions), it is parsed as thoug
 In this example, both calls to `f` are equivalent:
 
 ~~~~
-# fn f(f: fn(int)) { }
+# fn f(f: &fn(int)) { }
 # fn g(i: int) { }
 
 f(|j| g(j));
@@ -2755,7 +2755,7 @@ and the cast expression in `main`.
 Within the body of an item that has type parameter declarations, the names of its type parameters are types:
 
 ~~~~~~~
-fn map<A: Copy, B: Copy>(f: fn(A) -> B, xs: &[A]) -> ~[B] {
+fn map<A: Copy, B: Copy>(f: &fn(A) -> B, xs: &[A]) -> ~[B] {
    if xs.len() == 0 { return ~[]; }
    let first: B = f(xs[0]);
    let rest: ~[B] = map(f, xs.slice(1, xs.len()));
diff --git a/doc/tutorial.md b/doc/tutorial.md
index 23ab1ce4400..e4775e1b11b 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -1361,7 +1361,7 @@ the enclosing scope.
 
 ~~~~
 # use println = core::io::println;
-fn call_closure_with_ten(b: fn(int)) { b(10); }
+fn call_closure_with_ten(b: &fn(int)) { b(10); }
 
 let captured_var = 20;
 let closure = |arg| println(fmt!("captured_var=%d, arg=%d", captured_var, arg));
@@ -1447,7 +1447,7 @@ should almost always declare the type of that argument as `fn()`. That way,
 callers may pass any kind of closure.
 
 ~~~~
-fn call_twice(f: fn()) { f(); f(); }
+fn call_twice(f: &fn()) { f(); f(); }
 let closure = || { "I'm a closure, and it doesn't matter what type I am"; };
 fn function() { "I'm a normal function"; }
 call_twice(closure);
@@ -1467,7 +1467,7 @@ Consider this function that iterates over a vector of
 integers, passing in a pointer to each integer in the vector:
 
 ~~~~
-fn each(v: &[int], op: fn(v: &int)) {
+fn each(v: &[int], op: &fn(v: &int)) {
    let mut n = 0;
    while n < v.len() {
        op(&v[n]);
@@ -1488,7 +1488,7 @@ argument, we can write it in a way that has a pleasant, block-like
 structure.
 
 ~~~~
-# fn each(v: &[int], op: fn(v: &int)) { }
+# fn each(v: &[int], op: &fn(v: &int)) { }
 # fn do_some_work(i: &int) { }
 each([1, 2, 3], |n| {
     do_some_work(n);
@@ -1499,7 +1499,7 @@ This is such a useful pattern that Rust has a special form of function
 call that can be written more like a built-in control structure:
 
 ~~~~
-# fn each(v: &[int], op: fn(v: &int)) { }
+# fn each(v: &[int], op: &fn(v: &int)) { }
 # fn do_some_work(i: &int) { }
 do each([1, 2, 3]) |n| {
     do_some_work(n);
@@ -1546,7 +1546,7 @@ Consider again our `each` function, this time improved to
 break early when the iteratee returns `false`:
 
 ~~~~
-fn each(v: &[int], op: fn(v: &int) -> bool) {
+fn each(v: &[int], op: &fn(v: &int) -> bool) {
    let mut n = 0;
    while n < v.len() {
        if !op(&v[n]) {
@@ -1770,7 +1770,7 @@ vector consisting of the result of applying `function` to each element
 of `vector`:
 
 ~~~~
-fn map<T, U>(vector: &[T], function: fn(v: &T) -> U) -> ~[U] {
+fn map<T, U>(vector: &[T], function: &fn(v: &T) -> U) -> ~[U] {
     let mut accumulator = ~[];
     for vec::each(vector) |element| {
         accumulator.push(function(element));
@@ -1969,12 +1969,12 @@ types might look like the following:
 ~~~~
 trait Seq<T> {
     fn len(&self) -> uint;
-    fn iter(&self, b: fn(v: &T));
+    fn iter(&self, b: &fn(v: &T));
 }
 
 impl<T> Seq<T> for ~[T] {
     fn len(&self) -> uint { vec::len(*self) }
-    fn iter(&self, b: fn(v: &T)) {
+    fn iter(&self, b: &fn(v: &T)) {
         for vec::each(*self) |elt| { b(elt); }
     }
 }