Skip to content

Commit 6f1b370

Browse files
committed
付録B: 演算子と記号の和訳をアップデート
rust-lang/book@19c40bf
1 parent b035fcd commit 6f1b370

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

src/appendix-02-operators.md

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ overload that operator is listed.
4040
|----------|---------|-------------|---------------|
4141
| `!` | `ident!(...)`, `ident!{...}`, `ident![...]` | Macro expansion | |
4242
| `!` | `!expr` | Bitwise or logical complement | `Not` |
43-
| `!=` | `var != expr` | Nonequality comparison | `PartialEq` |
43+
| `!=` | `expr != expr` | Nonequality comparison | `PartialEq` |
4444
| `%` | `expr % expr` | Arithmetic remainder | `Rem` |
4545
| `%=` | `var %= expr` | Arithmetic remainder and assignment | `RemAssign` |
4646
| `&` | `&expr`, `&mut expr` | Borrow | |
4747
| `&` | `&type`, `&mut type`, `&'a type`, `&'a mut type` | Borrowed pointer type | |
4848
| `&` | `expr & expr` | Bitwise AND | `BitAnd` |
4949
| `&=` | `var &= expr` | Bitwise AND and assignment | `BitAndAssign` |
50-
| `&&` | `expr && expr` | Logical AND | |
50+
| `&&` | `expr && expr` | Short-circuiting logical AND | |
5151
| `*` | `expr * expr` | Arithmetic multiplication | `Mul` |
5252
| `*=` | `var *= expr` | Arithmetic multiplication and assignment | `MulAssign` |
53-
| `*` | `*expr` | Dereference | |
53+
| `*` | `*expr` | Dereference | `Deref` |
5454
| `*` | `*const type`, `*mut type` | Raw pointer | |
5555
| `+` | `trait + trait`, `'a + trait` | Compound type constraint | |
5656
| `+` | `expr + expr` | Arithmetic addition | `Add` |
@@ -59,12 +59,13 @@ overload that operator is listed.
5959
| `-` | `- expr` | Arithmetic negation | `Neg` |
6060
| `-` | `expr - expr` | Arithmetic subtraction | `Sub` |
6161
| `-=` | `var -= expr` | Arithmetic subtraction and assignment | `SubAssign` |
62-
| `->` | `fn(...) -> type`, <code>\|...\| -> type</code> | Function and closure return type | |
62+
| `->` | `fn(...) -> type`, <code>&vert;...&vert; -> type</code> | Function and closure return type | |
6363
| `.` | `expr.ident` | Member access | |
64-
| `..` | `..`, `expr..`, `..expr`, `expr..expr` | Right-exclusive range literal | |
64+
| `..` | `..`, `expr..`, `..expr`, `expr..expr` | Right-exclusive range literal | `PartialOrd` |
65+
| `..=` | `..=expr`, `expr..=expr` | Right-inclusive range literal | `PartialOrd` |
6566
| `..` | `..expr` | Struct literal update syntax | |
6667
| `..` | `variant(x, ..)`, `struct_type { x, .. }` | “And the rest” pattern binding | |
67-
| `...` | `expr...expr` | In a pattern: inclusive range pattern | |
68+
| `...` | `expr...expr` | (Deprecated, use `..=` instead) In a pattern: inclusive range pattern | |
6869
| `/` | `expr / expr` | Arithmetic division | `Div` |
6970
| `/=` | `var /= expr` | Arithmetic division and assignment | `DivAssign` |
7071
| `:` | `pat: type`, `ident: type` | Constraints | |
@@ -86,27 +87,27 @@ overload that operator is listed.
8687
| `@` | `ident @ pat` | Pattern binding | |
8788
| `^` | `expr ^ expr` | Bitwise exclusive OR | `BitXor` |
8889
| `^=` | `var ^= expr` | Bitwise exclusive OR and assignment | `BitXorAssign` |
89-
| <code>\|</code> | <code>pat \| pat</code> | Pattern alternatives | |
90-
| <code>\|</code> | <code>expr \| expr</code> | Bitwise OR | `BitOr` |
91-
| <code>\|=</code> | <code>var \|= expr</code> | Bitwise OR and assignment | `BitOrAssign` |
92-
| <code>\|\|</code> | <code>expr \|\| expr</code> | Logical OR | |
90+
| <code>&vert;</code> | <code>pat &vert; pat</code> | Pattern alternatives | |
91+
| <code>&vert;</code> | <code>expr &vert; expr</code> | Bitwise OR | `BitOr` |
92+
| <code>&vert;=</code> | <code>var &vert;= expr</code> | Bitwise OR and assignment | `BitOrAssign` |
93+
| <code>&vert;&vert;</code> | <code>expr &vert;&vert; expr</code> | Short-circuiting logical OR | |
9394
| `?` | `expr?` | Error propagation | |
9495
-->
9596

9697
| 演算子 || 説明 | オーバーロードできる? |
9798
|-------------------|--------------------------------------------------|--------------------------|---------------------|
9899
| `!` | `ident!(...)`, `ident!{...}`, `ident![...]` | マクロ展開 ||
99100
| `!` | `!expr` | ビット反転、または論理反転 | `Not` |
100-
| `!=` | `var != expr` | 非等価比較 | `PartialEq` |
101+
| `!=` | `expr != expr` | 非等価比較 | `PartialEq` |
101102
| `%` | `expr % expr` | 余り演算 | `Rem` |
102103
| `%=` | `var %= expr` | 余り演算後に代入 | `RemAssign` |
103104
| `&` | `&expr`, `&mut expr` | 借用 ||
104105
| `&` | `&type`, `&mut type`, `&'a type`, `&'a mut type` | 借用されたポインタ型 ||
105106
| `&` | `expr & expr` | ビットAND | `BitAnd` |
106107
| `&=` | `var &= expr` | ビットAND後に代入 | `BitAndAssign` |
107-
| `&&` | `expr && expr` | 論理AND ||
108+
| `&&` | `expr && expr` | 短絡論理AND ||
108109
| `*` | `expr * expr` | 掛け算 | `Mul` |
109-
| `*` | `*expr` | 参照外し ||
110+
| `*` | `*expr` | 参照外し | `Deref` |
110111
| `*` | `*const type`, `*mut type` | 生ポインタ ||
111112
| `*=` | `var *= expr` | 掛け算後に代入 | `MulAssign` |
112113
| `+` | `trait + trait`, `'a + trait` | 型制限の複合化 ||
@@ -116,12 +117,13 @@ overload that operator is listed.
116117
| `-` | `- expr` | 算術否定 | `Neg` |
117118
| `-` | `expr - expr` | 引き算 | `Sub` |
118119
| `-=` | `var -= expr` | 引き算後に代入 | `SubAssign` |
119-
| `->` | `fn(...) -> type`, <code>\|...\| -> type</code> | 関数とクロージャの戻り値型 ||
120+
| `->` | `fn(...) -> type`, <code>&vert;...&vert; -> type</code> | 関数とクロージャの戻り値型 ||
120121
| `.` | `expr.ident` | メンバーアクセス ||
121-
| `..` | `..`, `expr..`, `..expr`, `expr..expr` | 未満範囲リテラル ||
122+
| `..` | `..`, `expr..`, `..expr`, `expr..expr` | 未満範囲リテラル | `PartialOrd` |
123+
| `..=` | `..=expr`, `expr..=expr` | 以下範囲リテラル | `PartialOrd` |
122124
| `..` | `..expr` | 構造体リテラル更新記法 ||
123125
| `..` | `variant(x, ..)`, `struct_type { x, .. }` | 「残り全部」パターン束縛 ||
124-
| `...` | `expr...expr` | パターンで: 以下範囲パターン ||
126+
| `...` | `expr...expr` | (非推奨、代わりに`..=`を使用してください) パターンで: 以下範囲パターン ||
125127
| `/` | `expr / expr` | 割り算 | `Div` |
126128
| `/=` | `var /= expr` | 割り算後に代入 | `DivAssign` |
127129
| `:` | `pat: type`, `ident: type` | 型制約 ||
@@ -143,11 +145,11 @@ overload that operator is listed.
143145
| `@` | `ident @ pat` | パターン束縛 ||
144146
| `^` | `expr ^ expr` | ビットXOR | `BitXor` |
145147
| `^=` | `var ^= expr` | ビットXOR後に代入 | `BitXorAssign` |
146-
| <code>\|</code> | <code>pat \| pat</code> | パターンOR ||
147-
| <code>\|</code> | <code>\|\| expr</code> | クロージャ ||
148-
| <code>\|</code> | <code>expr \| expr</code> | ビットOR | `BitOr` |
149-
| <code>\|=</code> | <code>var \|= expr</code> | ビットOR後に代入 | `BitOrAssign`|
150-
| <code>\|\|</code> | <code>expr \|\| expr</code> | 論理OR ||
148+
| <code>&vert;</code> | <code>pat &vert; pat</code> | パターンOR ||
149+
| <code>&vert;</code> | <code>&vert;&vert; expr</code> | クロージャ ||
150+
| <code>&vert;</code> | <code>expr &vert; expr</code> | ビットOR | `BitOr` |
151+
| <code>&vert;=</code> | <code>var &vert;= expr</code> | ビットOR後に代入 | `BitOrAssign`|
152+
| <code>&vert;&vert;</code> | <code>expr &vert;&vert; expr</code> | 短絡論理OR ||
151153
| `?` | `expr?` | エラー委譲 ||
152154

153155
<!--
@@ -157,8 +159,8 @@ overload that operator is listed.
157159
### 演算子以外のシンボル
158160

159161
<!--
160-
The following list contains all non-letters that don’t function as operators;
161-
that is, they don’t behave like a function or method call.
162+
The following list contains all symbols that don’t function as operators; that
163+
is, they don’t behave like a function or method call.
162164
-->
163165

164166
以下のリストは、演算子として機能しない記号全部を含んでいます; つまり、関数やメソッド呼び出しのようには、
@@ -184,11 +186,11 @@ locations.
184186
| `...u8`, `...i32`, `...f64`, `...usize`, etc. | Numeric literal of specific type |
185187
| `"..."` | String literal |
186188
| `r"..."`, `r#"..."#`, `r##"..."##`, etc. | Raw string literal, escape characters not processed |
187-
| `b"..."` | Byte string literal; constructs a `[u8]` instead of a string |
189+
| `b"..."` | Byte string literal; constructs an array of bytes instead of a string |
188190
| `br"..."`, `br#"..."#`, `br##"..."##`, etc. | Raw byte string literal, combination of raw and byte string literal |
189191
| `'...'` | Character literal |
190192
| `b'...'` | ASCII byte literal |
191-
| <code>\|...\| expr</code> | Closure |
193+
| <code>&vert;...&vert; expr</code> | Closure |
192194
| `!` | Always empty bottom type for diverging functions |
193195
| `_` | “Ignored” pattern binding; also used to make integer literals readable |
194196
-->
@@ -199,11 +201,11 @@ locations.
199201
| `...u8`, `...i32`, `...f64`, `...usize`など | 特定の型の数値リテラル |
200202
| `"..."` | 文字列リテラル|
201203
| `r"..."`, `r#"..."#`, `r##"..."##`など | 生文字列リテラル、エスケープ文字は処理されません |
202-
| `b"..."` | バイト文字列リテラル、文字列の代わりに`[u8]`を構築します |
204+
| `b"..."` | バイト文字列リテラル、文字列の代わりにバイト列を構築します |
203205
| `br"..."`, `br#"..."#`, `br##"..."##`など | 生バイト文字列リテラル、生文字列とバイト文字列の組み合わせ |
204206
| `'...'` | 文字リテラル |
205207
| `b'...'` | ASCIIバイトリテラル |
206-
| <code>\|...\| expr</code> | クロージャ |
208+
| <code>&vert;...&vert; expr</code> | クロージャ |
207209
| `!` | 常に発散関数の空のボトム型 |
208210
| `_` | 「無視」パターン束縛: 整数リテラルを見やすくするのにも使われる|
209211

@@ -301,7 +303,7 @@ parameters with trait bounds.
301303
|--------|-------------|
302304
| `T: U` | Generic parameter `T` constrained to types that implement `U` |
303305
| `T: 'a` | Generic type `T` must outlive lifetime `'a` (meaning the type cannot transitively contain any references with lifetimes shorter than `'a`) |
304-
| `T : 'static` | Generic type `T` contains no borrowed references other than `'static` ones |
306+
| `T: 'static` | Generic type `T` contains no borrowed references other than `'static` ones |
305307
| `'b: 'a` | Generic lifetime `'b` must outlive lifetime `'a` |
306308
| `T: ?Sized` | Allow generic type parameter to be a dynamically sized type |
307309
| `'a + trait`, `trait + trait` | Compound type constraint |
@@ -311,7 +313,7 @@ parameters with trait bounds.
311313
|-------------------------------|-----|
312314
| `T: U` | `U`を実装する型に制約されるジェネリック引数`T` |
313315
| `T: 'a` | ライフタイム`'a`よりも長生きしなければならないジェネリック型`T`(型がライフタイムより長生きするとは、`'a`よりも短いライフタイムの参照を何も遷移的に含められないことを意味する)|
314-
| `T : 'static` | ジェネリック型`T``'static`なもの以外の借用された参照を何も含まない |
316+
| `T: 'static` | ジェネリック型`T``'static`なもの以外の借用された参照を何も含まない |
315317
| `'b: 'a` | ジェネリックなライフタイム`'b`がライフタイム`'a`より長生きしなければならない |
316318
| `T: ?Sized` | ジェネリック型引数が動的サイズ決定型であることを許容する |
317319
| `'a + trait`, `trait + trait` | 複合型制約 |
@@ -337,6 +339,7 @@ macros and specifying attributes on an item.
337339
| `$ident` | Macro substitution |
338340
| `$ident:kind` | Macro capture |
339341
| `$(…)…` | Macro repetition |
342+
| `ident!(...)`, `ident!{...}`, `ident![...]` | Macro invocation |
340343
-->
341344

342345
| シンボル | 説明 |
@@ -346,6 +349,7 @@ macros and specifying attributes on an item.
346349
| `$ident` | マクロ代用 |
347350
| `$ident:kind` | マクロキャプチャ |
348351
| `$(…)…` | マクロの繰り返し |
352+
| `ident!(...)`, `ident!{...}`, `ident![...]` | マクロ呼び出し |
349353

350354
<!--
351355
Table B-7 shows symbols that create comments.
@@ -407,7 +411,6 @@ Table B-8 shows symbols that appear in the context of using tuples.
407411
| `(expr, ...)` | Tuple expression |
408412
| `(type, ...)` | Tuple type |
409413
| `expr(expr, ...)` | Function call expression; also used to initialize tuple `struct`s and tuple `enum` variants |
410-
| `ident!(...)`, `ident!{...}`, `ident![...]` | Macro invocation |
411414
| `expr.0`, `expr.1`, etc. | Tuple indexing |
412415
-->
413416

@@ -420,7 +423,6 @@ Table B-8 shows symbols that appear in the context of using tuples.
420423
| `(expr, ...)` | タプル式 |
421424
| `(type, ...)` | タプル型 |
422425
| `expr(expr, ...)` | 関数呼び出し式; タプル`struct`やタプル`enum`列挙子を初期化するのにも使用される |
423-
| `ident!(...)`, `ident!{...}`, `ident![...]` | マクロ呼び出し |
424426
| `expr.0`, `expr.1`, など | タプル添え字アクセス |
425427

426428
<!--

0 commit comments

Comments
 (0)