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