Skip to content

Commit f2679e9

Browse files
committed
pep695: fix rust information
1 parent 9d0c3b0 commit f2679e9

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

pep-0695.rst

+4-13
Original file line numberDiff line numberDiff line change
@@ -1066,9 +1066,9 @@ Rust uses angle brackets to declare type parameters and for specialization.
10661066
The upper bound of a type parameter is specified using a colon. Alternatively
10671067
a "where" clause can specify various constraints.
10681068

1069-
Rust uses declaration-site variance, and variance of type parameters is
1070-
typically inferred from their usage. In cases where a type parameter is not
1071-
used within a type, variance can be specified explicitly.
1069+
Rust does not have traditional object oriented inheritance or variance.
1070+
Subtyping in Rust is very restricted and occurs only due to variance with
1071+
respect to lifetimes.
10721072

10731073
A default type argument can be specified using the "=" operator.
10741074

@@ -1092,14 +1092,6 @@ A default type argument can be specified using the "=" operator.
10921092
// Generic function
10931093
fn func1<T>(val: &[T]) -> T { }
10941094

1095-
// Explicit variance specification
1096-
use type_variance::{Covariant, Contravariant};
1097-
1098-
struct StructD<A, R> {
1099-
arg: Covariant<A>,
1100-
ret: Contravariant<R>,
1101-
}
1102-
11031095
// Generic type alias
11041096
type MyType<T> = StructC<T>
11051097

@@ -1210,8 +1202,7 @@ Summary
12101202
+------------+----------+---------+--------+----------+-----------+-----------+
12111203
| Swift | <> | T: X | | | n/a | n/a |
12121204
+------------+----------+---------+--------+----------+-----------+-----------+
1213-
| Rust | <> | T: X, | | = | decl | inferred, |
1214-
| | | where | | | | explicit |
1205+
| Rust | <> | T: X, | | = | n/a | n/a |
12151206
+------------+----------+---------+--------+----------+-----------+-----------+
12161207
| Kotlin | <> | T: X, | | | use, decl | in, out |
12171208
| | | where | | | | |

0 commit comments

Comments
 (0)