Skip to content

Update nomicon for variance typo & contravariance #30332

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

Merged
merged 2 commits into from
Dec 13, 2015

Conversation

bluss
Copy link
Member

@bluss bluss commented Dec 11, 2015

Update nomicon for variance typo & contravariance

Fixes #28704
Fixes #28100

&'b mut B was described incorrectly (just in this example, is correct in
the actual text).
@rust-highfive
Copy link
Contributor

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@bluss
Copy link
Member Author

bluss commented Dec 11, 2015

This updates nomicon to just mention contravariance without having a longer explanation.

I will cast my own doubts on contravariance for fn() to be removed, since it will mean some valid trait implementations will stop compiling.

It's a simple change for a parenthesis sentence, but I'll ping the language team anyway (sorry!)

cc @rust-lang/lang

for functions. The future of contravariance is uncertain and it may be
scrapped. For now, `fn(T)` is contravariant in `T`, which is used in matching
methods in trait implementations to the trait definition. Traits are
not covariant in their parameters, so `Fn(T)`, is invariant in `T`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not contravariant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, fixed.

@Gankra
Copy link
Contributor

Gankra commented Dec 11, 2015

@bors r+ rollup

Needs work, but a clear improvement.

@bors
Copy link
Collaborator

bors commented Dec 11, 2015

📌 Commit f9d029b has been approved by Gankro

for functions. The future of contravariance is uncertain and it may be
scrapped. For now, `fn(T)` is contravariant in `T`, which is used in matching
methods in trait implementations to the trait definition. Traits don't have
inferred variance, so `Fn(T)`, is invariant in `T`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fn(T),

extra comma

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reading!

@bors
Copy link
Collaborator

bors commented Dec 12, 2015

⌛ Testing commit f9d029b with merge 671afce...

@bors
Copy link
Collaborator

bors commented Dec 12, 2015

💔 Test failed - auto-mac-64-opt

@bluss
Copy link
Member Author

bluss commented Dec 12, 2015

Fixed the comma, and let's see if bors can test this

@bors r=gankro rollup

@bors
Copy link
Collaborator

bors commented Dec 12, 2015

📌 Commit 2a30f0e has been approved by gankro

@bors
Copy link
Collaborator

bors commented Dec 12, 2015

⌛ Testing commit 2a30f0e with merge d538aa2...

@bors
Copy link
Collaborator

bors commented Dec 12, 2015

💔 Test failed - auto-mac-64-opt

@alexcrichton
Copy link
Member

@bors: retry

On Sat, Dec 12, 2015 at 12:19 AM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-mac-64-opt
http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/7373


Reply to this email directly or view it on GitHub
#30332 (comment).

@bors
Copy link
Collaborator

bors commented Dec 13, 2015

⌛ Testing commit 2a30f0e with merge 5a10456...

bors added a commit that referenced this pull request Dec 13, 2015
Update nomicon for variance typo & contravariance

Fixes #28704
Fixes #28100
@bors bors merged commit 2a30f0e into rust-lang:master Dec 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants