Skip to content

Commit 39e4d03

Browse files
committed
Rollup merge of #26342 - steveklabnik:quix_reference_fix, r=alexcrichton
https://github.com/rust-lang/rust/pull/26323/files#r32503568
2 parents b780bc5 + 5a63326 commit 39e4d03

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/doc/reference.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -944,9 +944,20 @@ fn foo<T>(x: T) where T: Debug {
944944
```
945945

946946
When a generic function is referenced, its type is instantiated based on the
947-
context of the reference. For example, calling the `iter` function defined
948-
above on `[1, 2]` will instantiate type parameter `T` with `i32`, and require
949-
the closure parameter to have type `Fn(i32)`.
947+
context of the reference. For example, calling the `foo` function here:
948+
949+
```
950+
use std::fmt::Debug;
951+
952+
fn foo<T>(x: &[T]) where T: Debug {
953+
// details elided
954+
# ()
955+
}
956+
957+
foo(&[1, 2]);
958+
```
959+
960+
will instantiate type parameter `T` with `i32`.
950961

951962
The type parameters can also be explicitly supplied in a trailing
952963
[path](#paths) component after the function name. This might be necessary if

0 commit comments

Comments
 (0)