@@ -13,25 +13,20 @@ an internet connection for the download.
13
13
最初の手順は、Rustをインストールすることです。Rustは、Rustのバージョンと関連するツールを管理する、` rustup ` というコマンドラインツールを使用してダウンロードします。ダウンロードには、インターネットへの接続が必要になります。
14
14
15
15
<!--
16
- > Note: If you prefer not to use `rustup` for some reason, please see [ the Rust
17
- > installation page](https://www.rust-lang.org/tools/install) for other options.
16
+ > Note: If you prefer not to use `rustup` for some reason, please see the
17
+ > [Other Rust Installation Methods page][otherinstall] for more options.
18
18
-->
19
19
20
- > 注釈: なんらかの理由で` rustup ` を使用したくない場合、[ Rustインストールページ ] [ rust-installation-page ] で、
20
+ > 注釈: なんらかの理由で` rustup ` を使用したくない場合、[ Other Rust Installation Methods ページ ] [ otherinstall ] で、
21
21
> 他の選択肢をご覧になってください。
22
22
23
- > 訳注:日本語版のRustインストールページは[ こちら] [ rust-installation-page-ja ] です。
24
-
25
- [ rust-installation-page ] : https://www.rust-lang.org/tools/install/
26
- [ rust-installation-page-ja ] : https://www.rust-lang.org/ja/tools/install/
27
-
28
23
<!--
29
24
The following steps install the latest stable version of the Rust compiler.
30
25
Rust’s stability guarantees ensure that all the examples in the book that
31
26
compile will continue to compile with newer Rust versions. The output might
32
- differ slightly between versions, because Rust often improves error messages
33
- and warnings. In other words, any newer, stable version of Rust you install
34
- using these steps should work as expected with the content of this book.
27
+ differ slightly between versions because Rust often improves error messages and
28
+ warnings. In other words, any newer, stable version of Rust you install using
29
+ these steps should work as expected with the content of this book.
35
30
-->
36
31
37
32
以下の手順で最新の安定版のRustコンパイラをインストールします。
@@ -45,16 +40,17 @@ Rustは安定性 (stability) を保証しているので、現在この本の例
45
40
>
46
41
> In this chapter and throughout the book, we’ll show some commands used in the
47
42
> terminal. Lines that you should enter in a terminal all start with `$`. You
48
- > don’t need to type in the `$` character; it indicates the start of each
49
- > command. Lines that don’t start with `$` typically show the output of the
50
- > previous command. Additionally, PowerShell-specific examples will use `>`
51
- > rather than `$`.
43
+ > don’t need to type the `$` character; it’s the command line prompt shown to
44
+ > indicate the start of each command. Lines that don’t start with `$` typically
45
+ > show the output of the previous command. Additionally, PowerShell-specific
46
+ > examples will use `>` rather than `$`.
52
47
-->
53
48
54
49
> ### コマンドラインの記法
55
50
>
56
51
> この章及び、本を通して、端末で使用するなんらかのコマンドを示すことがあります。読者が入力するべき行は、
57
- > 全て` $ ` で始まります。ただし、読者が` $ ` 文字を入力する必要はありません; これは各コマンドの開始を示しているだけです。
52
+ > 全て` $ ` で始まります。ただし、読者が` $ ` 文字を入力する必要はありません;
53
+ > これは各コマンドの開始を示すために表示しているコマンドラインプロンプトです。
58
54
> ` $ ` で始まらない行は、典型的には直前のコマンドの出力を示します。また、PowerShell限定の例には、
59
55
> ` $ ` ではなく、` > ` を使用します。
60
56
@@ -88,22 +84,37 @@ Rust is installed now. Great!
88
84
```
89
85
90
86
<!--
91
- Additionally, you’ll need a linker of some kind. It’s likely one is already
92
- installed, but when you try to compile a Rust program and get errors indicating
93
- that a linker could not execute, that means a linker isn’t installed on your
94
- system and you’ll need to install one manually. C compilers usually come with
95
- the correct linker. Check your platform’s documentation for how to install a C
96
- compiler. Also, some common Rust packages depend on C code and will need a C
97
- compiler. Therefore, it might be worth installing one now.
87
+ You will also need a *linker*, which is a program that Rust uses to join its
88
+ compiled outputs into one file. It is likely you already have one. If you get
89
+ linker errors, you should install a C compiler, which will typically include a
90
+ linker. A C compiler is also useful because some common Rust packages depend on
91
+ C code and will need a C compiler.
92
+ -->
93
+
94
+ * リンカ* も必要になるでしょう。
95
+ リンカは、コンパイルされた出力をひとつのファイルに合体させるためにRustが使用するプログラムです。
96
+ リンカが既にインストールされている可能性は高いでしょう。
97
+ リンカエラーが発生したときは、Cコンパイラは典型的にリンカを含んでいるでしょうから、Cコンパイラをインストールすべきです。
98
+ 一般的なRustパッケージの中には、Cコードに依存し、Cコンパイラが必要になるものもあるので、この理由からもCコンパイラは有用です。
99
+
100
+ <!--
101
+ On macOS, you can get a C compiler by running:
102
+ -->
103
+
104
+ macOSでは、以下を実行することでCコンパイラが手に入ります:
105
+
106
+ ``` console
107
+ $ xcode-select --install
108
+ ```
109
+
110
+ <!--
111
+ Linux users should generally install GCC or Clang, according to their
112
+ distribution’s documentation. For example, if you use Ubuntu, you can install
113
+ the `build-essential` package.
98
114
-->
99
115
100
- これに加えて、なんらかのリンカが必要になるでしょう。既にインストールされている可能性は高いものの、
101
- Rustプログラムをコンパイルしようとした時、リンカが実行できないというエラーが出たら、
102
- システムにリンカがインストールされていないということなので、手動でインストールする必要があるでしょう。
103
- Cコンパイラは通常正しいリンカとセットになっています。
104
- 自分のプラットフォームのドキュメンテーションを見てCコンパイラのインストール方法を確認してください。
105
- 一般的なRustパッケージの中には、Cコードに依存し、Cコンパイラが必要になるものもあります。
106
- ですので、Cコンパイラは今のうちにインストールしておく価値があるかもしれません。
116
+ Linuxユーザは、通常はディストリビューションのドキュメントに従って、GCCまたはClangをインストールするべきです。
117
+ 例えばUbuntuを使用している場合は、` build-essential ` パッケージをインストールすれば大丈夫です。
107
118
108
119
<!--
109
120
### Installing `rustup` on Windows
@@ -115,22 +126,33 @@ Cコンパイラは通常正しいリンカとセットになっています。
115
126
<!--
116
127
On Windows, go to [https://www.rust-lang.org/tools/install][install] and follow
117
128
the instructions for installing Rust. At some point in the installation, you’ll
118
- receive a message explaining that you’ll also need the C++ build tools for
119
- Visual Studio 2013 or later. The easiest way to acquire the build tools is to
120
- install [Build Tools for Visual Studio 2019][visualstudio]. When asked which
121
- workloads to install make sure "C++ build tools" is selected and that the Windows 10 SDK and the English language pack components are included.
122
-
129
+ receive a message explaining that you’ll also need the MSVC build tools for
130
+ Visual Studio 2013 or later.
123
131
-->
124
132
125
133
Windowsでは、[ https://www.rust-lang.org/tools/install ] [ install ] に行き、手順に従ってRustをインストールしてください。
126
- インストールの途中で、Visual Studio 2013以降用のC++ビルドツールも必要になるという旨のメッセージが出るでしょう。
127
- ビルドツールを取得する最も簡単な方法は、[ Visual Studio 2019用のビルドツール] [ visualstudio ] をインストールすることです。
128
- どのワークロード (workloads) をインストールするかと質問されたときは、"C++ build tools"が選択されており、Windows 10 SDKと英語の言語パック (English language pack) が含まれていることを確かめてください。
134
+ インストールの途中で、Visual Studio 2013以降用のMSVCビルドツールも必要になるという旨のメッセージが出るでしょう。
129
135
130
- > 訳注:Windowsの言語を日本語にしている場合は言語パックのところで「日本語」が選択されており、そのままの設定でインストールしても基本的に問題ないはずです。しかし、サードパーティーのツールやライブラリの中には英語の言語パックを必要とするものがあるため、「日本語」に加えて「英語」も選択することをお勧めします。
136
+ <!--
137
+ To acquire the build tools, you’ll need to install [Visual Studio
138
+ 2022][visualstudio]. When asked which workloads to install, include:
139
+ -->
131
140
132
- [ install ] : https://www.rust-lang.org/tools/install
133
- [ visualstudio ] : https://visualstudio.microsoft.com/visual-cpp-build-tools/
141
+ ビルドツールを取得するには、[ Visual Studio 2022] [ visualstudio ] をインストールする必要があるでしょう。
142
+ どのワークロード (workloads) をインストールするかと質問されたときは、以下を含めてください:
143
+
144
+ <!--
145
+ * “Desktop Development with C++”
146
+ * The Windows 10 or 11 SDK
147
+ * The English language pack component, along with any other language pack of
148
+ your choosing
149
+ -->
150
+
151
+ * 「C++によるデスクトップ開発」(“Desktop Development with C++”)
152
+ * Windows 10または11のSDK
153
+ * 英語の言語パック (English language pack) コンポーネント (お好みで他の任意の言語パックも)
154
+
155
+ > 訳注:Windowsの言語を日本語にしている場合は言語パックのところで「日本語」が選択されており、そのままの設定でインストールしても基本的に問題ないはずです。しかし、サードパーティーのツールやライブラリの中には英語の言語パックを必要とするものがあるため、「日本語」に加えて「英語」も選択することをお勧めします。
134
156
135
157
<!--
136
158
The rest of this book uses commands that work in both *cmd.exe* and PowerShell.
@@ -141,105 +163,135 @@ If there are specific differences, we’ll explain which to use.
141
163
特段の違いがあったら、どちらを使用すべきか説明します。
142
164
143
165
<!--
144
- ### Updating and Uninstalling
166
+ ### Troubleshooting
145
167
-->
146
168
147
- ### 更新及びアンインストール
169
+ ### トラブルシューティング
148
170
149
171
<!--
150
- After you’ve installed Rust via `rustup`, updating to the latest version is
151
- easy. From your shell, run the following update script :
172
+ To check whether you have Rust installed correctly, open a shell and enter this
173
+ line :
152
174
-->
153
175
154
- ` rustup ` 経由でRustをインストールしたなら、最新版へ更新するのは簡単です。
155
- シェルから以下の更新スクリプトを実行してください:
176
+ Rustが正常にインストールされているか確かめるには、シェルを開いて以下の行を入力してください:
156
177
157
178
``` console
158
- $ rustup update
179
+ $ rustc --version
159
180
```
160
181
161
182
<!--
162
- To uninstall Rust and `rustup`, run the following uninstall script from your
163
- shell :
183
+ You should see the version number, commit hash, and commit date for the latest
184
+ stable version that has been released, in the following format :
164
185
-->
165
186
166
- Rustと ` rustup ` をアンインストールするには、シェルから以下のアンインストールスクリプトを実行してください:
187
+ バージョンナンバー、コミットハッシュ、最新の安定版がリリースされたコミット日時が以下のフォーマットで表示されるのを目撃するはずです。
167
188
168
- ``` console
169
- $ rustup self uninstall
189
+ ``` text
190
+ rustc x.y.z (abcabcabc yyyy-mm-dd)
170
191
```
171
192
172
193
<!--
173
- ### Troubleshooting
194
+ If you see this information, you have installed Rust successfully! If you don’t
195
+ see this information, check that Rust is in your `%PATH%` system variable as
196
+ follows.
174
197
-->
175
198
176
- ### トラブルシューティング
199
+ この情報が見られたなら、Rustのインストールに成功しています!
200
+ この情報が出ない場合は、次のようにしてRustが` %PATH% ` システム環境変数にあることを確認してください。
177
201
178
202
<!--
179
- To check whether you have Rust installed correctly, open a shell and enter this
180
- line:
203
+ In Windows CMD, use:
181
204
-->
182
205
183
- Rustが正常にインストールされているか確かめるには、シェルを開いて以下の行を入力してください :
206
+ Windows CMDでは :
184
207
185
208
``` console
186
- $ rustc --version
209
+ > echo %PATH%
187
210
```
188
211
189
212
<!--
190
- You should see the version number, commit hash, and commit date for the latest
191
- stable version that has been released in the following format:
213
+ In PowerShell, use:
192
214
-->
193
215
194
- バージョンナンバー、コミットハッシュ、最新の安定版がリリースされたコミット日時が以下のフォーマットで表示されるのを目撃するはずです。
216
+ PowerShellでは:
195
217
196
- ``` text
197
- rustc x.y.z (abcabcabc yyyy-mm-dd)
218
+ ``` powershell
219
+ > echo $env:Path
198
220
```
199
221
200
222
<!--
201
- If you see this information, you have installed Rust successfully! If you don’t
202
- see this information and you’re on Windows, check that Rust is in your `%PATH%`
203
- system variable. If that’s all correct and Rust still isn’t working, there are
204
- a number of places you can get help. The easiest is the #beginners channel on
205
- [the official Rust Discord][discord]. There, you can chat with other Rustaceans
206
- (a silly nickname we call ourselves) who can help you out. Other great
207
- resources include [the Users forum][users] and [Stack Overflow][stackoverflow].
223
+ In Linux and macOS, use:
208
224
-->
209
225
210
- この情報が見られたなら、Rustのインストールに成功しています!この情報が出ず、Windowsを使っているなら、
211
- Rustが` %PATH% ` システム環境変数にあることを確認してください。これらが全て正常であるのに、それでもRustがうまく動かないなら、
212
- 助力を得られる場所はたくさんあります。最も簡単なのが[ Rustの公式Discord] [ discord ] の#beginnersチャンネルです。そのアドレスで、助けてくれる他のRustacean (Rustユーザが自分たちのことを呼ぶ、冗談めいたニックネーム) たちとチャットできます。
213
- 他にも、素晴らしいリソースとして[ ユーザ・フォーラム] [ users ] と[ Stack Overflow] [ stackoverflow ] が挙げられます。
226
+ LinuxおよびmacOSでは:
227
+
228
+ ``` console
229
+ $ echo $PATH
230
+ ```
231
+
232
+ <!--
233
+ If that’s all correct and Rust still isn’t working, there are a number of
234
+ places you can get help. Find out how to get in touch with other Rustaceans (a
235
+ silly nickname we call ourselves) on [the community page][community].
236
+ -->
237
+
238
+ これらが全て正常であるのに、それでもRustがうまく動かないなら、助力を得られる場所はたくさんあります。
239
+ 他のRustacean(Rustユーザが自分たちのことを呼ぶ、冗談めいたニックネーム)たちと交流する方法を[ コミュニティページ] [ community ] で探してください。
214
240
215
241
> 訳注1:Rustaceanについて、いらないかもしれない補足です。[ 公式Twitter曰く、Rustaceanはcrustaceans(甲殻類)から来ている] [ twitter ] そうです。
216
242
> そのため、Rustのマスコットは(非公式らしいですが)[ カニ] [ mascott ] 。上の会話でCの欠点を削ぎ落としているからcを省いてるの?みたいなことを聞いていますが、
217
243
> 違うそうです。検索したら、堅牢性が高いから甲殻類という意見もありますが、真偽は不明です。
218
244
> 明日使えるかもしれないトリビアでした。
219
245
220
- > 訳注2:上にある公式Discordは英語話者のコミュニティです 。日本語話者のためのコミュニティが[ Zulip rust-lang-jpにあり] [ zulip_jp ] 、こちらでもRustaceanたちが活発に議論をしています。
246
+ > 訳注2:上にあるコミュニティページはどれも英語話者のコミュニティへのリンク集です 。日本語話者のためのコミュニティが[ Zulip rust-lang-jpにあり] [ zulip_jp ] 、こちらでもRustaceanたちが活発に議論をしています。
221
247
> 公式Discord同様、初心者向けの#beginnersチャンネルが存在するので、気軽に質問してみてください。
222
248
223
- [ discord ] : https://discord.gg/rust-lang
224
- [ users ] : https://users.rust-lang.org/
225
- [ stackoverflow ] : https://stackoverflow.com/questions/tagged/rust
226
249
[ twitter ] : https://mobile.twitter.com/rustlang/status/916284650674323457
227
250
[ mascott ] : https://www.slideshare.net/wolf-dog/ss-64026540
228
251
[ zulip_jp ] : https://rust-lang-jp.zulipchat.com
229
252
253
+ <!--
254
+ ### Updating and Uninstalling
255
+ -->
256
+
257
+ ### 更新及びアンインストール
258
+
259
+ <!--
260
+ Once Rust is installed via `rustup`, updating to a newly released version is
261
+ easy. From your shell, run the following update script:
262
+ -->
263
+
264
+ ` rustup ` 経由でRustがインストールされたなら、新しくリリースされた版へ更新するのは簡単です。
265
+ シェルから以下の更新スクリプトを実行してください:
266
+
267
+ ``` console
268
+ $ rustup update
269
+ ```
270
+
271
+ <!--
272
+ To uninstall Rust and `rustup`, run the following uninstall script from your
273
+ shell:
274
+ -->
275
+
276
+ Rustと` rustup ` をアンインストールするには、シェルから以下のアンインストールスクリプトを実行してください:
277
+
278
+ ``` console
279
+ $ rustup self uninstall
280
+ ```
281
+
230
282
<!--
231
283
### Local Documentation
232
284
-->
233
285
234
286
### ローカルのドキュメンテーション
235
287
236
288
<!--
237
- The installation of Rust also includes a copy of the documentation locally, so
238
- you can read it offline. Run `rustup doc` to open the local documentation in
239
- your browser.
289
+ The installation of Rust also includes a local copy of the documentation so
290
+ that you can read it offline. Run `rustup doc` to open the local documentation
291
+ in your browser.
240
292
-->
241
293
242
- インストールされたRustには、ローカルに複製されたドキュメンテーションのコピーが含まれているので、これをオフラインで閲覧することができます 。
294
+ インストールされたRustには、オフラインでドキュメンテーションを閲覧できるように、ドキュメンテーションのローカルコピーが含まれています 。
243
295
ブラウザでローカルのドキュメンテーションを開くには、` rustup doc ` を実行してください。
244
296
245
297
<!--
@@ -249,3 +301,9 @@ sure what it does or how to use it, use the application programming interface
249
301
-->
250
302
251
303
標準ライブラリにより提供される型や関数がなんなのかや、それをどう使えば良いのかがよくわからないときは、いつでもAPIのドキュメンテーションを検索してみてください!
304
+
305
+
306
+ [ otherinstall ] : https://forge.rust-lang.org/infra/other-installation-methods.html
307
+ [ install ] : https://www.rust-lang.org/tools/install
308
+ [ visualstudio ] : https://visualstudio.microsoft.com/downloads/
309
+ [ community ] : https://www.rust-lang.org/community
0 commit comments