mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-22 23:10:20 +08:00
sync content (#157)
* Sync the original contents:upgrade syn crate to version 2.0 * Sync content
This commit is contained in:
parent
d6cdce4b04
commit
eecb6e97cd
@ -90,7 +90,7 @@ Here, `x` has the lifetime `'b`, which in this case is larger than `'a`. This
|
||||
means `r` can reference `x` because Rust knows that the reference in `r` will
|
||||
always be valid while `x` is valid.
|
||||
|
||||
Now that you know where the lifetimes of references are and how Rust analyzes
|
||||
Now that you know what the lifetimes of references are and how Rust analyzes
|
||||
lifetimes to ensure references will always be valid, let’s explore generic
|
||||
lifetimes of parameters and return values in the context of functions.
|
||||
|
||||
|
@ -80,7 +80,7 @@ Rust 编译器有一个 **借用检查器**(*borrow checker*),它比较作
|
||||
|
||||
这里 `x` 拥有生命周期 `'b`,比 `'a` 要大。这就意味着 `r` 可以引用 `x`:Rust 知道 `r` 中的引用在 `x` 有效的时候也总是有效的。
|
||||
|
||||
现在我们已经在一个具体的例子中展示了引用的生命周期位于何处,并讨论了 Rust 如何分析生命周期来保证引用总是有效的,接下来让我们聊聊在函数的上下文中参数和返回值的泛型生命周期。
|
||||
现在我们已经在一个具体的例子中展示了什么是引用的生命周期,并讨论了 Rust 如何分析生命周期来保证引用总是有效的,接下来让我们聊聊在函数的上下文中参数和返回值的泛型生命周期。
|
||||
|
||||
### 函数中的泛型生命周期
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user