Skip to content
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

Make toDelegate safe for function pointers #8769

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Bolpat
Copy link
Contributor

@Bolpat Bolpat commented Jun 20, 2023

No description provided.

@Bolpat Bolpat requested a review from andralex as a code owner June 20, 2023 15:32
@dlang-bot
Copy link
Contributor

dlang-bot commented Jun 20, 2023

Thanks for your pull request and interest in making D better, @Bolpat! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
18171 enhancement std.functional.toDelegate should be usable in @safe

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#8769"

Copy link
Contributor

@dkorpel dkorpel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a new branch for function pointers, is the final else case obsolete now?

  • $(LI Does not work with @safe functions.)

This line is no longer accurate now

@Bolpat
Copy link
Contributor Author

Bolpat commented Jun 21, 2023

Why is there a new branch for function pointers, is the final else case obsolete now?

Because toDelegate works with any callable, the else branch cannot be @safe in general. To be @safe for function pointers, toDelegate needed a specific branch (or it looked like the best solution to me).

@Bolpat
Copy link
Contributor Author

Bolpat commented Jun 21, 2023

  • $(LI Does not work with @safe functions.)

This line is no longer accurate now

That should have been a review comment.

@dkorpel
Copy link
Contributor

dkorpel commented Jun 21, 2023

That should have been a review comment.

I can't comment on code not in the diff

@dkorpel
Copy link
Contributor

dkorpel commented Jun 21, 2023

Because toDelegate works with any callable

There's now branches for delegate, function, and opCall, what remaining cases does toDelegate support?

@dkorpel
Copy link
Contributor

dkorpel commented Jun 28, 2023

Ping @Bolpat

1 similar comment
@dkorpel
Copy link
Contributor

dkorpel commented Jul 5, 2023

Ping @Bolpat

@Bolpat
Copy link
Contributor Author

Bolpat commented Oct 20, 2023

Sorry, I was absent for a while. I looked into the failed checks and didn’t understand what’s wrong.

Should I force-push?

@PetarKirov
Copy link
Member

@Bolpat yes, please rebase & force-push.

@dkorpel
Copy link
Contributor

dkorpel commented Oct 31, 2023

Also, please answer #8769 (comment)

@thewilsonator thewilsonator added the Salvage This PR needs work, but we want to keep it and it can be salvaged. label Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Salvage This PR needs work, but we want to keep it and it can be salvaged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants