File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,11 @@ subtyping of its outputs. There are two kinds of variance in Rust:
44
44
* F is * invariant* over ` T ` otherwise (no subtyping relation can be derived)
45
45
46
46
(For those of you who are familiar with variance from other languages, what we
47
- refer to as "just" variance is in fact * covariance* . Rust does not have
48
- contravariance. Historically Rust did have some contravariance but it was
49
- scrapped due to poor interactions with other features. If you experience
50
- contravariance in Rust call your local compiler developer for medical advice.)
47
+ refer to as "just" variance is in fact * covariance* . Rust has * contravariance*
48
+ for functions. The future of contravariance is uncertain and it may be
49
+ scrapped. For now, ` fn(T) ` is contravariant in ` T ` , which is used in matching
50
+ methods in trait implementations to the trait definition. Traits don't have
51
+ inferred variance, so ` Fn(T) ` is invariant in ` T ` ).
51
52
52
53
Some important variances:
53
54
You can’t perform that action at this time.
0 commit comments