The Wayback Machine - https://web.archive.org/web/20201228170740/https://github.com/rust-lang/reference/pull/874
Skip to content
New issue

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

Add an extra fn() entry to the variance table in the subtyping chapter #874

Open
wants to merge 1 commit into
base: master
from

Conversation

@Kimundi
Copy link
Member

@Kimundi Kimundi commented Aug 11, 2020

While discussing variance on a Rust help channel, I noticed that the subtyping chapter does not specifically mention the special case where a type parameter is used both in the input and output of a function, which, as far as I know, would make it be treated as invariant because its the intersection of both contravariance and covariance.

In case I'm not totally wrong with this, I propose adding that case to the table to make it a bit more clear.

While discussing variance on a Rust help channel, I noticed that the subtyping chapter does not specifically mention the special case where a type parameter is used both in the input and output of a function, which, as far as I know, would make it be treated as invariant because its the intersection of both contravariance and covariance.

In case I'm not totally wrong with this, I propose adding that case to the table to make it a bit more clear.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.