Skip to content

Commit 045fe94

Browse files
committed
Translate a paragraph
1 parent a23d6e9 commit 045fe94

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/subtyping.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,20 @@ Put another way: `&'a mut T` owns `'a`, but only *borrows* T.
241241
問題ないのです。
242242
言い換えると、 `&'a mut T``'a` を所有しますが、 T は単に*借用している*だけなのです。
243243

244+
<!--
244245
`Box` and `Vec` are interesting cases because they're variant, but you can
245246
definitely store values in them! This is where Rust gets really clever: it's
246247
fine for them to be variant because you can only store values
247248
in them *via a mutable reference*! The mutable reference makes the whole type
248249
invariant, and therefore prevents you from smuggling a short-lived type into
249250
them.
251+
-->
252+
253+
`Box``Vec` は興味深いケースです。なぜなら、これらは変性であるのに、
254+
この中に値を保存できるからです! これは Rust が本当に賢いところです: これらにとって、
255+
変性であることは問題ないのです。なぜなら値を*可変参照を通して*だけ
256+
値を保存できるからです! 可変参照はすべての型を非変性にします。そしてそれ故に
257+
短く生きる型をこっそり入れることを防ぐのです。
250258

251259
Being variant allows `Box` and `Vec` to be weakened when shared
252260
immutably. So you can pass a `&Box<&'static str>` where a `&Box<&'a str>` is

0 commit comments

Comments
 (0)