Linux Documentation
 help / color / mirror / Atom feed
* [PATCH 0/4] docs/zh_CN: update rust documentation translations
@ 2026-07-08  3:13 Ben Guo
  2026-07-08  3:13 ` [PATCH 1/4] docs/zh_CN: Update rust/quick-start.rst translation Ben Guo
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Ben Guo @ 2026-07-08  3:13 UTC (permalink / raw)
  To: Alex Shi, Yanteng Si, Dongliang Mu, Jonathan Corbet
  Cc: linux-doc, linux-kernel, rust-for-linux, hust-os-kernel-patches

Update Chinese translations for the Rust subsystem documentation,
syncing with the latest upstream changes.

- quick-start.rst: update distro-specific install instructions, Ubuntu
  package versions, openSUSE rust-src package, and remove GDB/Binutils note
- general-information.rst: add no_std section, rustdoc links, abstractions
  and bindings diagram, Bindings/Abstractions sections, and Kconfig example
- arch-support.rst: add s390 support note
- testing.rst: add Kconfig guidance for KUnit test suites

Ben Guo (4):
  docs/zh_CN: Update rust/quick-start.rst translation
  docs/zh_CN: Update rust/general-information.rst translation
  docs/zh_CN: Update rust/arch-support.rst translation
  docs/zh_CN: Update rust/testing.rst translation

 .../translations/zh_CN/rust/arch-support.rst  |  1 +
 .../zh_CN/rust/general-information.rst        | 82 ++++++++++++++++++-
 .../translations/zh_CN/rust/quick-start.rst   | 48 +++++------
 .../translations/zh_CN/rust/testing.rst       |  4 +
 4 files changed, 103 insertions(+), 32 deletions(-)

-- 
2.53.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] docs/zh_CN: Update rust/quick-start.rst translation
  2026-07-08  3:13 [PATCH 0/4] docs/zh_CN: update rust documentation translations Ben Guo
@ 2026-07-08  3:13 ` Ben Guo
  2026-07-08  5:25 ` [PATCH 2/4] docs/zh_CN: Update rust/general-information.rst translation Ben Guo
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Ben Guo @ 2026-07-08  3:13 UTC (permalink / raw)
  To: Alex Shi, Yanteng Si, Dongliang Mu, Jonathan Corbet
  Cc: linux-doc, linux-kernel, rust-for-linux, hust-os-kernel-patches

Update Documentation/rust/quick-start.rst translation.

Update the translation through commit a4392ed1c8b9
("docs: rust: quick-start: remove GDB/Binutils mention")

Signed-off-by: Ben Guo <ben.guo@openatom.club>
---
 .../translations/zh_CN/rust/quick-start.rst   | 48 ++++++++-----------
 1 file changed, 19 insertions(+), 29 deletions(-)

diff --git a/Documentation/translations/zh_CN/rust/quick-start.rst b/Documentation/translations/zh_CN/rust/quick-start.rst
index 5f0ece6411f..0396137f3c1 100644
--- a/Documentation/translations/zh_CN/rust/quick-start.rst
+++ b/Documentation/translations/zh_CN/rust/quick-start.rst
@@ -59,7 +59,7 @@ Fedora Linux 提供较新的 Rust 版本,因此通常开箱即用,例如::
 Gentoo Linux
 ************
 
-Gentoo Linux(尤其是 testing 分支)提供较新的 Rust 版本,因此通常开箱即用,
+Gentoo Linux 提供较新的 Rust 版本,因此通常开箱即用,
 例如::
 
 	USE='rust-src rustfmt clippy' emerge dev-lang/rust dev-util/bindgen
@@ -70,7 +70,7 @@ Gentoo Linux(尤其是 testing 分支)提供较新的 Rust 版本,因此
 Nix
 ***
 
-Nix(unstable 频道)提供较新的 Rust 版本,因此通常开箱即用,例如::
+Nix 提供较新的 Rust 版本,因此通常开箱即用,例如::
 
 	{ pkgs ? import <nixpkgs> {} }:
 	pkgs.mkShell {
@@ -85,16 +85,14 @@ openSUSE
 openSUSE Slowroll 和 openSUSE Tumbleweed 提供较新的 Rust 版本,因此通常开箱
 即用,例如::
 
-	zypper install rust rust1.79-src rust-bindgen clang
+	zypper install rust rust-src rust-bindgen clang
 
 
 Ubuntu
 ******
 
-25.04
-~~~~~
-
-最新的 Ubuntu 版本提供较新的 Rust 版本,因此通常开箱即用,例如::
+Ubuntu 25.10 和 26.04 LTS 提供较新的 Rust 版本,因此通常开箱即用,
+例如::
 
 	apt install rustc rust-src bindgen rustfmt rust-clippy
 
@@ -111,32 +109,32 @@ Ubuntu
 虽然 Ubuntu 24.04 LTS 及更早版本仍然提供较新的 Rust 版本,但它们需要一些额外的配
 置,使用带版本号的软件包,例如::
 
-	apt install rustc-1.80 rust-1.80-src bindgen-0.65 rustfmt-1.80 \
-		rust-1.80-clippy
-	ln -s /usr/lib/rust-1.80/bin/rustfmt /usr/bin/rustfmt-1.80
-	ln -s /usr/lib/rust-1.80/bin/clippy-driver /usr/bin/clippy-driver-1.80
+	apt install rustc-1.85 rust-1.85-src bindgen-0.71 rustfmt-1.85 \
+		rust-1.85-clippy
+	ln -s /usr/lib/rust-1.85/bin/rustfmt /usr/bin/rustfmt-1.85
+	ln -s /usr/lib/rust-1.85/bin/clippy-driver /usr/bin/clippy-driver-1.85
 
 这些软件包都不会将其工具设置为默认值;因此应该显式指定它们,例如::
 
-	make LLVM=1 RUSTC=rustc-1.80 RUSTDOC=rustdoc-1.80 RUSTFMT=rustfmt-1.80 \
-		CLIPPY_DRIVER=clippy-driver-1.80 BINDGEN=bindgen-0.65
+	make LLVM=1 RUSTC=rustc-1.85 RUSTDOC=rustdoc-1.85 RUSTFMT=rustfmt-1.85 \
+		CLIPPY_DRIVER=clippy-driver-1.85 BINDGEN=bindgen-0.71
 
-或者,修改 ``PATH`` 变量将 Rust 1.80 的二进制文件放在前面,并将 ``bindgen`` 设
+或者,修改 ``PATH`` 变量将 Rust 1.85 的二进制文件放在前面,并将 ``bindgen`` 设
 置为默认值,例如::
 
-	PATH=/usr/lib/rust-1.80/bin:$PATH
+	PATH=/usr/lib/rust-1.85/bin:$PATH
 	update-alternatives --install /usr/bin/bindgen bindgen \
-		/usr/bin/bindgen-0.65 100
-	update-alternatives --set bindgen /usr/bin/bindgen-0.65
+		/usr/bin/bindgen-0.71 100
+	update-alternatives --set bindgen /usr/bin/bindgen-0.71
 
-使用带版本号的软件包时需要设置 ``RUST_LIB_SRC``,例如::
+使用带版本号的软件包时可能需要设置 ``RUST_LIB_SRC``,例如::
 
-	RUST_LIB_SRC=/usr/src/rustc-$(rustc-1.80 --version | cut -d' ' -f2)/library
+	RUST_LIB_SRC=/usr/src/rustc-$(rustc-1.85 --version | cut -d' ' -f2)/library
 
 为方便起见,可以将 ``RUST_LIB_SRC`` 导出到全局环境中。
 
-此外, ``bindgen-0.65`` 在较新的版本(24.04 LTS 和 24.10)中可用,但在更早的版
-本(20.04 LTS 和 22.04 LTS)中可能不可用,因此可能需要手动构建 ``bindgen``
+此外, ``bindgen-0.71`` 在较新的版本(24.04 LTS)中可用,但在更早的版本
+(20.04 LTS 和 22.04 LTS)中可能不可用,因此可能需要手动构建 ``bindgen``
 (请参见下文)。
 
 
@@ -325,11 +323,3 @@ Rust支持(CONFIG_RUST)需要在 ``General setup`` 菜单中启用。在其
 
 要想深入了解,请看 ``samples/rust/`` 下的样例源代码、 ``rust/`` 下的Rust支持代码和
 ``Kernel hacking`` 下的 ``Rust hacking`` 菜单。
-
-如果使用的是GDB/Binutils,而Rust符号没有被demangled,原因是工具链还不支持Rust的新v0
-mangling方案。有几个办法可以解决:
-
-- 安装一个较新的版本(GDB >= 10.2, Binutils >= 2.36)。
-
-- 一些版本的GDB(例如vanilla GDB 10.1)能够使用嵌入在调试信息(``CONFIG_DEBUG_INFO``)
-  中的pre-demangled的名字。
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] docs/zh_CN: Update rust/general-information.rst translation
  2026-07-08  3:13 [PATCH 0/4] docs/zh_CN: update rust documentation translations Ben Guo
  2026-07-08  3:13 ` [PATCH 1/4] docs/zh_CN: Update rust/quick-start.rst translation Ben Guo
@ 2026-07-08  5:25 ` Ben Guo
  2026-07-08 11:56   ` Gary Guo
  2026-07-08  5:25 ` [PATCH 3/4] docs/zh_CN: Update rust/arch-support.rst translation Ben Guo
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Ben Guo @ 2026-07-08  5:25 UTC (permalink / raw)
  To: Alex Shi, Yanteng Si, Dongliang Mu, Jonathan Corbet
  Cc: linux-doc, linux-kernel, rust-for-linux, hust-os-kernel-patches

Update Documentation/rust/general-information.rst translation.

Update the translation through commit 86c5d1c6740c
("docs: rust: general-information: use real example")

Signed-off-by: Ben Guo <ben.guo@openatom.club>
---
 .../zh_CN/rust/general-information.rst        | 82 ++++++++++++++++++-
 1 file changed, 79 insertions(+), 3 deletions(-)

diff --git a/Documentation/translations/zh_CN/rust/general-information.rst b/Documentation/translations/zh_CN/rust/general-information.rst
index 9b5e37e13f3..043eb87588f 100644
--- a/Documentation/translations/zh_CN/rust/general-information.rst
+++ b/Documentation/translations/zh_CN/rust/general-information.rst
@@ -13,6 +13,14 @@
 
 本文档包含了在内核中使用Rust支持时需要了解的有用信息。
 
+``no_std``
+----------
+
+内核中的 Rust 支持只能链接 `core <https://doc.rust-lang.org/core/>`_,
+而不能链接 `std <https://doc.rust-lang.org/std/>`_。供内核使用的 crate
+必须使用 ``#![no_std]`` 属性选择这种行为。
+
+
 .. _rust_code_documentation_zh_cn:
 
 代码文档
@@ -20,10 +28,18 @@
 
 Rust内核代码使用其内置的文档生成器 ``rustdoc`` 进行记录。
 
-生成的HTML文档包括集成搜索、链接项(如类型、函数、常量)、源代码等。它们可以在以下地址阅读
-(TODO:当在主线中时链接,与其他文档一起生成):
+生成的HTML文档包括集成搜索、链接项(如类型、函数、常量)、源代码等。
+它们可以在以下地址阅读:
+
+		https://rust.docs.kernel.org
+
+对于 linux-next,请参阅:
 
-	http://kernel.org/
+		https://rust.docs.kernel.org/next/
+
+每个主要版本也有对应的标签,例如:
+
+		https://rust.docs.kernel.org/6.10/
 
 这些文档也可以很容易地在本地生成和阅读。这相当快(与编译代码本身的顺序相同),而且不需要特
 殊的工具或环境。这有一个额外的好处,那就是它们将根据所使用的特定内核配置进行定制。要生成它
@@ -62,6 +78,58 @@ Rust内核代码使用其内置的文档生成器 ``rustdoc`` 进行记录。
 模块(例如,驱动程序)不应该直接使用C语言的绑定。相反,子系统应该根据需要提供尽可能安
 全的抽象。
 
+.. code-block::
+
+	                                                rust/bindings/
+	                                               (rust/helpers/)
+
+	                                                   include/ -----+ <-+
+	                                                                 |   |
+	  drivers/              rust/kernel/              +----------+ <-+   |
+	    fs/                                           | bindgen  |       |
+	   .../            +-------------------+          +----------+ --+   |
+	                   |    Abstractions   |                         |   |
+	+---------+        | +------+ +------+ |          +----------+   |   |
+	| my_foo  | -----> | | foo  | | bar  | | -------> | Bindings | <-+   |
+	| driver  |  Safe  | | sub- | | sub- | |  Unsafe  |          |       |
+	+---------+        | |system| |system| |          | bindings | <-----+
+	     |             | +------+ +------+ |          |  crate   |       |
+	     |             |   kernel crate    |          +----------+       |
+	     |             +-------------------+                             |
+	     |                                                               |
+	     +------------------# FORBIDDEN #--------------------------------+
+
+主要思想是将所有与内核 C API 的直接交互封装到经过仔细审查和文档化的抽象
+中。这样,只要满足以下条件,这些抽象的用户就不能引入未定义行为
+(undefined behavior,UB):
+
+#. 抽象是正确的("sound")。
+#. 任何 ``unsafe`` 块都遵守调用块内操作所需的安全契约。类似地,任何
+   ``unsafe impl`` 都遵守实现该特性所需的安全契约。
+
+绑定
+~~~~
+
+通过从 ``include/`` 中将 C 头文件包含到
+``rust/bindings/bindings_helper.h``, ``bindgen`` 工具将为所包含的子系统
+自动生成绑定。构建后,请查看 ``rust/bindings/`` 目录中的
+``*_generated.rs`` 输出文件。
+
+对于 ``bindgen`` 不会自动生成的 C 头文件部分,例如 C ``inline`` 函数或
+非平凡宏,可以在 ``rust/helpers/`` 中添加一个小型包装函数,使其也可供
+Rust 端使用。
+
+抽象
+~~~~
+
+抽象是绑定和内核内用户之间的层。它们位于 ``rust/kernel/`` 中,其作用是
+将对绑定的不安全访问封装到尽可能安全并暴露给用户的 API 中。抽象的用户
+包括用 Rust 编写的驱动程序或文件系统等。
+
+除了安全方面,这些抽象还应该易于使用,也就是说,把 C 接口转换为符合
+Rust 惯例的代码。基本示例包括将 C 的资源获取和释放转换为 Rust 的初始化
+和清理模式,或者将 C 整数错误码转换为 Rust 的 ``Result``。
+
 
 有条件的编译
 ------------
@@ -74,3 +142,11 @@ Rust代码可以访问基于内核配置的条件性编译:
 	#[cfg(CONFIG_X="y")]   // Enabled as a built-in (`y`)
 	#[cfg(CONFIG_X="m")]   // Enabled as a module   (`m`)
 	#[cfg(not(CONFIG_X))]  // Disabled
+
+对于 Rust 的 ``cfg`` 不支持的其他条件,例如带有数值比较的表达式,可以
+定义一个新的 Kconfig 符号:
+
+.. code-block:: kconfig
+
+	config RUSTC_HAS_SPAN_FILE
+		def_bool RUSTC_VERSION >= 108800
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] docs/zh_CN: Update rust/arch-support.rst translation
  2026-07-08  3:13 [PATCH 0/4] docs/zh_CN: update rust documentation translations Ben Guo
  2026-07-08  3:13 ` [PATCH 1/4] docs/zh_CN: Update rust/quick-start.rst translation Ben Guo
  2026-07-08  5:25 ` [PATCH 2/4] docs/zh_CN: Update rust/general-information.rst translation Ben Guo
@ 2026-07-08  5:25 ` Ben Guo
  2026-07-08  5:25 ` [PATCH 4/4] docs/zh_CN: Update rust/testing.rst translation Ben Guo
  2026-07-10 12:03 ` [PATCH 0/4] docs/zh_CN: update rust documentation translations Gary Guo
  4 siblings, 0 replies; 8+ messages in thread
From: Ben Guo @ 2026-07-08  5:25 UTC (permalink / raw)
  To: Alex Shi, Yanteng Si, Dongliang Mu, Jonathan Corbet
  Cc: linux-doc, linux-kernel, rust-for-linux, hust-os-kernel-patches

Update Documentation/rust/arch-support.rst translation.

Update the translation through commit 3f70ebe63858
("s390: Enable Rust support")

Signed-off-by: Ben Guo <ben.guo@openatom.club>
---
 Documentation/translations/zh_CN/rust/arch-support.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/translations/zh_CN/rust/arch-support.rst b/Documentation/translations/zh_CN/rust/arch-support.rst
index f5ae44588a5..0ca4be6e176 100644
--- a/Documentation/translations/zh_CN/rust/arch-support.rst
+++ b/Documentation/translations/zh_CN/rust/arch-support.rst
@@ -23,6 +23,7 @@
 ``arm64``      Maintained        仅小端序。
 ``loongarch``  Maintained        \-
 ``riscv``      Maintained        仅 ``riscv64``,且仅限 LLVM/Clang。
+``s390``       Maintained        必须禁用 ``CONFIG_EXPOLINE``。
 ``um``         Maintained        \-
 ``x86``        Maintained        仅 ``x86_64``。
 =============  ================  ==============================================
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] docs/zh_CN: Update rust/testing.rst translation
  2026-07-08  3:13 [PATCH 0/4] docs/zh_CN: update rust documentation translations Ben Guo
                   ` (2 preceding siblings ...)
  2026-07-08  5:25 ` [PATCH 3/4] docs/zh_CN: Update rust/arch-support.rst translation Ben Guo
@ 2026-07-08  5:25 ` Ben Guo
  2026-07-10 12:03 ` [PATCH 0/4] docs/zh_CN: update rust documentation translations Gary Guo
  4 siblings, 0 replies; 8+ messages in thread
From: Ben Guo @ 2026-07-08  5:25 UTC (permalink / raw)
  To: Alex Shi, Yanteng Si, Dongliang Mu, Jonathan Corbet
  Cc: linux-doc, linux-kernel, rust-for-linux, hust-os-kernel-patches

Update Documentation/rust/testing.rst translation.

Update the translation through commit 09699b24199a
("Documentation: rust: testing: add Kconfig guidance")

Signed-off-by: Ben Guo <ben.guo@openatom.club>
---
 Documentation/translations/zh_CN/rust/testing.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/translations/zh_CN/rust/testing.rst b/Documentation/translations/zh_CN/rust/testing.rst
index ca81f1cef6e..6747d001299 100644
--- a/Documentation/translations/zh_CN/rust/testing.rst
+++ b/Documentation/translations/zh_CN/rust/testing.rst
@@ -128,10 +128,13 @@ Rust 测试中常用的断言宏是来自 Rust 标准库( ``core`` )中的 `
 
 这些测试通过 ``kunit_tests`` 过程宏引入,该宏将测试套件的名称作为参数。
 
+每个测试套件都应该由 ``rust/kernel/Kconfig.test`` 中的 Kconfig 选项保护。
+
 例如,假设想要测试前面文档测试示例中的函数 ``f``,我们可以在定义该函数的同一文件中编写:
 
 .. code-block:: rust
 
+	#[cfg(CONFIG_RUST_MYMOD_KUNIT_TEST)]
 	#[kunit_tests(rust_kernel_mymod)]
 	mod tests {
 	    use super::*;
@@ -158,6 +161,7 @@ Rust 测试中常用的断言宏是来自 Rust 标准库( ``core`` )中的 `
 
 .. code-block:: rust
 
+	#[cfg(CONFIG_RUST_MYMOD_KUNIT_TEST)]
 	#[kunit_tests(rust_kernel_mymod)]
 	mod tests {
 	    use super::*;
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/4] docs/zh_CN: Update rust/general-information.rst translation
  2026-07-08  5:25 ` [PATCH 2/4] docs/zh_CN: Update rust/general-information.rst translation Ben Guo
@ 2026-07-08 11:56   ` Gary Guo
  2026-07-10  2:24     ` Ben Guo
  0 siblings, 1 reply; 8+ messages in thread
From: Gary Guo @ 2026-07-08 11:56 UTC (permalink / raw)
  To: Ben Guo, Alex Shi, Yanteng Si, Dongliang Mu, Jonathan Corbet
  Cc: linux-doc, linux-kernel, rust-for-linux, hust-os-kernel-patches

On Wed Jul 8, 2026 at 6:25 AM BST, Ben Guo wrote:
> Update Documentation/rust/general-information.rst translation.
>
> Update the translation through commit 86c5d1c6740c
> ("docs: rust: general-information: use real example")
>
> Signed-off-by: Ben Guo <ben.guo@openatom.club>
> ---
>  .../zh_CN/rust/general-information.rst        | 82 ++++++++++++++++++-
>  1 file changed, 79 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/translations/zh_CN/rust/general-information.rst b/Documentation/translations/zh_CN/rust/general-information.rst
> index 9b5e37e13f3..043eb87588f 100644
> --- a/Documentation/translations/zh_CN/rust/general-information.rst
> +++ b/Documentation/translations/zh_CN/rust/general-information.rst
> @@ -13,6 +13,14 @@
>  
>  本文档包含了在内核中使用Rust支持时需要了解的有用信息。
>  
> +``no_std``
> +----------
> +
> +内核中的 Rust 支持只能链接 `core <https://doc.rust-lang.org/core/>`_,
> +而不能链接 `std <https://doc.rust-lang.org/std/>`_。供内核使用的 crate
> +必须使用 ``#![no_std]`` 属性选择这种行为。
> +
> +
>  .. _rust_code_documentation_zh_cn:
>  
>  代码文档
> @@ -20,10 +28,18 @@
>  
>  Rust内核代码使用其内置的文档生成器 ``rustdoc`` 进行记录。
>  
> -生成的HTML文档包括集成搜索、链接项(如类型、函数、常量)、源代码等。它们可以在以下地址阅读
> -(TODO:当在主线中时链接,与其他文档一起生成):
> +生成的HTML文档包括集成搜索、链接项(如类型、函数、常量)、源代码等。
> +它们可以在以下地址阅读:
> +
> +		https://rust.docs.kernel.org
> +
> +对于 linux-next,请参阅:
>  
> -	http://kernel.org/
> +		https://rust.docs.kernel.org/next/
> +
> +每个主要版本也有对应的标签,例如:
> +
> +		https://rust.docs.kernel.org/6.10/
>  
>  这些文档也可以很容易地在本地生成和阅读。这相当快(与编译代码本身的顺序相同),而且不需要特
>  殊的工具或环境。这有一个额外的好处,那就是它们将根据所使用的特定内核配置进行定制。要生成它
> @@ -62,6 +78,58 @@ Rust内核代码使用其内置的文档生成器 ``rustdoc`` 进行记录。
>  模块(例如,驱动程序)不应该直接使用C语言的绑定。相反,子系统应该根据需要提供尽可能安
>  全的抽象。
>  
> +.. code-block::
> +
> +	                                                rust/bindings/
> +	                                               (rust/helpers/)
> +
> +	                                                   include/ -----+ <-+
> +	                                                                 |   |
> +	  drivers/              rust/kernel/              +----------+ <-+   |
> +	    fs/                                           | bindgen  |       |
> +	   .../            +-------------------+          +----------+ --+   |
> +	                   |    Abstractions   |                         |   |
> +	+---------+        | +------+ +------+ |          +----------+   |   |
> +	| my_foo  | -----> | | foo  | | bar  | | -------> | Bindings | <-+   |
> +	| driver  |  Safe  | | sub- | | sub- | |  Unsafe  |          |       |
> +	+---------+        | |system| |system| |          | bindings | <-----+
> +	     |             | +------+ +------+ |          |  crate   |       |
> +	     |             |   kernel crate    |          +----------+       |
> +	     |             +-------------------+                             |
> +	     |                                                               |
> +	     +------------------# FORBIDDEN #--------------------------------+
> +
> +主要思想是将所有与内核 C API 的直接交互封装到经过仔细审查和文档化的抽象
> +中。这样,只要满足以下条件,这些抽象的用户就不能引入未定义行为
> +(undefined behavior,UB):
> +
> +#. 抽象是正确的("sound")。

sound should be translated to "可靠".

Best,
Gary

> +#. 任何 ``unsafe`` 块都遵守调用块内操作所需的安全契约。类似地,任何
> +   ``unsafe impl`` 都遵守实现该特性所需的安全契约。
> +
> +绑定
> +~~~~
> +
> +通过从 ``include/`` 中将 C 头文件包含到
> +``rust/bindings/bindings_helper.h``, ``bindgen`` 工具将为所包含的子系统
> +自动生成绑定。构建后,请查看 ``rust/bindings/`` 目录中的
> +``*_generated.rs`` 输出文件。
> +
> +对于 ``bindgen`` 不会自动生成的 C 头文件部分,例如 C ``inline`` 函数或
> +非平凡宏,可以在 ``rust/helpers/`` 中添加一个小型包装函数,使其也可供
> +Rust 端使用。
> +
> +抽象
> +~~~~
> +
> +抽象是绑定和内核内用户之间的层。它们位于 ``rust/kernel/`` 中,其作用是
> +将对绑定的不安全访问封装到尽可能安全并暴露给用户的 API 中。抽象的用户
> +包括用 Rust 编写的驱动程序或文件系统等。
> +
> +除了安全方面,这些抽象还应该易于使用,也就是说,把 C 接口转换为符合
> +Rust 惯例的代码。基本示例包括将 C 的资源获取和释放转换为 Rust 的初始化
> +和清理模式,或者将 C 整数错误码转换为 Rust 的 ``Result``。
> +
>  
>  有条件的编译
>  ------------
> @@ -74,3 +142,11 @@ Rust代码可以访问基于内核配置的条件性编译:
>  	#[cfg(CONFIG_X="y")]   // Enabled as a built-in (`y`)
>  	#[cfg(CONFIG_X="m")]   // Enabled as a module   (`m`)
>  	#[cfg(not(CONFIG_X))]  // Disabled
> +
> +对于 Rust 的 ``cfg`` 不支持的其他条件,例如带有数值比较的表达式,可以
> +定义一个新的 Kconfig 符号:
> +
> +.. code-block:: kconfig
> +
> +	config RUSTC_HAS_SPAN_FILE
> +		def_bool RUSTC_VERSION >= 108800



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/4] docs/zh_CN: Update rust/general-information.rst translation
  2026-07-08 11:56   ` Gary Guo
@ 2026-07-10  2:24     ` Ben Guo
  0 siblings, 0 replies; 8+ messages in thread
From: Ben Guo @ 2026-07-10  2:24 UTC (permalink / raw)
  To: Gary Guo, Alex Shi, Yanteng Si, Dongliang Mu, Jonathan Corbet
  Cc: linux-doc, linux-kernel, rust-for-linux, hust-os-kernel-patches

On 7/8/26 7:56 PM, Gary Guo wrote:
> sound should be translated to "可靠".
> 
> Best,
> Gary
Hi Gary,

Thanks for the review.

I'll update it in v2.

Thanks,
Ben

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/4] docs/zh_CN: update rust documentation translations
  2026-07-08  3:13 [PATCH 0/4] docs/zh_CN: update rust documentation translations Ben Guo
                   ` (3 preceding siblings ...)
  2026-07-08  5:25 ` [PATCH 4/4] docs/zh_CN: Update rust/testing.rst translation Ben Guo
@ 2026-07-10 12:03 ` Gary Guo
  4 siblings, 0 replies; 8+ messages in thread
From: Gary Guo @ 2026-07-10 12:03 UTC (permalink / raw)
  To: Ben Guo, Alex Shi, Yanteng Si, Dongliang Mu, Jonathan Corbet
  Cc: linux-doc, linux-kernel, rust-for-linux, hust-os-kernel-patches

On Wed Jul 8, 2026 at 4:13 AM BST, Ben Guo wrote:
> Update Chinese translations for the Rust subsystem documentation,
> syncing with the latest upstream changes.
>
> - quick-start.rst: update distro-specific install instructions, Ubuntu
>   package versions, openSUSE rust-src package, and remove GDB/Binutils note
> - general-information.rst: add no_std section, rustdoc links, abstractions
>   and bindings diagram, Bindings/Abstractions sections, and Kconfig example
> - arch-support.rst: add s390 support note
> - testing.rst: add Kconfig guidance for KUnit test suites
>
> Ben Guo (4):
>   docs/zh_CN: Update rust/quick-start.rst translation
>   docs/zh_CN: Update rust/general-information.rst translation
>   docs/zh_CN: Update rust/arch-support.rst translation
>   docs/zh_CN: Update rust/testing.rst translation

Reviewed-by: Gary Guo <gary@garyguo.net>

with the translation of "sound" fixed.

Best,
Gary

>
>  .../translations/zh_CN/rust/arch-support.rst  |  1 +
>  .../zh_CN/rust/general-information.rst        | 82 ++++++++++++++++++-
>  .../translations/zh_CN/rust/quick-start.rst   | 48 +++++------
>  .../translations/zh_CN/rust/testing.rst       |  4 +
>  4 files changed, 103 insertions(+), 32 deletions(-)



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-07-10 12:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08  3:13 [PATCH 0/4] docs/zh_CN: update rust documentation translations Ben Guo
2026-07-08  3:13 ` [PATCH 1/4] docs/zh_CN: Update rust/quick-start.rst translation Ben Guo
2026-07-08  5:25 ` [PATCH 2/4] docs/zh_CN: Update rust/general-information.rst translation Ben Guo
2026-07-08 11:56   ` Gary Guo
2026-07-10  2:24     ` Ben Guo
2026-07-08  5:25 ` [PATCH 3/4] docs/zh_CN: Update rust/arch-support.rst translation Ben Guo
2026-07-08  5:25 ` [PATCH 4/4] docs/zh_CN: Update rust/testing.rst translation Ben Guo
2026-07-10 12:03 ` [PATCH 0/4] docs/zh_CN: update rust documentation translations Gary Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox