about summary refs log tree commit diff
path: root/src/doc/reference.md
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-06-16 10:40:33 +0000
committerbors <bors@rust-lang.org>2015-06-16 10:40:33 +0000
commit520a471bc5da4ef30f60c0494c6889fe22bbbe2c (patch)
tree55401f3576693691ee312b763bb9262c268f6688 /src/doc/reference.md
parent4806210db9148f008a317db5235bc0e5a5e3b48e (diff)
parent22b6a5dc2acb4fd83fa3d90d1a04128c252aedd2 (diff)
downloadrust-520a471bc5da4ef30f60c0494c6889fe22bbbe2c.tar.gz
rust-520a471bc5da4ef30f60c0494c6889fe22bbbe2c.zip
Auto merge of #26323 - steveklabnik:gh26320, r=alexcrichton
Fixes #26320
Diffstat (limited to 'src/doc/reference.md')
-rw-r--r--src/doc/reference.md19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index c19aec78de2..02226353585 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -928,21 +928,20 @@ A _generic function_ allows one or more _parameterized types_ to appear in its
 signature. Each type parameter must be explicitly declared, in an
 angle-bracket-enclosed, comma-separated list following the function name.
 
-```{.ignore}
-fn iter<T, F>(seq: &[T], f: F) where T: Copy, F: Fn(T) {
-    for elt in seq { f(*elt); }
-}
-fn map<T, U, F>(seq: &[T], f: F) -> Vec<U> where T: Copy, U: Copy, F: Fn(T) -> U {
-    let mut acc = vec![];
-    for elt in seq { acc.push(f(*elt)); }
-    acc
-}
+```rust,ignore
+// foo is generic over A and B
+
+fn foo<A, B>(x: A, y: B) {
 ```
 
 Inside the function signature and body, the name of the type parameter can be
 used as a type name. [Trait](#traits) bounds can be specified for type parameters
 to allow methods with that trait to be called on values of that type. This is
-specified using the `where` syntax, as in the above example.
+specified using the `where` syntax:
+
+```rust,ignore
+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