File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -241,12 +241,20 @@ Put another way: `&'a mut T` owns `'a`, but only *borrows* T.
241
241
問題ないのです。
242
242
言い換えると、 ` &'a mut T ` は ` 'a ` を所有しますが、 T は単に* 借用している* だけなのです。
243
243
244
+ <!--
244
245
`Box` and `Vec` are interesting cases because they're variant, but you can
245
246
definitely store values in them! This is where Rust gets really clever: it's
246
247
fine for them to be variant because you can only store values
247
248
in them *via a mutable reference*! The mutable reference makes the whole type
248
249
invariant, and therefore prevents you from smuggling a short-lived type into
249
250
them.
251
+ -->
252
+
253
+ ` Box ` と ` Vec ` は興味深いケースです。なぜなら、これらは変性であるのに、
254
+ この中に値を保存できるからです! これは Rust が本当に賢いところです: これらにとって、
255
+ 変性であることは問題ないのです。なぜなら値を* 可変参照を通して* だけ
256
+ 値を保存できるからです! 可変参照はすべての型を非変性にします。そしてそれ故に
257
+ 短く生きる型をこっそり入れることを防ぐのです。
250
258
251
259
Being variant allows ` Box ` and ` Vec ` to be weakened when shared
252
260
immutably. So you can pass a ` &Box<&'static str> ` where a ` &Box<&'a str> ` is
You can’t perform that action at this time.
0 commit comments