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

std.algorithm.mutation.copy fails on overlapping arrays if the source array's pointer is less than the destination array's pointer #7879

Merged
merged 1 commit into from Mar 18, 2021

Conversation

n8sh
Copy link
Member

@n8sh n8sh commented Mar 18, 2021

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @n8sh!

Bugzilla references

Auto-close Bugzilla Severity Description
21724 major std.algorithm.mutation.copy fails on overlapping arrays if the source array's pointer is less than the destination array's pointer

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 "stable + phobos#7879"

return source.ptr < target.ptr + tlen &&
target.ptr < source.ptr + slen; }();

if (overlaps)
{
foreach (idx; 0 .. slen)
target[idx] = source[idx];
if ((() @trusted => source.ptr < target.ptr)())
Copy link
Member Author

Choose a reason for hiding this comment

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

DMD infers this as safe without a @trusted lambda.

…rays if the source array's pointer is less than the destination array's pointer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants