Skip to content

Commit 033bc9c

Browse files
committed
ci: generate pages at 72a6288 [ci skip]
1 parent 72a6288 commit 033bc9c

File tree

4 files changed

+100
-32
lines changed

4 files changed

+100
-32
lines changed

docs/print.html

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8149,21 +8149,36 @@ <h1 id="スタティックライフタイム"><a class="header" href="#スタテ
81498149

81508150
// 'static as part of a trait bound:
81518151
fn generic&lt;T&gt;(x: T) where T: 'static {}</code></pre></pre>
8152-
<p>Both are related but subtly different and this is a common source for
8153-
confusion when learning Rust. Here are some examples for each situation:</p>
8154-
<h2 id="reference-lifetime"><a class="header" href="#reference-lifetime">Reference lifetime</a></h2>
8155-
<p>As a reference lifetime <code>'static</code> indicates that the data pointed to by
8152+
<!--
8153+
Both are related but subtly different and this is a common source for
8154+
confusion when learning Rust. Here are some examples for each situation:
8155+
-->
8156+
<p>2つの状況における<code>static</code>は微妙に異なる意味を持っており、Rustを学ぶときの混乱の元になっています。
8157+
いくつかの例とともにそれぞれの使い方を見てみましょう。</p>
8158+
<!--
8159+
## Reference lifetime
8160+
-->
8161+
<h2 id="参照のライフタイム"><a class="header" href="#参照のライフタイム">参照のライフタイム</a></h2>
8162+
<!--
8163+
As a reference lifetime `'static` indicates that the data pointed to by
81568164
the reference lives for the entire lifetime of the running program.
8157-
It can still be coerced to a shorter lifetime.</p>
8158-
<p>There are two ways to make a variable with <code>'static</code> lifetime, and both
8159-
are stored in the read-only memory of the binary:</p>
8165+
It can still be coerced to a shorter lifetime.
8166+
-->
8167+
<p>参照のライフタイムが<code>'static</code>であることは、参照が指し示す値がプログラムの実行中に渡って生き続けることを示します。
8168+
また、より短いライフタイムに圧縮することも可能です。</p>
8169+
<!--
8170+
There are two ways to make a variable with `'static` lifetime, and both
8171+
are stored in the read-only memory of the binary:
8172+
-->
8173+
<p><code>'static</code>ライフタイムを持つ変数を作るには下記の2つ方法があります。
8174+
どちらの場合も、値は読み取り専用のメモリ領域に格納されます。</p>
81608175
<!--
81618176
* Make a constant with the `static` declaration.
81628177
* Make a `string` literal which has type: `&'static str`.
81638178
-->
81648179
<ul>
81658180
<li><code>static</code>宣言とともに定数を作成する。</li>
8166-
<li>文字列リテラル で<code>&amp;'static str</code>型を持つ変数を作成する。</li>
8181+
<li>文字列リテラルで<code>&amp;'static str</code>型を持つ変数を作成する。</li>
81678182
</ul>
81688183
<!--
81698184
See the following example for a display of each method:
@@ -8208,13 +8223,23 @@ <h2 id="reference-lifetime"><a class="header" href="#reference-lifetime">Referen
82088223

82098224
println!(&quot;NUM: {} stays accessible!&quot;, NUM);
82108225
}</code></pre></pre>
8211-
<h2 id="trait-bound"><a class="header" href="#trait-bound">Trait bound</a></h2>
8212-
<p>As a trait bound, it means the type does not contain any non-static
8226+
<!--
8227+
## Trait bound
8228+
-->
8229+
<h2 id="トレイト境界"><a class="header" href="#トレイト境界">トレイト境界</a></h2>
8230+
<!--
8231+
As a trait bound, it means the type does not contain any non-static
82138232
references. Eg. the receiver can hold on to the type for as long as
8214-
they want and it will never become invalid until they drop it.</p>
8215-
<p>It's important to understand this means that any owned data always passes
8216-
a <code>'static</code> lifetime bound, but a reference to that owned data generally
8217-
does not:</p>
8233+
they want and it will never become invalid until they drop it.
8234+
-->
8235+
<p>トレイト境界としての<code>'static</code>は型が非静的な参照を含まないことを意味します。
8236+
言い換えると、レシーバはその型をいくらでも長く保持することができ、意図的にドロップするまでは決して無効になることはないということです。</p>
8237+
<!--
8238+
It's important to understand this means that any owned data always passes
8239+
a `'static` lifetime bound, but a reference to that owned data generally
8240+
does not:
8241+
-->
8242+
<p>次のポイントを押さえておきましょう。所有権のある値が<code>'static</code>ライフタイム境界をパスするとしても、その値への参照が<code>'static</code>ライフタイム境界をパスするとは限りません。</p>
82188243
<pre><pre class="playground"><code class="language-rust editable compile_fail edition2021">use std::fmt::Debug;
82198244

82208245
fn print_it( input: impl Debug + 'static ) {
@@ -8223,24 +8248,33 @@ <h2 id="trait-bound"><a class="header" href="#trait-bound">Trait bound</a></h2>
82238248

82248249
fn main() {
82258250
// i is owned and contains no references, thus it's 'static:
8251+
// i は所有されていて、かつ参照を含まないので 'static
82268252
let i = 5;
82278253
print_it(i);
82288254

82298255
// oops, &amp;i only has the lifetime defined by the scope of
82308256
// main(), so it's not 'static:
8257+
// おっと、&amp;i は main() で定義されたライフタイムしかもたないため 'static ではない
82318258
print_it(&amp;i);
82328259
}</code></pre></pre>
8233-
<p>The compiler will tell you:</p>
8260+
<!--
8261+
The compiler will tell you:
8262+
-->
8263+
<p>コンパイラのメッセージはこのようになります、</p>
82348264
<pre><code class="language-ignore">error[E0597]: `i` does not live long enough
8265+
エラー[E0597]: `i`は十分なライフタイムを持っていません
82358266
--&gt; src/lib.rs:15:15
82368267
|
82378268
15 | print_it(&amp;i);
82388269
| ---------^^--
82398270
| | |
82408271
| | borrowed value does not live long enough
8272+
| | 借用した値のライフタイムが不足
82418273
| argument requires that `i` is borrowed for `'static`
8274+
| 引数は`i`が`'static`として借用されることを要求する
82428275
16 | }
82438276
| - `i` dropped here while still borrowed
8277+
| `i`は借用されたままここでドロップされる
82448278
</code></pre>
82458279
<!--
82468280
### See also:

docs/scope/lifetime/static_lifetime.html

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,36 @@ <h1 id="スタティックライフタイム"><a class="header" href="#スタテ
159159

160160
// 'static as part of a trait bound:
161161
fn generic&lt;T&gt;(x: T) where T: 'static {}</code></pre></pre>
162-
<p>Both are related but subtly different and this is a common source for
163-
confusion when learning Rust. Here are some examples for each situation:</p>
164-
<h2 id="reference-lifetime"><a class="header" href="#reference-lifetime">Reference lifetime</a></h2>
165-
<p>As a reference lifetime <code>'static</code> indicates that the data pointed to by
162+
<!--
163+
Both are related but subtly different and this is a common source for
164+
confusion when learning Rust. Here are some examples for each situation:
165+
-->
166+
<p>2つの状況における<code>static</code>は微妙に異なる意味を持っており、Rustを学ぶときの混乱の元になっています。
167+
いくつかの例とともにそれぞれの使い方を見てみましょう。</p>
168+
<!--
169+
## Reference lifetime
170+
-->
171+
<h2 id="参照のライフタイム"><a class="header" href="#参照のライフタイム">参照のライフタイム</a></h2>
172+
<!--
173+
As a reference lifetime `'static` indicates that the data pointed to by
166174
the reference lives for the entire lifetime of the running program.
167-
It can still be coerced to a shorter lifetime.</p>
168-
<p>There are two ways to make a variable with <code>'static</code> lifetime, and both
169-
are stored in the read-only memory of the binary:</p>
175+
It can still be coerced to a shorter lifetime.
176+
-->
177+
<p>参照のライフタイムが<code>'static</code>であることは、参照が指し示す値がプログラムの実行中に渡って生き続けることを示します。
178+
また、より短いライフタイムに圧縮することも可能です。</p>
179+
<!--
180+
There are two ways to make a variable with `'static` lifetime, and both
181+
are stored in the read-only memory of the binary:
182+
-->
183+
<p><code>'static</code>ライフタイムを持つ変数を作るには下記の2つ方法があります。
184+
どちらの場合も、値は読み取り専用のメモリ領域に格納されます。</p>
170185
<!--
171186
* Make a constant with the `static` declaration.
172187
* Make a `string` literal which has type: `&'static str`.
173188
-->
174189
<ul>
175190
<li><code>static</code>宣言とともに定数を作成する。</li>
176-
<li>文字列リテラル で<code>&amp;'static str</code>型を持つ変数を作成する。</li>
191+
<li>文字列リテラルで<code>&amp;'static str</code>型を持つ変数を作成する。</li>
177192
</ul>
178193
<!--
179194
See the following example for a display of each method:
@@ -218,13 +233,23 @@ <h2 id="reference-lifetime"><a class="header" href="#reference-lifetime">Referen
218233

219234
println!(&quot;NUM: {} stays accessible!&quot;, NUM);
220235
}</code></pre></pre>
221-
<h2 id="trait-bound"><a class="header" href="#trait-bound">Trait bound</a></h2>
222-
<p>As a trait bound, it means the type does not contain any non-static
236+
<!--
237+
## Trait bound
238+
-->
239+
<h2 id="トレイト境界"><a class="header" href="#トレイト境界">トレイト境界</a></h2>
240+
<!--
241+
As a trait bound, it means the type does not contain any non-static
223242
references. Eg. the receiver can hold on to the type for as long as
224-
they want and it will never become invalid until they drop it.</p>
225-
<p>It's important to understand this means that any owned data always passes
226-
a <code>'static</code> lifetime bound, but a reference to that owned data generally
227-
does not:</p>
243+
they want and it will never become invalid until they drop it.
244+
-->
245+
<p>トレイト境界としての<code>'static</code>は型が非静的な参照を含まないことを意味します。
246+
言い換えると、レシーバはその型をいくらでも長く保持することができ、意図的にドロップするまでは決して無効になることはないということです。</p>
247+
<!--
248+
It's important to understand this means that any owned data always passes
249+
a `'static` lifetime bound, but a reference to that owned data generally
250+
does not:
251+
-->
252+
<p>次のポイントを押さえておきましょう。所有権のある値が<code>'static</code>ライフタイム境界をパスするとしても、その値への参照が<code>'static</code>ライフタイム境界をパスするとは限りません。</p>
228253
<pre><pre class="playground"><code class="language-rust editable compile_fail edition2021">use std::fmt::Debug;
229254

230255
fn print_it( input: impl Debug + 'static ) {
@@ -233,24 +258,33 @@ <h2 id="trait-bound"><a class="header" href="#trait-bound">Trait bound</a></h2>
233258

234259
fn main() {
235260
// i is owned and contains no references, thus it's 'static:
261+
// i は所有されていて、かつ参照を含まないので 'static
236262
let i = 5;
237263
print_it(i);
238264

239265
// oops, &amp;i only has the lifetime defined by the scope of
240266
// main(), so it's not 'static:
267+
// おっと、&amp;i は main() で定義されたライフタイムしかもたないため 'static ではない
241268
print_it(&amp;i);
242269
}</code></pre></pre>
243-
<p>The compiler will tell you:</p>
270+
<!--
271+
The compiler will tell you:
272+
-->
273+
<p>コンパイラのメッセージはこのようになります、</p>
244274
<pre><code class="language-ignore">error[E0597]: `i` does not live long enough
275+
エラー[E0597]: `i`は十分なライフタイムを持っていません
245276
--&gt; src/lib.rs:15:15
246277
|
247278
15 | print_it(&amp;i);
248279
| ---------^^--
249280
| | |
250281
| | borrowed value does not live long enough
282+
| | 借用した値のライフタイムが不足
251283
| argument requires that `i` is borrowed for `'static`
284+
| 引数は`i`が`'static`として借用されることを要求する
252285
16 | }
253286
| - `i` dropped here while still borrowed
287+
| `i`は借用されたままここでドロップされる
254288
</code></pre>
255289
<!--
256290
### See also:

docs/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)