Skip to content

Commit d6477e2

Browse files
committed
付録A: キーワードの和訳をアップデート
rust-lang/book@19c40bf
1 parent 7351cd9 commit d6477e2

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

src/appendix-01-keywords.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
The following list contains keywords that are reserved for current or future
99
use by the Rust language. As such, they cannot be used as identifiers (except
1010
as raw identifiers as we’ll discuss in the “[Raw
11-
Identifiers][raw-identifiers]” section), including names of
12-
functions, variables, parameters, struct fields, modules, crates, constants,
11+
Identifiers][raw-identifiers]” section). Identifiers are names
12+
of functions, variables, parameters, struct fields, modules, crates, constants,
1313
macros, static values, attributes, types, traits, or lifetimes.
1414
-->
1515

1616
以下のリストは、現在、あるいは将来Rust言語により使用されるために予約されているキーワードです。
17-
そのため、識別子として使用することはできません。識別子には、関数名、変数名、引数名、構造体のフィールド名、モジュール名、クレート名、定数名、マクロ名、静的な値の名前、属性名、型名、トレイト名、ライフタイム名などがあります
18-
ただし、[生識別子][raw-identifiers]のところで議論する生識別子は例外です
17+
そのため、識別子として使用することはできません(ただし、[生識別子][raw-identifiers]のところで議論する生識別子は例外です)
18+
識別子とは、関数、変数、引数、構造体のフィールド、モジュール、クレート、定数、マクロ、静的な値、属性、型、トレイト、またはライフタイムの名前です
1919

2020
[raw-identifiers]: #raw-identifiers
2121

@@ -26,25 +26,25 @@ macros, static values, attributes, types, traits, or lifetimes.
2626
### 現在使用されているキーワード
2727

2828
<!--
29-
The following keywords currently have the functionality described.
29+
The following is a list of keywords currently in use, with their functionality
30+
described.
3031
-->
3132

32-
以下のキーワードは、解説された通りの機能が現状あります
33+
以下は現在使用されているキーワードと、その機能の一覧です
3334

3435
<!--
3536
* `as` - perform primitive casting, disambiguate the specific trait containing
36-
an item, or rename items in `use` and `extern crate` statements
37+
an item, or rename items in `use` statements
3738
* `async` - return a `Future` instead of blocking the current thread
3839
* `await` - suspend execution until the result of a `Future` is ready
3940
* `break` - exit a loop immediately
4041
* `const` - define constant items or constant raw pointers
4142
* `continue` - continue to the next loop iteration
42-
* `crate` - link an external crate or a macro variable representing the crate in
43-
which the macro is defined
43+
* `crate` - in a module path, refers to the crate root
4444
* `dyn` - dynamic dispatch to a trait object
4545
* `else` - fallback for `if` and `if let` control flow constructs
4646
* `enum` - define an enumeration
47-
* `extern` - link an external crate, function, or variable
47+
* `extern` - link an external function or variable
4848
* `false` - Boolean false literal
4949
* `fn` - define a function or the function pointer type
5050
* `for` - loop over items from an iterator, implement a trait, or specify a
@@ -69,7 +69,8 @@ The following keywords currently have the functionality described.
6969
* `trait` - define a trait
7070
* `true` - Boolean true literal
7171
* `type` - define a type alias or associated type
72-
* `union` - define a [union] and is only a keyword when used in a union declaration
72+
* `union` - define a [union][union]; is only a keyword when used
73+
in a union declaration
7374
* `unsafe` - denote unsafe code, functions, traits, or implementations
7475
* `use` - bring symbols into scope
7576
* `where` - denote clauses that constrain a type
@@ -82,16 +83,16 @@ The following keywords currently have the functionality described.
8283
higher-ranked lifetimeについては議論の余地ありか
8384
-->
8485

85-
* `as` - 基礎的なキャストの実行、要素を含む特定のトレイトの明確化、`use``extern crate`文の要素名を変更する
86+
* `as` - 基礎的なキャストの実行、要素を含む特定のトレイトの明確化、`use`文の要素名を変更する
8687
* `async` - 現在のスレッドをブロックする代わりに`Future`を返す
8788
* `await` - `Future`の結果が準備できるまで実行を停止する
8889
* `break` - 即座にループを抜ける
8990
* `const` - 定数要素か定数の生ポインタを定義する
9091
* `continue` - 次のループの繰り返しに継続する
91-
* `crate` - 外部のクレートかマクロが定義されているクレートを表すマクロ変数をリンクする
92+
* `crate` - モジュールパス内で、クレートルートを表す
9293
* `else` - `if``if let`制御フロー構文の規定
9394
* `enum` - 列挙型を定義する
94-
* `extern` - 外部のクレート、関数、変数をリンクする
95+
* `extern` - 外部の関数、変数をリンクする
9596
* `false` - bool型のfalseリテラル
9697
* `fn` - 関数か関数ポインタ型を定義する
9798
* `for` - イテレータの要素を繰り返す、トレイトの実装、高階ライフタイムの指定
@@ -115,6 +116,7 @@ higher-ranked lifetimeについては議論の余地ありか
115116
* `trait` - トレイトを定義する
116117
* `true` - bool型のtrueリテラル
117118
* `type` - 型エイリアスか関連型を定義する
119+
* `union` - [共用体][union]を定義する; 共用体宣言内で使用される場合のみキーワードです
118120
* `unsafe` - unsafeなコード、関数、トレイト、実装に言及する
119121
* `use` - スコープにシンボルを持ち込む
120122
* `where` - 型を制限する節に言及する
@@ -129,11 +131,11 @@ higher-ranked lifetimeについては議論の余地ありか
129131
### 将来的な使用のために予約されているキーワード
130132

131133
<!--
132-
The following keywords do not have any functionality but are reserved by Rust
133-
for potential future use.
134+
The following keywords do not yet have any functionality but are reserved by
135+
Rust for potential future use.
134136
-->
135137

136-
以下のキーワードには機能が何もないものの、将来的に使用される可能性があるので、Rustにより予約されています。
138+
以下のキーワードにはまだ機能が何もないものの、将来的に使用される可能性があるので、Rustにより予約されています。
137139

138140
<!--
139141
* `abstract`
@@ -243,15 +245,18 @@ name in its definition as well as where the function is called in `main`.
243245

244246
<!--
245247
Raw identifiers allow you to use any word you choose as an identifier, even if
246-
that word happens to be a reserved keyword. In addition, raw identifiers allow
247-
you to use libraries written in a different Rust edition than your crate uses.
248-
For example, `try` isn’t a keyword in the 2015 edition but is in the 2018
248+
that word happens to be a reserved keyword. This gives us more freedom to
249+
choose identifier names, as well as lets us integrate with programs written in
250+
a language where these words aren’t keywords. In addition, raw identifiers
251+
allow you to use libraries written in a different Rust edition than your crate
252+
uses. For example, `try` isn’t a keyword in the 2015 edition but is in the 2018
249253
edition. If you depend on a library that’s written using the 2015 edition and
250254
has a `try` function, you’ll need to use the raw identifier syntax, `r#try` in
251255
this case, to call that function from your 2018 edition code. See [Appendix
252256
E][appendix-e] for more information on editions.
253257
-->
254258
生識別子を使えば、仮にそれが予約されたキーワードであろうとも、任意の単語を識別子として使えるようになります。
259+
これにより識別子名の選択により大きな自由が与えられ、これらの単語がキーワードではない言語で書かれたプログラムとの統合も可能になります。
255260
更に、あなたのクレートが使っているRustのeditionとは異なるeditionで書かれたライブラリを呼び出すこともできるようになります。
256261
たとえば、`try`は2015 editionではキーワードではありませんでしたが、2018 editionではキーワードです。
257262
もし、2015 editionで書かれており、`try`関数を持っているライブラリに依存している場合、あなたの2018 editionのコードからその関数を呼び出すためには、生識別子構文を使う必要がでてくるでしょう。今回なら`r#try`ですね。

0 commit comments

Comments
 (0)