We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subtyping.variance.user-composite-types has a wording
If the parameter is used in positions with different variances then the parameter is invariant.
However, it applies only to struct, enum, and union types
subtyping.variance.builtin-composite-types specifies the rules
When used outside of an struct, enum, or union, the variance for parameters is checked at each location separately.
However, it seems to only apply to tuple and function types.
Consider this type
struct A<'a>(&'a ()); type F<'b> = &'b mut A<'b>
The reference lacks the wording to specify the variance of lifetime 'b. That is, in &'b T, 'b is covariant and T is invariant.
'b
&'b T
T
It seems that 'b is expected to be invariant in type &'b mut A<'b>.
&'b mut A<'b>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
subtyping.variance.user-composite-types has a wording
However, it applies only to struct, enum, and union types
subtyping.variance.builtin-composite-types specifies the rules
However, it seems to only apply to tuple and function types.
Consider this type
The reference lacks the wording to specify the variance of lifetime
'b
. That is, in&'b T
,'b
is covariant andT
is invariant.It seems that
'b
is expected to be invariant in type&'b mut A<'b>
.The text was updated successfully, but these errors were encountered: