From 23d5b65a774f4b041ee27d66c669bdc6b948c152 Mon Sep 17 00:00:00 2001 From: Zheng Ping Date: Sun, 23 Jul 2017 01:53:52 +0800 Subject: [PATCH] Update ch19-02-advanced-lifetimes.md --- src/ch19-02-advanced-lifetimes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch19-02-advanced-lifetimes.md b/src/ch19-02-advanced-lifetimes.md index 60f97ab..bf12e03 100644 --- a/src/ch19-02-advanced-lifetimes.md +++ b/src/ch19-02-advanced-lifetimes.md @@ -170,7 +170,7 @@ note: but the referenced data is only valid for the lifetime 's as defined on th Rust 并不知道 `'c` 和 `'s` 之间的关系. `Context`中被引用的数据的生命周期是`'s`, 对`Context`的引用有生命周期`'c`, 为了让代码有效, 需要保证生命周期 `'s` 比生命周期 `'c` 更长. 如果 `'s` 存活的时间没有 `'c` 长, 那么对 `Context` 的引用可能就要出问题. -现在就让我们来看这一节: Rust 有一个被称为*生命周期子类型(lifetime subtyping)*的特性, 它可以指明一个生命周期参数的存活时间不会比另一个生命周期短. In the angle brackets where we declare lifetime +本节就是为了解决这个问题: Rust 有一个被称为 *生命周期子类型 (lifetime subtyping)* 的特性, 它可以指明一个生命周期参数的存活时间不会比另一个生命周期短. In the angle brackets where we declare lifetime parameters, we can declare a lifetime `'a` as usual, and declare a lifetime `'b` that lives at least as long as `'a` by declaring `'b` with the syntax `'b: 'a`.