-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Make PinCoerceUnsized require Deref #149218
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
f921d32 to
f4fa919
Compare
|
@bors try |
Make PinCoerceUnsized require Deref
This comment has been minimized.
This comment has been minimized.
|
@craterbot check |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
I added these impls because otherwise the introduction of |
|
🎉 Experiment
Footnotes
|
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
Crater results are clean. Which team does this need an FCP with? |
|
☔ The latest upstream changes (presumably #150115) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Probably T-lang? |
Also, delete impls on non-Deref types. Pin doesn't do anything useful for non-Deref types, so PinCoerceUnsized on such types makes no sense. This is a breaking change, since stable code can observe the deleted `PinCoerceUnsized` impls by uselessly coercing between such types inside a `Pin`. There is still some strange behavior, such as `Pin<&mut i32>` being able to coerce to `Pin<&dyn Send>`, but not being able to coerce to `Pin<&i32>`. However, I don't think it's possible to fix this. Fixes rust-lang#145081
2d1fe43 to
969c3df
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I don't have any concerns with the library changes here, but this design change is indeed owned by @rust-lang/lang. r? lang (Sorry, I should have rerolled a long time ago) |
|
The lang team discussed this today. Everyone present was in agreement that we should remove the impls. Adding the fn bar(x: Pin<&i32>) -> Pin<*const dyn Send> {
x
}Note: This trait is unstable, so we could leave the |
|
Proposal: Let's merge this PR, but in accepting this let's leave open the question of whether @rfcbot fcp merge lang,libs-api |
|
Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
Yes, absolutely. This FCP should be about whether we are ok with the breaking change of removing all unsizing coercions where the source or target type is any of the following:
with the justification that you can't construct any of these types because all How to express unsizing coercions in the trait system should be kept as a separate topic. It happens to involve |
You can construct a |
|
I see, I did not realize that. However I believe this PR would remove that coercion too, since |
|
I guess my list is also missing some |
|
Agreed with the plan to revisit the @rfcbot reviewed |
|
@rfcbot reviewed |
Also, delete impls on non-Deref types.
Pin doesn't do anything useful for non-Deref types, so PinCoerceUnsized on such types makes no sense.
This is a breaking change, since stable code can observe the deleted
PinCoerceUnsizedimpls by uselessly coercing between such types inside aPin.There is still some strange behavior, such as
Pin<&mut i32>being able to coerce toPin<&dyn Send>, but not being able to coerce toPin<&i32>. However, I don't think it's possible to fix this.Fixes #145081