Skip to contentSkip to conversation

rust: docs: Update the translation of rust to 6.9-rc4

PATCH Superseded Yanteng Si 3 participants 10 messages Apr 23, 2024 – Apr 26, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yanteng Si

author
#0 lore raw

cover rust: docs: Update the translation of rust to 6.9-rc4

The Chinese version of rust seems to be way behind, even though we did translate to Chinese at the beginning. Let's keep them up to date. :)

Yanteng Si (4):
docs/zh_CN/rust: Update the translation of arch-support to 6.9-rc4 docs/zh_CN/rust: Update the translation of coding-guidelines to 6.9-rc4 docs/zh_CN/rust: Update the translation of general-information to 6.9-rc4 docs/zh_CN/rust: Update the translation of quick-start to 6.9-rc4

 .../translations/zh_CN/rust/arch-support.rst  | 13 +++--
 .../zh_CN/rust/coding-guidelines.rst          | 12 +++++
 .../zh_CN/rust/general-information.rst        |  2 +-
 .../translations/zh_CN/rust/quick-start.rst   | 50 +++++++++++++------
 4 files changed, 55 insertions(+), 22 deletions(-)
Signature · 1 line
2.31.4
author
#1 lore raw

PATCH 1/4 docs/zh_CN/rust: Update the translation of arch-support to 6.9-rc4

Update to commit 724a75ac9542 ("arm64: rust: Enable Rust support for AArch64")
commit 90868ff9cade ("LoongArch: Enable initial Rust support") commit e5e86572e3f2 ("rust: sort uml documentation arch support table") commit 04df97e150c8 ("Documentation: rust: Fix arch support table") commit 0438aadfa69a ("rust: arch/um: Add support for CONFIG_RUST under x86_64 UML")

---
 .../translations/zh_CN/rust/arch-support.rst        | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
Documentation/translations/zh_CN/rust/arch-support.rst +8 -5
index afbd02afec45..830df0241df0 100644
@@ -16,8 +16,11 @@
 
 下面是目前可以工作的架构的一般总结。支持程度与 ``MAINTAINERS`` 文件中的``S`` 值相对应:
 
-============  ================  ==============================================
-架构          支持水平          限制因素
-============  ================  ==============================================
-``x86``       Maintained        只有 ``x86_64``
-============  ================  ==============================================
+=============  ================  ==============================================
+架构           支持水平           限制因素
+=============  ================  ==============================================
+``arm64``      Maintained        只有小端序
+``loongarch``  Maintained        -
+``um``         Maintained        只有 ``x86_64``
+``x86``        Maintained        只有 ``x86_64``
+=============  ================  ==============================================
Signature · 1 line
2.31.4
author
#3 lore raw

Re: [PATCH v1 1/4] docs/zh_CN/rust: Update the translation of arch-support to 6.9-rc4

Quoted 8 lines · Miguel Ojeda
Quoted 1 line · Yanteng Si

+``loongarch`` Maintained -

We had a recent rendering fix here that you may want to consider:

https://lore.kernel.org/rust-for-linux/[email protected]/

Thanks for this Yanteng!

Okay!

Thanks,

Yanteng

author
#4 lore raw

PATCH 2/4 docs/zh_CN/rust: Update the translation of coding-guidelines to 6.9-rc4

In reply to Yanteng Si

Update to commit bc2e7d5c298a ("rust: support srctree-relative links")

---
 .../translations/zh_CN/rust/coding-guidelines.rst    | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/translations/zh_CN/rust/coding-guidelines.rst +12 -0
index 6c0bdbbc5a2a..d02e2dbff509 100644
@@ -157,6 +157,18 @@ https://commonmark.org/help/
 
 	https://doc.rust-lang.org/rustdoc/how-to-write-documentation.html
 
+此外,内核支持通过在链接目标前缀 ``srctree/`` 来创建相对于源代码树的链接。例如:
+
+.. code-block:: rust
+
+       //! C header: [`include/linux/printk.h`](srctree/include/linux/printk.h)
+
+或者:
+
+.. code-block:: rust
+
+       /// [`struct mutex`]: srctree/include/linux/mutex.h
+
 
 命名
 ----
Signature · 1 line
2.31.4
#5 lore raw

Re: [PATCH v1 2/4] docs/zh_CN/rust: Update the translation of coding-guidelines to 6.9-rc4

Quoted 13 lines · Yanteng Si

Update to commit bc2e7d5c298a ("rust: support srctree-relative links")

---
 .../translations/zh_CN/rust/coding-guidelines.rst    | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/translations/zh_CN/rust/coding-guidelines.rst +0 -0
index 6c0bdbbc5a2a..d02e2dbff509 100644

Documentation/translations/zh_CN/rust/coding-guidelines.rst https://commonmark.org/help/ · line 160

Quoted 4 lines
Documentation/translations/zh_CN/rust/coding-guidelines.rst +1 -0
@@ -157,6 +157,18 @@ https://commonmark.org/help/
 
        https://doc.rust-lang.org/rustdoc/how-to-write-documentation.html
 
+此外,内核支持通过在链接目标前缀 ``srctree/`` 来创建相对于源代码树的链接。例如:

前缀通常被用作名词。建议可以改成:

此外,内核支持通过在链接目标前添加 ``srctree/`` 来创建相对于源代码树的链接。例如:

Quoted 18 lines
Documentation/translations/zh_CN/rust/coding-guidelines.rst +11 -1
+
+.. code-block:: rust
+
+       //! C header: [`include/linux/printk.h`](srctree/include/linux/printk.h)
+
+或者:
+
+.. code-block:: rust
+
+       /// [`struct mutex`]: srctree/include/linux/mutex.h
+
 
 命名
 ----
--

2.31.4

#6 lore raw

Re: [PATCH v1 2/4] docs/zh_CN/rust: Update the translation of coding-guidelines to 6.9-rc4

Quoted 16 lines · Dongliang Mu
Quoted 14 lines · Yanteng Si

Update to commit bc2e7d5c298a ("rust: support srctree-relative links")

---
 .../translations/zh_CN/rust/coding-guidelines.rst    | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/translations/zh_CN/rust/coding-guidelines.rst +0 -0
index 6c0bdbbc5a2a..d02e2dbff509 100644
@@ -157,6 +157,18 @@ https://commonmark.org/help/
 
Quoted 7 lines

Documentation/translations/zh_CN/rust/coding-guidelines.rst https://commonmark.org/help/ · line 160

Quoted 3 lines
Documentation/translations/zh_CN/rust/coding-guidelines.rst +1 -0
        https://doc.rust-lang.org/rustdoc/how-to-write-documentation.html
 
+此外,内核支持通过在链接目标前缀 ``srctree/`` 来创建相对于源代码树的链接。例如:

前缀通常被用作名词。建议可以改成:

此外,内核支持通过在链接目标前添加 ``srctree/`` 来创建相对于源代码树的链接。例如:

Translate the above comments to English:

“前缀” in Chinese usually means noun other than verb. So I suggest the liberal translation "在...前添加" other than "前缀".

Dongliang Mu

Quoted 19 lines
Quoted 19 lines
Documentation/translations/zh_CN/rust/coding-guidelines.rst +11 -1
+
+.. code-block:: rust
+
+       //! C header: [`include/linux/printk.h`](srctree/include/linux/printk.h)
+
+或者:
+
+.. code-block:: rust
+
+       /// [`struct mutex`]: srctree/include/linux/mutex.h
+
 
 命名
 ----
--

2.31.4

author
#7 lore raw

Re: [PATCH v1 2/4] docs/zh_CN/rust: Update the translation of coding-guidelines to 6.9-rc4

Quoted 20 lines · Dongliang Mu
Quoted 19 lines · Dongliang Mu
Quoted 12 lines · Yanteng Si

Update to commit bc2e7d5c298a ("rust: support srctree-relative links")

---
  .../translations/zh_CN/rust/coding-guidelines.rst    | 12 ++++++++++++
  1 file changed, 12 insertions(+)
Documentation/translations/zh_CN/rust/coding-guidelines.rst +0 -0
index 6c0bdbbc5a2a..d02e2dbff509 100644

Documentation/translations/zh_CN/rust/coding-guidelines.rst https://commonmark.org/help/ · line 160

Quoted 4 lines
Documentation/translations/zh_CN/rust/coding-guidelines.rst +1 -0
@@ -157,6 +157,18 @@ https://commonmark.org/help/
 
         https://doc.rust-lang.org/rustdoc/how-to-write-documentation.html
 
+此外,内核支持通过在链接目标前缀 ``srctree/`` 来创建相对于源代码树的链接。例如:

前缀通常被用作名词。建议可以改成:

Quoted 6 lines
Quoted 1 line

此外,内核支持通过在链接目标前添加 ``srctree/`` 来创建相对于源代码树的链接。例如:

Translate the above comments to English:

“前缀” in Chinese usually means noun other than verb. So I suggest the liberal translation "在...前添加" other than "前缀".

Okay!

Thanks,

Yanteng

Quoted 5 lines

2.31.4

author
#8 lore raw

PATCH 3/4 docs/zh_CN/rust: Update the translation of general-information to 6.9-rc4

In reply to Yanteng Si

Update to commit ba4abeb13d5e ("docs: rust: Move testing to a separate page")
commit be412baf7240 ("docs: rust: Add rusttest info") commit bd9e54a42ce2 ("docs: rust: update Rust docs output path")

---
 Documentation/translations/zh_CN/rust/general-information.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/translations/zh_CN/rust/general-information.rst +1 -1
index 6b91dfe1834a..251f6ee2bb44 100644
@@ -32,7 +32,7 @@ Rust内核代码使用其内置的文档生成器 ``rustdoc`` 进行记录。
 
 要在你的网络浏览器中本地阅读该文档,请运行如::
 
-	xdg-open rust/doc/kernel/index.html
+	xdg-open Documentation/output/rust/rustdoc/kernel/index.html
 
 要了解如何编写文档,请看 coding-guidelines.rst 。
 
Signature · 1 line
2.31.4
author
#9 lore raw

PATCH 4/4 docs/zh_CN/rust: Update the translation of quick-start to 6.9-rc4

In reply to Yanteng Si

Update to commit 711cbfc71765 ("docs: rust: Clarify that 'rustup override' applies to build directory")
commit 7583ce66ddf7 ("docs: rust: remove CC=clang mentions") commit 2285eb2f2429 ("docs: rust: clarify what 'rustup override' does") commit 8cb40124cf92 ("docs: rust: update instructions for obtaining 'core' source")
commit b603c6cc405a ("docs: rust: add command line to rust-analyzer section")
commit 08ab786556ff ("rust: bindgen: upgrade to 0.65.1") commit eae90172c5b8 ("docs: rust: add paragraph about finding a suitable libclang")
commit 6883b29c6cae ("docs: rust: point directly to the standalone installers")

---
 .../translations/zh_CN/rust/quick-start.rst   | 50 +++++++++++++------
 1 file changed, 34 insertions(+), 16 deletions(-)
Documentation/translations/zh_CN/rust/quick-start.rst +34 -16
index a4b8e8a50a89..8616556ae4d7 100644
@@ -37,13 +37,18 @@ rustc
 需要一个特定版本的Rust编译器。较新的版本可能会也可能不会工作,因为就目前而言,内核依赖
 于一些不稳定的Rust特性。
 
-如果使用的是 ``rustup`` ,请进入检出的源代码目录并运行::
+如果使用的是 ``rustup`` ,请进入内核编译目录(或者用 ``--path=<build-dir>`` 参数
+来 ``设置`` sub-command)并运行::
 
 	rustup override set $(scripts/min-tool-version.sh rustc)
 
-或者从以下网址获取一个独立的安装程序或安装 ``rustup`` :
++这将配置你的工作目录使用正确版本的 ``rustc``,而不影响你的默认工具链。
 
-	https://www.rust-lang.org
+请注意覆盖应用当前的工作目录(和它的子目录)。
+
+如果你使用 ``rustup``, 可以从下面的链接拉取一个单独的安装程序:
+
+	https://forge.rust-lang.org/infra/other-installation-methods.html#standalone
 
 
 Rust标准库源代码
@@ -57,21 +62,23 @@ Rust标准库的源代码是必需的,因为构建系统会交叉编译 ``core
 
 这些组件是按工具链安装的,因此以后升级Rust编译器版本需要重新添加组件。
 
-否则,如果使用独立的安装程序,可以将Rust仓库克隆到工具链的安装文件夹中::
+否则,如果使用独立的安装程序,可以将Rust源码树下载到安装工具链的文件夹中::
 
-	git clone --recurse-submodules \
-		--branch $(scripts/min-tool-version.sh rustc) \
-		https://github.com/rust-lang/rust \
-		$(rustc --print sysroot)/lib/rustlib/src/rust
+       curl -L "https://static.rust-lang.org/dist/rust-src-$(scripts/min-tool-version.sh rustc).tar.gz" |
+               tar -xzf - -C "$(rustc --print sysroot)/lib" \
+               "rust-src-$(scripts/min-tool-version.sh rustc)/rust-src/lib/" \
+               --strip-components=3
 
-在这种情况下,以后升级Rust编译器版本需要手动更新这个克隆的仓库。
+在这种情况下,以后升级Rust编译器版本需要手动更新这个源代码树(这可以通过移除
+``$(rustc --print sysroot)/lib/rustlib/src/rust`` ,然后重新执行上
+面的命令做到)。
 
 
 libclang
 ********
 
 ``bindgen`` 使用 ``libclang`` (LLVM的一部分)来理解内核中的C代码,这意味着需要安
-装LLVM;同在开启 ``CC=clang`` 或 ``LLVM=1`` 时编译内核一样。
+装LLVM;同在开启``LLVM=1`` 时编译内核一样。
 
 Linux发行版中可能会有合适的包,所以最好先检查一下。
 
@@ -94,7 +101,20 @@ bindgen
 
 通过以下方式安装它(注意,这将从源码下载并构建该工具)::
 
-	cargo install --locked --version $(scripts/min-tool-version.sh bindgen) bindgen
+	cargo install --locked --version $(scripts/min-tool-version.sh bindgen) bindgen-cli
+
+``bindgen`` 需要找到合适的 ``libclang`` 才能工作。如果没有找到(或者找到的
+``libclang`` 与应该使用的 ``libclang`` 不同),则可以使用 ``clang-sys``
+理解的环境变量(Rust绑定创建的 ``bindgen`` 用来访问 ``libclang``):
+
+
+* ``LLVM_CONFIG_PATH`` 可以指向一个 ``llvm-config`` 可执行文件。
+
+* 或者 ``LIBCLANG_PATH`` 可以指向 ``libclang`` 共享库或包含它的目录。
+
+* 或者 ``CLANG_PATH`` 可以指向 ``clang`` 可执行文件。
+
+详情请参阅 ``clang-sys`` 的文档:
 
 
 开发依赖
@@ -163,7 +183,9 @@ rust-analyzer
 一起使用,以实现语法高亮、补全、转到定义和其他功能。
 
 ``rust-analyzer`` 需要一个配置文件, ``rust-project.json``, 它可以由 ``rust-analyzer``
-Make 目标生成。
+Make 目标生成::
+
+       make LLVM=1 rust-analyzer
 
 
 配置
@@ -189,10 +211,6 @@ Rust支持(CONFIG_RUST)需要在 ``General setup`` 菜单中启用。在其
 
 	make LLVM=1
 
-对于不支持完整LLVM工具链的架构,使用::
-
-	make CC=clang
-
 使用GCC对某些配置也是可行的,但目前它是非常试验性的。
 
 
Signature · 1 line
2.31.4