From 4cf705cfa5970fbcacdf6707be1097ae1996708f Mon Sep 17 00:00:00 2001 From: bianguangze Date: Tue, 16 Apr 2024 09:42:35 +0800 Subject: [PATCH 1/3] Sync the original contents:upgrade syn crate to version 2.0 --- .../listing-19-31/hello_macro/hello_macro_derive/Cargo.toml | 2 +- .../listing-19-31/hello_macro/hello_macro_derive/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/english/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.toml b/english/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.toml index aa076ac4..ed9e917a 100644 --- a/english/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.toml +++ b/english/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" proc-macro = true [dependencies] -syn = "1.0" +syn = "2.0" quote = "1.0" diff --git a/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.toml b/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.toml index 168cbae5..cf203115 100644 --- a/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.toml +++ b/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" proc-macro = true [dependencies] -syn = "1.0" +syn = "2.0" quote = "1.0" From cc289594476a5480e29d9ba4140faf660de0bb9e Mon Sep 17 00:00:00 2001 From: bianguangze Date: Mon, 22 Apr 2024 09:31:06 +0800 Subject: [PATCH 2/3] Sync content --- english/src/ch10-03-lifetime-syntax.md | 2 +- src/ch10-03-lifetime-syntax.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/english/src/ch10-03-lifetime-syntax.md b/english/src/ch10-03-lifetime-syntax.md index 1746ca1f..4468bc9d 100644 --- a/english/src/ch10-03-lifetime-syntax.md +++ b/english/src/ch10-03-lifetime-syntax.md @@ -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. diff --git a/src/ch10-03-lifetime-syntax.md b/src/ch10-03-lifetime-syntax.md index 9b995dc4..0308d3f1 100644 --- a/src/ch10-03-lifetime-syntax.md +++ b/src/ch10-03-lifetime-syntax.md @@ -80,7 +80,7 @@ Rust 编译器有一个 **借用检查器**(*borrow checker*),它比较作 这里 `x` 拥有生命周期 `'b`,比 `'a` 要大。这就意味着 `r` 可以引用 `x`:Rust 知道 `r` 中的引用在 `x` 有效的时候也总是有效的。 -现在我们已经在一个具体的例子中展示了引用的生命周期位于何处,并讨论了 Rust 如何分析生命周期来保证引用总是有效的,接下来让我们聊聊在函数的上下文中参数和返回值的泛型生命周期。 +现在我们已经在一个具体的例子中展示了什么是引用的生命周期,并讨论了 Rust 如何分析生命周期来保证引用总是有效的,接下来让我们聊聊在函数的上下文中参数和返回值的泛型生命周期。 ### 函数中的泛型生命周期 From c012b9dc58ba0820d854d63d3be200e2f45acccb Mon Sep 17 00:00:00 2001 From: bianguangze Date: Sun, 28 Apr 2024 17:28:08 +0800 Subject: [PATCH 3/3] sync content --- english/src/ch18-02-refutability.md | 2 +- src/ch18-02-refutability.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/english/src/ch18-02-refutability.md b/english/src/ch18-02-refutability.md index 431721e0..46464a2f 100644 --- a/english/src/ch18-02-refutability.md +++ b/english/src/ch18-02-refutability.md @@ -61,7 +61,7 @@ validly. Listing 18-9 shows how to fix the code in Listing 18-8. patterns instead of `let` We’ve given the code an out! This code is perfectly valid, although it means we -cannot use an irrefutable pattern without receiving an error. If we give `if +cannot use an irrefutable pattern without receiving an warning. If we give `if let` a pattern that will always match, such as `x`, as shown in Listing 18-10, the compiler will give a warning. diff --git a/src/ch18-02-refutability.md b/src/ch18-02-refutability.md index 78d92175..4ce652d0 100644 --- a/src/ch18-02-refutability.md +++ b/src/ch18-02-refutability.md @@ -37,7 +37,7 @@ if let Some(x) = some_option_value { 示例 18-9: 使用 `if let` 和一个带有可反驳模式的代码块来代替 `let` -我们给了代码一个得以继续的出路!这段代码完全有效,尽管这意味着我们不能在避免产生错误的情况下使用无可辩驳的模式。如果为 `if let` 提供了一个总是会匹配的模式,比如示例 18-10 中的 `x`,编译器会给出一个警告。 +我们给了代码一个得以继续的出路!这段代码完全有效,尽管这意味着我们不能在避免产生警告的情况下使用无可辩驳的模式。如果为 `if let` 提供了一个总是会匹配的模式,比如示例 18-10 中的 `x`,编译器会给出一个警告。 ```rust,ignore if let x = 5 {