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

fix issue 18470 - std.algorithm.splitter has frame access problems for custom preds #6522

Merged
merged 1 commit into from Jun 5, 2018
Merged

Conversation

ghost
Copy link

@ghost ghost commented May 26, 2018

No description provided.

@dlang-bot
Copy link
Contributor

dlang-bot commented May 26, 2018

Thanks for your pull request and interest in making D better, @bbasile! 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 annotated coverage diff directly on GitHub with CodeCov's browser extension
  • 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
18470 normal std.algorithm.splitter has frame access problems for custom preds

Testing this PR locally

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

dub fetch digger
dub run digger -- build "master + phobos#6522"

@@ -3781,8 +3781,16 @@ if (is(typeof(binaryFun!pred(r.front, s)) : bool)
{
static size_t lastIndexOf(Range haystack, Separator needle)
{
// issue 18470 : we need to "copy" the custom pred.
Copy link
Author

Choose a reason for hiding this comment

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

"recontextualize" rather than "copy".

@dnadlinger
Copy link
Member

This looks more like a compiler bug at first glance. Surely fixing it there would be preferable?

@ghost
Copy link
Author

ghost commented May 27, 2018

This is not a compiler bug, the problem is that the range is static. So there's another way to solve the issue.
I don't know which is the best for now. It's still possible to revert second solution or to squash to erase the first.

@@ -3758,7 +3758,7 @@ if (is(typeof(binaryFun!pred(r.front, s)) : bool)
import std.algorithm.searching : find;
import std.conv : unsigned;

static struct Result
struct Result
Copy link
Member

Choose a reason for hiding this comment

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

remove extra space

@safe unittest // issue 18470
{
import std.algorithm;
import std.range;
Copy link
Member

Choose a reason for hiding this comment

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

change to specific function imports


@safe unittest // issue 18470
{
import std.algorithm;
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Member

@JackStouffer JackStouffer left a comment

Choose a reason for hiding this comment

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

This seems like a viable and simple solution with the only downside being a larger stack size.

@ghost
Copy link
Author

ghost commented Jun 5, 2018

Addressed review comments and squashed to delete the first solution.

@dlang-bot dlang-bot merged commit a6bf2b6 into dlang:master Jun 5, 2018
@ghost ghost deleted the issue-18470 branch June 5, 2018 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants