diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-08-05 15:09:50 -0400 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-08-05 15:09:50 -0400 |
| commit | 43451bc4ee80efa0fa82bbb7dc0354b0c8cf9f3b (patch) | |
| tree | a555e53fc5eaa003213349dbc1560db469093ef1 /src | |
| parent | 3a2af8736341f5afeb3372ba7c112b2c75ce9584 (diff) | |
| parent | 8f828a3a9d66a3ff2465861f1d8f12dd0f088d23 (diff) | |
| download | rust-43451bc4ee80efa0fa82bbb7dc0354b0c8cf9f3b.tar.gz rust-43451bc4ee80efa0fa82bbb7dc0354b0c8cf9f3b.zip | |
Rollup merge of #27538 - steveklabnik:gh26917, r=Gankro
We haven't discussed this syntax yet, so provide a basic explanation and link up to later chapters. Fixes #26917
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/trpl/lifetimes.md | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/doc/trpl/lifetimes.md b/src/doc/trpl/lifetimes.md index 8e02367b921..bdb22fb4a69 100644 --- a/src/doc/trpl/lifetimes.md +++ b/src/doc/trpl/lifetimes.md @@ -77,8 +77,18 @@ Before we get to that, though, let’s break the explicit example down: fn bar<'a>(...) ``` -This part declares our lifetimes. This says that `bar` has one lifetime, `'a`. -If we had two reference parameters, it would look like this: +We previously talked a little about [function syntax][functions], but we didn’t +discuss the `<>`s after a function’s name. A function can have ‘generic +parameters’ between the `<>`s, of which lifetimes are one kind. We’ll discuss +other kinds of generics [later in the book][generics], but for now, let’s +just focus on the lifteimes aspect. + +[functions]: functions.html +[generics]: generics.html + +We use `<>` to declare our lifetimes. This says that `bar` has one lifetime, +`'a`. If we had two reference parameters, it would look like this: + ```rust,ignore fn bar<'a, 'b>(...) |
