Repository navigation
Re-stabilize Weak::as_ptr and friends for unsized T - #80764
Merged
Merged
Conversation
Contributor
|
(rust-highfive has picked a reviewer for you, use r? to override) |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
CAD97
force-pushed
the
weak-unsized-as-ptr-again
branch
from
January 6, 2021 23:36
863883b to
9e7e7ca
Compare
As per T-lang consensus, this uses a branch to handle the dangling case. The discussed optimization of only doing the branch in the T: ?Sized case is left for a followup patch, as doing so is not trivial (as it requires specialization for correctness, not just optimization).
CAD97
force-pushed
the
weak-unsized-as-ptr-again
branch
from
January 7, 2021 00:31
9e7e7ca to
6bc772c
Compare
RalfJung
reviewed
Jan 7, 2021
RalfJung
reviewed
Jan 7, 2021
RalfJung
reviewed
Jan 7, 2021
CAD97
commented
Jan 7, 2021
Member
|
@RalfJung do you think you can handle review here? It'll likely take me some time to get up to speed on the relevant code, I have not looked at Rc/Weak in detail in a while. |
commented
Jan 9, 2021
Member
|
Sure, can do. |
RalfJung
reviewed
Jan 10, 2021
RalfJung
reviewed
Jan 13, 2021
RalfJung
reviewed
Jan 13, 2021
Co-authored-by: Ralf Jung <post@ralfj.de>
commented
Jan 16, 2021
Member
|
Awesome, thanks a lot. :) |
commented
Jan 16, 2021
Contributor
|
📌 Commit c14e919 has been approved by |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
View all comments
As per T-lang consensus, this uses a branch to handle the dangling case. The discussed optimization of only doing the branch in the T: ?Sized case is left for a followup patch, as doing so is not trivial (as it requires specialization) and not obviously better (as it requires using
wrapping_offsetrather thanoffsetmore).Basically said optimization
Specialize on
T: Sized:(but with more
set_ptr_valueto avoidSizedrestrictions and maintain metadata.)Written in this fashion, this is not a correctness-critical specialization (i.e. so long as
[ T is Sized ]is false for unsizedT, it can berand()for sizedTwithout breaking correctness), but it's still touchy, so I'd rather do it in another PR with separate review.This effectively reverts #80422 and re-establishes #74160. T-libs previously signed off on this stable API change in #74160.