-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Change bounds on TryFrom
blanket impl to use Into
instead of From
#56796
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @shepmaster (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@TimNN @shepmaster I can't figure out where it thinks there is an impl conflict, could you please help me find it? |
There's a test that's asserting on an error message and your changes have changed the error message:
|
Reason: Due to changes in bounds of `TryFrom` from `From` to `Into`
fix to last commit
/cc @SimonSapin any objections? |
I think this is fine, especially since |
This seems weird to me, honestly. |
@sfackler Why? |
Because these are direct promotions of the related trait, not the opposite version of that trait. |
@sfackler I understand that, but if we want the impl We can think of it like this Another way to do it would be to do This would also work, and may be easier to think about. If we don't want to change the Overall, having a tree structure for this would be bad, as it would punish some impls for reasons beyond their control. So I want to have a linear structure. Tree: Linear: |
Are there any more objections? |
I think all objections have been dealt with, can this be merged now? |
@bors r+ rollup I think, since it's unstable, it's worth giving this a shot. @KrishnaSannasi is it possible to write a test that shows the benefit of this ordering that would not be possible with the current setup? |
📌 Commit a1be813 has been approved by |
@shepmaster I'm not sure how to write tests, as this is my first go at hacking into the compiler, could you please give an example of how to do it? edit: |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
i.e. `Box`, instead it now uses `Vec`
@shepmaster I added the test, will that be sufficient or should it be different? |
@shepmaster It looks like |
Assigning over to make sure that |
@sfackler any further objections? |
@sfackler @SimonSapin @shepmaster |
@bors r+ rollup |
📌 Commit ea68b3f has been approved by |
…, r=shepmaster Change bounds on `TryFrom` blanket impl to use `Into` instead of `From` This is from this [comment](rust-lang#33417 (comment)) I made. This will expand the impls available for `TryFrom` and `TryInto`, without losing anything in the process.
Rollup of 5 pull requests Successful merges: - #56796 (Change bounds on `TryFrom` blanket impl to use `Into` instead of `From`) - #57768 (Continue parsing after parent type args and suggest using angle brackets) - #57769 (Suggest correct cast for struct fields with shorthand syntax) - #57783 (Add "dereference boxed value" suggestion.) - #57784 (Add span for bad doc comment) Failed merges: r? @ghost
This is from this comment I made.
This will expand the impls available for
TryFrom
andTryInto
, without losing anything in the process.