@@ -155,23 +155,20 @@ <h2 id="インストール"><a class="header" href="#インストール">イン
155
155
-->
156
156
< p > 最初の手順は、Rustをインストールすることです。Rustは、Rustのバージョンと関連するツールを管理する、< code > rustup</ code > というコマンドラインツールを使用してダウンロードします。ダウンロードには、インターネットへの接続が必要になります。</ p >
157
157
<!--
158
- > Note: If you prefer not to use `rustup` for some reason, please see [ the Rust
159
- > installation page](https://www.rust-lang.org/tools/install) for other options.
158
+ > Note: If you prefer not to use `rustup` for some reason, please see the
159
+ > [Other Rust Installation Methods page][otherinstall] for more options.
160
160
-->
161
161
< blockquote >
162
- < p > 注釈: なんらかの理由で< code > rustup</ code > を使用したくない場合、< a href ="https://www .rust-lang.org/tools/install/ " > Rustインストールページ </ a > で、
162
+ < p > 注釈: なんらかの理由で< code > rustup</ code > を使用したくない場合、< a href ="https://forge .rust-lang.org/infra/other-installation-methods.html " > Other Rust Installation Methods ページ </ a > で、
163
163
他の選択肢をご覧になってください。</ p >
164
164
</ blockquote >
165
- < blockquote >
166
- < p > 訳注:日本語版のRustインストールページは< a href ="https://www.rust-lang.org/ja/tools/install/ "> こちら</ a > です。</ p >
167
- </ blockquote >
168
165
<!--
169
166
The following steps install the latest stable version of the Rust compiler.
170
167
Rust’s stability guarantees ensure that all the examples in the book that
171
168
compile will continue to compile with newer Rust versions. The output might
172
- differ slightly between versions, because Rust often improves error messages
173
- and warnings. In other words, any newer, stable version of Rust you install
174
- using these steps should work as expected with the content of this book.
169
+ differ slightly between versions because Rust often improves error messages and
170
+ warnings. In other words, any newer, stable version of Rust you install using
171
+ these steps should work as expected with the content of this book.
175
172
-->
176
173
< p > 以下の手順で最新の安定版のRustコンパイラをインストールします。
177
174
Rustは安定性 (stability) を保証しているので、現在この本の例でコンパイルできるものは、新しいバージョンになってもコンパイルでき続けることが保証されます。
@@ -183,15 +180,16 @@ <h2 id="インストール"><a class="header" href="#インストール">イン
183
180
>
184
181
> In this chapter and throughout the book, we’ll show some commands used in the
185
182
> terminal. Lines that you should enter in a terminal all start with `$`. You
186
- > don’t need to type in the `$` character; it indicates the start of each
187
- > command. Lines that don’t start with `$` typically show the output of the
188
- > previous command. Additionally, PowerShell-specific examples will use `>`
189
- > rather than `$`.
183
+ > don’t need to type the `$` character; it’s the command line prompt shown to
184
+ > indicate the start of each command. Lines that don’t start with `$` typically
185
+ > show the output of the previous command. Additionally, PowerShell-specific
186
+ > examples will use `>` rather than `$`.
190
187
-->
191
188
< blockquote >
192
189
< h3 id ="コマンドラインの記法 "> < a class ="header " href ="#コマンドラインの記法 "> コマンドラインの記法</ a > </ h3 >
193
190
< p > この章及び、本を通して、端末で使用するなんらかのコマンドを示すことがあります。読者が入力するべき行は、
194
- 全て< code > $</ code > で始まります。ただし、読者が< code > $</ code > 文字を入力する必要はありません; これは各コマンドの開始を示しているだけです。
191
+ 全て< code > $</ code > で始まります。ただし、読者が< code > $</ code > 文字を入力する必要はありません;
192
+ これは各コマンドの開始を示すために表示しているコマンドラインプロンプトです。
195
193
< code > $</ code > で始まらない行は、典型的には直前のコマンドの出力を示します。また、PowerShell限定の例には、
196
194
< code > $</ code > ではなく、< code > ></ code > を使用します。</ p >
197
195
</ blockquote >
@@ -215,38 +213,59 @@ <h3 id="linuxとmacosにrustupをインストールする"><a class="header" hre
215
213
< pre > < code class ="language-text "> Rust is installed now. Great!
216
214
</ code > </ pre >
217
215
<!--
218
- Additionally, you’ll need a linker of some kind. It’s likely one is already
219
- installed, but when you try to compile a Rust program and get errors indicating
220
- that a linker could not execute, that means a linker isn’t installed on your
221
- system and you’ll need to install one manually. C compilers usually come with
222
- the correct linker. Check your platform’s documentation for how to install a C
223
- compiler. Also, some common Rust packages depend on C code and will need a C
224
- compiler. Therefore, it might be worth installing one now.
216
+ You will also need a *linker*, which is a program that Rust uses to join its
217
+ compiled outputs into one file. It is likely you already have one. If you get
218
+ linker errors, you should install a C compiler, which will typically include a
219
+ linker. A C compiler is also useful because some common Rust packages depend on
220
+ C code and will need a C compiler.
221
+ -->
222
+ < p > < em > リンカ</ em > も必要になるでしょう。
223
+ リンカは、コンパイルされた出力をひとつのファイルに合体させるためにRustが使用するプログラムです。
224
+ リンカが既にインストールされている可能性は高いでしょう。
225
+ リンカエラーが発生したときは、Cコンパイラは典型的にリンカを含んでいるでしょうから、Cコンパイラをインストールすべきです。
226
+ 一般的なRustパッケージの中には、Cコードに依存し、Cコンパイラが必要になるものもあるので、この理由からもCコンパイラは有用です。</ p >
227
+ <!--
228
+ On macOS, you can get a C compiler by running:
229
+ -->
230
+ < p > macOSでは、以下を実行することでCコンパイラが手に入ります:</ p >
231
+ < pre > < code class ="language-console "> $ xcode-select --install
232
+ </ code > </ pre >
233
+ <!--
234
+ Linux users should generally install GCC or Clang, according to their
235
+ distribution’s documentation. For example, if you use Ubuntu, you can install
236
+ the `build-essential` package.
225
237
-->
226
- < p > これに加えて、なんらかのリンカが必要になるでしょう。既にインストールされている可能性は高いものの、
227
- Rustプログラムをコンパイルしようとした時、リンカが実行できないというエラーが出たら、
228
- システムにリンカがインストールされていないということなので、手動でインストールする必要があるでしょう。
229
- Cコンパイラは通常正しいリンカとセットになっています。
230
- 自分のプラットフォームのドキュメンテーションを見てCコンパイラのインストール方法を確認してください。
231
- 一般的なRustパッケージの中には、Cコードに依存し、Cコンパイラが必要になるものもあります。
232
- ですので、Cコンパイラは今のうちにインストールしておく価値があるかもしれません。</ p >
238
+ < p > Linuxユーザは、通常はディストリビューションのドキュメントに従って、GCCまたはClangをインストールするべきです。
239
+ 例えばUbuntuを使用している場合は、< code > build-essential</ code > パッケージをインストールすれば大丈夫です。</ p >
233
240
<!--
234
241
### Installing `rustup` on Windows
235
242
-->
236
243
< h3 id ="windowsでrustupをインストールする "> < a class ="header " href ="#windowsでrustupをインストールする "> Windowsで< code > rustup</ code > をインストールする</ a > </ h3 >
237
244
<!--
238
245
On Windows, go to [https://www.rust-lang.org/tools/install][install] and follow
239
246
the instructions for installing Rust. At some point in the installation, you’ll
240
- receive a message explaining that you’ll also need the C++ build tools for
241
- Visual Studio 2013 or later. The easiest way to acquire the build tools is to
242
- install [Build Tools for Visual Studio 2019][visualstudio]. When asked which
243
- workloads to install make sure "C++ build tools" is selected and that the Windows 10 SDK and the English language pack components are included.
244
-
247
+ receive a message explaining that you’ll also need the MSVC build tools for
248
+ Visual Studio 2013 or later.
245
249
-->
246
250
< p > Windowsでは、< a href ="https://www.rust-lang.org/tools/install "> https://www.rust-lang.org/tools/install</ a > に行き、手順に従ってRustをインストールしてください。
247
- インストールの途中で、Visual Studio 2013以降用のC++ビルドツールも必要になるという旨のメッセージが出るでしょう。
248
- ビルドツールを取得する最も簡単な方法は、< a href ="https://visualstudio.microsoft.com/visual-cpp-build-tools/ "> Visual Studio 2019用のビルドツール</ a > をインストールすることです。
249
- どのワークロード (workloads) をインストールするかと質問されたときは、"C++ build tools"が選択されており、Windows 10 SDKと英語の言語パック (English language pack) が含まれていることを確かめてください。</ p >
251
+ インストールの途中で、Visual Studio 2013以降用のMSVCビルドツールも必要になるという旨のメッセージが出るでしょう。</ p >
252
+ <!--
253
+ To acquire the build tools, you’ll need to install [Visual Studio
254
+ 2022][visualstudio]. When asked which workloads to install, include:
255
+ -->
256
+ < p > ビルドツールを取得するには、< a href ="https://visualstudio.microsoft.com/downloads/ "> Visual Studio 2022</ a > をインストールする必要があるでしょう。
257
+ どのワークロード (workloads) をインストールするかと質問されたときは、以下を含めてください:</ p >
258
+ <!--
259
+ * “Desktop Development with C++”
260
+ * The Windows 10 or 11 SDK
261
+ * The English language pack component, along with any other language pack of
262
+ your choosing
263
+ -->
264
+ < ul >
265
+ < li > 「C++によるデスクトップ開発」(“Desktop Development with C++”)</ li >
266
+ < li > Windows 10または11のSDK</ li >
267
+ < li > 英語の言語パック (English language pack) コンポーネント (お好みで他の任意の言語パックも)</ li >
268
+ </ ul >
250
269
< blockquote >
251
270
< p > 訳注:Windowsの言語を日本語にしている場合は言語パックのところで「日本語」が選択されており、そのままの設定でインストールしても基本的に問題ないはずです。しかし、サードパーティーのツールやライブラリの中には英語の言語パックを必要とするものがあるため、「日本語」に加えて「英語」も選択することをお勧めします。</ p >
252
271
</ blockquote >
@@ -257,25 +276,6 @@ <h3 id="windowsでrustupをインストールする"><a class="header" href="#wi
257
276
< p > これ以降、< em > cmd.exe</ em > とPowerShellの両方で動くコマンドを使用します。
258
277
特段の違いがあったら、どちらを使用すべきか説明します。</ p >
259
278
<!--
260
- ### Updating and Uninstalling
261
- -->
262
- < h3 id ="更新及びアンインストール "> < a class ="header " href ="#更新及びアンインストール "> 更新及びアンインストール</ a > </ h3 >
263
- <!--
264
- After you’ve installed Rust via `rustup`, updating to the latest version is
265
- easy. From your shell, run the following update script:
266
- -->
267
- < p > < code > rustup</ code > 経由でRustをインストールしたなら、最新版へ更新するのは簡単です。
268
- シェルから以下の更新スクリプトを実行してください:</ p >
269
- < pre > < code class ="language-console "> $ rustup update
270
- </ code > </ pre >
271
- <!--
272
- To uninstall Rust and `rustup`, run the following uninstall script from your
273
- shell:
274
- -->
275
- < p > Rustと< code > rustup</ code > をアンインストールするには、シェルから以下のアンインストールスクリプトを実行してください:</ p >
276
- < pre > < code class ="language-console "> $ rustup self uninstall
277
- </ code > </ pre >
278
- <!--
279
279
### Troubleshooting
280
280
-->
281
281
< h3 id ="トラブルシューティング "> < a class ="header " href ="#トラブルシューティング "> トラブルシューティング</ a > </ h3 >
@@ -288,44 +288,82 @@ <h3 id="トラブルシューティング"><a class="header" href="#トラブル
288
288
</ code > </ pre >
289
289
<!--
290
290
You should see the version number, commit hash, and commit date for the latest
291
- stable version that has been released in the following format:
291
+ stable version that has been released, in the following format:
292
292
-->
293
- < p > バージョンナンバー 、コミットハッシュ、最新の安定版がリリースされたコミット日時が以下のフォーマットで表示されるのを目撃するはずです 。</ p >
293
+ < p > リリース済みの最新の安定版のバージョンナンバー 、コミットハッシュ、コミット日が以下の形式で表示されるはずです 。</ p >
294
294
< pre > < code class ="language-text "> rustc x.y.z (abcabcabc yyyy-mm-dd)
295
295
</ code > </ pre >
296
296
<!--
297
297
If you see this information, you have installed Rust successfully! If you don’t
298
- see this information and you’re on Windows, check that Rust is in your `%PATH%`
299
- system variable. If that’s all correct and Rust still isn’t working, there are
300
- a number of places you can get help. The easiest is the #beginners channel on
301
- [the official Rust Discord][discord]. There, you can chat with other Rustaceans
302
- (a silly nickname we call ourselves) who can help you out. Other great
303
- resources include [the Users forum][users] and [Stack Overflow][stackoverflow].
298
+ see this information, check that Rust is in your `%PATH%` system variable as
299
+ follows.
304
300
-->
305
- < p > この情報が見られたなら、Rustのインストールに成功しています!この情報が出ず、Windowsを使っているなら、
306
- Rustが< code > %PATH%</ code > システム環境変数にあることを確認してください。これらが全て正常であるのに、それでもRustがうまく動かないなら、
307
- 助力を得られる場所はたくさんあります。最も簡単なのが< a href ="https://discord.gg/rust-lang "> Rustの公式Discord</ a > の#beginnersチャンネルです。そのアドレスで、助けてくれる他のRustacean (Rustユーザが自分たちのことを呼ぶ、冗談めいたニックネーム) たちとチャットできます。
308
- 他にも、素晴らしいリソースとして< a href ="https://users.rust-lang.org/ "> ユーザ・フォーラム</ a > と< a href ="https://stackoverflow.com/questions/tagged/rust "> Stack Overflow</ a > が挙げられます。</ p >
301
+ < p > この情報が見られたなら、Rustのインストールに成功しています!
302
+ この情報が出ない場合は、次のようにしてRustが< code > %PATH%</ code > システム環境変数にあることを確認してください。</ p >
303
+ <!--
304
+ In Windows CMD, use:
305
+ -->
306
+ < p > Windows CMDでは:</ p >
307
+ < pre > < code class ="language-console "> > echo %PATH%
308
+ </ code > </ pre >
309
+ <!--
310
+ In PowerShell, use:
311
+ -->
312
+ < p > PowerShellでは:</ p >
313
+ < pre > < code class ="language-powershell "> > echo $env:Path
314
+ </ code > </ pre >
315
+ <!--
316
+ In Linux and macOS, use:
317
+ -->
318
+ < p > LinuxおよびmacOSでは:</ p >
319
+ < pre > < code class ="language-console "> $ echo $PATH
320
+ </ code > </ pre >
321
+ <!--
322
+ If that’s all correct and Rust still isn’t working, there are a number of
323
+ places you can get help. Find out how to get in touch with other Rustaceans (a
324
+ silly nickname we call ourselves) on [the community page][community].
325
+ -->
326
+ < p > これらが全て正常であるのに、それでもRustがうまく動かないなら、助力を得られる場所はたくさんあります。
327
+ 他のRustacean(Rustユーザが自分たちのことを呼ぶ、冗談めいたニックネーム)たちと交流する方法を< a href ="https://www.rust-lang.org/community "> コミュニティページ</ a > で探してください。</ p >
309
328
< blockquote >
310
329
< p > 訳注1:Rustaceanについて、いらないかもしれない補足です。< a href ="https://mobile.twitter.com/rustlang/status/916284650674323457 "> 公式Twitter曰く、Rustaceanはcrustaceans(甲殻類)から来ている</ a > そうです。
311
330
そのため、Rustのマスコットは(非公式らしいですが)< a href ="https://www.slideshare.net/wolf-dog/ss-64026540 "> カニ</ a > 。上の会話でCの欠点を削ぎ落としているからcを省いてるの?みたいなことを聞いていますが、
312
331
違うそうです。検索したら、堅牢性が高いから甲殻類という意見もありますが、真偽は不明です。
313
332
明日使えるかもしれないトリビアでした。</ p >
314
333
</ blockquote >
315
334
< blockquote >
316
- < p > 訳注2:上にある公式Discordは英語話者のコミュニティです 。日本語話者のためのコミュニティが< a href ="https://rust-lang-jp.zulipchat.com "> Zulip rust-lang-jpにあり</ a > 、こちらでもRustaceanたちが活発に議論をしています。
335
+ < p > 訳注2:上にあるコミュニティページはどれも英語話者のコミュニティへのリンク集です 。日本語話者のためのコミュニティが< a href ="https://rust-lang-jp.zulipchat.com "> Zulip rust-lang-jpにあり</ a > 、こちらでもRustaceanたちが活発に議論をしています。
317
336
公式Discord同様、初心者向けの#beginnersチャンネルが存在するので、気軽に質問してみてください。</ p >
318
337
</ blockquote >
319
338
<!--
339
+ ### Updating and Uninstalling
340
+ -->
341
+ < h3 id ="更新及びアンインストール "> < a class ="header " href ="#更新及びアンインストール "> 更新及びアンインストール</ a > </ h3 >
342
+ <!--
343
+ Once Rust is installed via `rustup`, updating to a newly released version is
344
+ easy. From your shell, run the following update script:
345
+ -->
346
+ < p > < code > rustup</ code > 経由でRustがインストールされたなら、新しくリリースされた版へ更新するのは簡単です。
347
+ シェルから以下の更新スクリプトを実行してください:</ p >
348
+ < pre > < code class ="language-console "> $ rustup update
349
+ </ code > </ pre >
350
+ <!--
351
+ To uninstall Rust and `rustup`, run the following uninstall script from your
352
+ shell:
353
+ -->
354
+ < p > Rustと< code > rustup</ code > をアンインストールするには、シェルから以下のアンインストールスクリプトを実行してください:</ p >
355
+ < pre > < code class ="language-console "> $ rustup self uninstall
356
+ </ code > </ pre >
357
+ <!--
320
358
### Local Documentation
321
359
-->
322
360
< h3 id ="ローカルのドキュメンテーション "> < a class ="header " href ="#ローカルのドキュメンテーション "> ローカルのドキュメンテーション</ a > </ h3 >
323
361
<!--
324
- The installation of Rust also includes a copy of the documentation locally, so
325
- you can read it offline. Run `rustup doc` to open the local documentation in
326
- your browser.
362
+ The installation of Rust also includes a local copy of the documentation so
363
+ that you can read it offline. Run `rustup doc` to open the local documentation
364
+ in your browser.
327
365
-->
328
- < p > インストールされたRustには、ローカルに複製されたドキュメンテーションのコピーが含まれているので、これをオフラインで閲覧することができます 。
366
+ < p > インストールされたRustには、オフラインでドキュメンテーションを閲覧できるように、ドキュメンテーションのローカルコピーが含まれています 。
329
367
ブラウザでローカルのドキュメンテーションを開くには、< code > rustup doc</ code > を実行してください。</ p >
330
368
<!--
331
369
Any time a type or function is provided by the standard library and you’re not
0 commit comments