Skip to content

Commit e4ea966

Browse files
committed
Translate a paragraph
1 parent 5e8347a commit e4ea966

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
@@ -388,12 +388,20 @@ as invariant just like cells.
388388
他方で、 `*mut` は、共有の有無に関わらず `&mut` に参照外し可能です。よって
389389
`*mut` は cell と同じように非変性です。
390390

391+
<!--
391392
This is all well and good for the types the standard library provides, but
392393
how is variance determined for type that *you* define? A struct, informally
393394
speaking, inherits the variance of its fields. If a struct `Foo`
394395
has a generic argument `A` that is used in a field `a`, then Foo's variance
395396
over `A` is exactly `a`'s variance. However this is complicated if `A` is used
396397
in multiple fields.
398+
-->
399+
400+
これは標準ライブラリが提供する型にとっては上手くいくのですが、
401+
*あなたが*定義した型の変性はどのように決定されるのでしょうか? 簡単に言えば、
402+
構造体はフィールドの変性を受け継ぎます。もし構造体 `Foo` が、フィールド `a` に使われる
403+
ジェネリックな引数 `A` を持つならば、 Foo の `A` における変性は `a` の変性と全く同じです。
404+
しかしながら、もし `A` が複数のフィールドで使用されている場合、これは複雑になります。
397405

398406
* If all uses of A are variant, then Foo is variant over A
399407
* Otherwise, Foo is invariant over A

0 commit comments

Comments
 (0)