-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Resolve inherent associated functions & constants defined on function pointer types #108347
Conversation
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit ffad636 with merge 192617ada336ebe7e790566a33fd3b414937e71b... |
Nothing's wrong with the impl, just two things:
Let's see what rust-timer says, then go from there. |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (192617ada336ebe7e790566a33fd3b414937e71b): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
Closing for now due to the perf regression. Might re-open at some point once I have a vague idea how to speed things up. |
Ah, I just saw #103042 (comment), so potentially |
It seems like #108815 fixed the If the above is true and if I understood the situation correctly, it's worth rechecking the perf of this PR. |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit ffad636 with merge e322b72bfaf72c243e2cebc027cfbc2e6b050d00... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (e322b72bfaf72c243e2cebc027cfbc2e6b050d00): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
Gonna FCP this for T-types -- The question here is whether or not we want to be able to write incoherent/core impls for fn ptrs. I think it's good for consistency, but not particularly useful (since we can't be generic over argument arity), but also I see no harm in allowing it -- seems along the same lines that we allow incoherent impls for tuples. cc #94963 @rfcbot fcp merge |
Team member @compiler-errors has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns: 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! See this document for info about what commands tagged team members can give me. |
I cannot imagine us ever using this. Any impl for function pointers should go through the |
We could reject it with an error mentioning the FnPtr trait |
I'm confused here -- we are allowing incoherent impls? I would be more comfortable using |
@rfcbot concern fnptr Nothing against this PR per se, but I'd prefer that we use the |
Not outright, only with
|
I don't mind that approach either necessarily, but in that case, we probably should also reject inherent impls on tuples and maybe others... |
@rfcbot cancel |
@lcnr proposal cancelled. |
talked about this in the planning meeting today https://rust-lang.zulipchat.com/#narrow/stream/326132-t-types.2Fmeetings/topic/2023-08-07.20planning.20meeting/near/382646902 We would prefer to completely forbid inherent impls on function pointers with a suggestion to use the We are open to adding this once there is a valid use case here, but this feels quite unlikely as adding an impl for just one kind of function pointer is far from ideal. |
Makes sense. I'm gonna close this PR then & create a new one for forbidding inherent impls on function pointer types. |
Fixes #108270.