Skip to content

Commit a23d6e9

Browse files
committed
Translate a paragraph
1 parent 8e45bc6 commit a23d6e9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/subtyping.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,21 @@ invariant.
225225
変性か非変性かの一般的な主題はこちらです: もし変性によって、短く生きる値がより長く生きる
226226
スロットに保存されるようなことが起きてしまうならば、非変性でなければなりません。
227227

228+
<!--
228229
However it *is* sound for `&'a mut T` to be variant over `'a`. The key difference
229230
between `'a` and T is that `'a` is a property of the reference itself,
230231
while T is something the reference is borrowing. If you change T's type, then
231232
the source still remembers the original type. However if you change the
232233
lifetime's type, no one but the reference knows this information, so it's fine.
233234
Put another way: `&'a mut T` owns `'a`, but only *borrows* T.
235+
-->
236+
237+
しかし、 `&'a mut T``'a` において変性のように*見えます*`&'a` と T の
238+
重要な違いは、 `'a` は参照それ自体の性質ですが、 T は参照が借用しているものということです。
239+
もし T の型を変えても、借用元は元の型を記憶しています。
240+
しかし、もしライフタイムの型を変えると、参照以外のものはこの情報を記憶していないので、
241+
問題ないのです。
242+
言い換えると、 `&'a mut T``'a` を所有しますが、 T は単に*借用している*だけなのです。
234243

235244
`Box` and `Vec` are interesting cases because they're variant, but you can
236245
definitely store values in them! This is where Rust gets really clever: it's

0 commit comments

Comments
 (0)