Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upvec::IntoIter is now invariant #35721
Comments
This comment has been minimized.
This comment has been minimized.
|
See my comment here: #35447 (comment) |
This comment has been minimized.
This comment has been minimized.
|
I'll be honest, I don't entirely know what covariant means, but I'm sorry for whatever pain it caused and wouldn't be offended if it got reverted. Does anyone know of a resource explaining the terms 'covariant' and 'invariant' in this context? |
This comment has been minimized.
This comment has been minimized.
|
@frewsxcv the docs on variance are at https://doc.rust-lang.org/nomicon/subtyping.html |
This comment has been minimized.
This comment has been minimized.
|
@frewsxcv: Basically, we just need to change |
apasel422
added
the
A-libs
label
Aug 16, 2016
This comment has been minimized.
This comment has been minimized.
|
@apasel422 is it safe to do that without also removing |
This comment has been minimized.
This comment has been minimized.
|
We probably need something like this for |
This comment has been minimized.
This comment has been minimized.
|
@asajeffrey It seems to me that |
apasel422
added
the
regression-from-stable-to-nightly
label
Aug 16, 2016
This comment has been minimized.
This comment has been minimized.
|
@apasel422 okay, good point. The thing that's worrying me is that the *const T is being treated as a constant pointer by LLVM, which may trigger unsafe LLVM optimizations it it's then exposed as a &mut[T]. |
This comment has been minimized.
This comment has been minimized.
|
@apasel422 I think the difference is that |
This comment has been minimized.
This comment has been minimized.
|
@asajeffrey It's already safe to cast a In terms of duplicating |
This comment has been minimized.
This comment has been minimized.
|
@apasel422 okay, sounds like I'm being overly conservative! |
alexcrichton
added
I-nominated
T-libs
labels
Aug 16, 2016
This comment has been minimized.
This comment has been minimized.
|
Thanks for the report @asajeffrey! As pointed out by @nikomatsakis we may just want to use @apasel422 or @frewsxcv, would either of you be interested in making a PR for this? |
This comment has been minimized.
This comment has been minimized.
|
Er |
This comment has been minimized.
This comment has been minimized.
|
I can't do anything at this very moment, but if no one gets around to it after a few hours when I get home from work, I can look into it. |
apasel422
self-assigned this
Aug 16, 2016
This comment has been minimized.
This comment has been minimized.
|
@apasel422 just opened a PR to resolve this: #35733 Sorry again for the accidental invariance! |
asajeffrey commentedAug 16, 2016
#35447 replaced a
*const Tby a*mut TinIntoIter<T>, which changedIntoIterfrom being covariant to being invariant. This breaks crates likevec_mapwhich relied onIntoIterbeing invariant, e.g. https://travis-ci.org/asajeffrey/presort/jobs/152720189#L208 has error:cc @alexcrichton @frewsxcv @apasel422