mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-23 07:06:19 +02:00
zh-Hans: translate src/basic-syntax/dangling-references.md (#725)
This commit is contained in:
parent
cee01c4f6a
commit
c402f512f4
@ -102,7 +102,7 @@ msgstr "引用"
|
||||
|
||||
#: src/SUMMARY.md:30
|
||||
msgid "Dangling References"
|
||||
msgstr ""
|
||||
msgstr "悬垂引用"
|
||||
|
||||
#: src/SUMMARY.md:31
|
||||
msgid "Slices"
|
||||
@ -2621,11 +2621,11 @@ msgstr ""
|
||||
|
||||
#: src/basic-syntax/references-dangling.md:1
|
||||
msgid "# Dangling References"
|
||||
msgstr ""
|
||||
msgstr "# 悬垂引用(Dangling References)"
|
||||
|
||||
#: src/basic-syntax/references-dangling.md:3
|
||||
msgid "Rust will statically forbid dangling references:"
|
||||
msgstr ""
|
||||
msgstr "Rust 会静态地禁止悬垂引用:"
|
||||
|
||||
#: src/basic-syntax/references-dangling.md:5
|
||||
msgid ""
|
||||
@ -2640,6 +2640,16 @@ msgid ""
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable,compile_fail\n"
|
||||
"fn main() {\n"
|
||||
" let ref_x: &i32;\n"
|
||||
" {\n"
|
||||
" let x: i32 = 10;\n"
|
||||
" ref_x = &x;\n"
|
||||
" }\n"
|
||||
" println!(\"ref_x: {ref_x}\");\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/basic-syntax/references-dangling.md:16
|
||||
msgid ""
|
||||
@ -2648,6 +2658,9 @@ msgid ""
|
||||
" enough.\n"
|
||||
"* We will talk more about borrowing when we get to ownership."
|
||||
msgstr ""
|
||||
"* 一个引用被认为是“借用(borrow)”了它指向的值。\n"
|
||||
"* Rust 会跟踪所有引用的生命周期,以确保这些值的存活时间足够长。\n"
|
||||
"* 我们会在讲到所有权(ownership)时详细讨论借用(borrow)。"
|
||||
|
||||
#: src/basic-syntax/slices.md:1
|
||||
msgid "# Slices"
|
||||
|
Loading…
x
Reference in New Issue
Block a user