about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-06-16 11:29:20 -0400
committerSteve Klabnik <steve@steveklabnik.com>2015-06-16 11:29:20 -0400
commit5a63326442fe068c63dcd7cdd60ca6be25ce666a (patch)
tree012cd6055d37e97ef939906b8d4650ab2ca0f246
parent520a471bc5da4ef30f60c0494c6889fe22bbbe2c (diff)
downloadrust-5a63326442fe068c63dcd7cdd60ca6be25ce666a.tar.gz
rust-5a63326442fe068c63dcd7cdd60ca6be25ce666a.zip
One more consistency fix in the reference
https://github.com/rust-lang/rust/pull/26323/files#r32503568
-rw-r--r--src/doc/reference.md17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index 02226353585..978c9d7c114 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -944,9 +944,20 @@ fn foo<T>(x: T) where T: Debug {
 ```
 
 When a generic function is referenced, its type is instantiated based on the
-context of the reference. For example, calling the `iter` function defined
-above on `[1, 2]` will instantiate type parameter `T` with `i32`, and require
-the closure parameter to have type `Fn(i32)`.
+context of the reference. For example, calling the `foo` function here:
+
+```
+use std::fmt::Debug;
+
+fn foo<T>(x: &[T]) where T: Debug {
+    // details elided
+    # ()
+}
+
+foo(&[1, 2]);
+```
+
+will instantiate type parameter `T` with `i32`.
 
 The type parameters can also be explicitly supplied in a trailing
 [path](#paths) component after the function name. This might be necessary if