-
-
Notifications
You must be signed in to change notification settings - Fork 707
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 #10538 - Cannot swap a std.typecons.Tuple #8864
Conversation
Thanks for your pull request and interest in making D better, @ntrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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 referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
|
this needs effort to make it pass CI. It should not be automerged by accident. Should be reviewed after being fixed. |
Please retitle the commit message "Fix bugzilla issue 24285 - ..." |
@ntrel |
Backup copy of the previous commits on the branch: https://github.com/0xEAB/phobos/tree/ntrel/swap-ctfe-backup |
AFACIT, apart from the sumtype breakage that is pointed out by CI, this fails at least this test: phobos/std/algorithm/sorting.d Line 2145 in 336bed6
|
std/algorithm/mutation.d
Outdated
/// ditto | ||
void swap(T)(ref T lhs, ref T rhs) | ||
if (is(typeof(lhs.proxySwap(rhs)))) | ||
{ | ||
lhs.proxySwap(rhs); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ntrel
What was this overload supposed to solve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I haven’t been able to figure that out myself.
All I can tell is that it breaks this code:
phobos/std/algorithm/sorting.d
Line 2145 in 336bed6
static assert(hasSwappableElements!R); |
/* | ||
This optimization caused compilation failures with no error message available: | ||
|
||
> Error: unknown, please file report on issues.dlang.org | ||
> std/sumtype.d(1262): Error: template instance `std.sumtype.SumType!(Flag, Tuple!(This*))` error instantiating | ||
*/ | ||
version (none) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was awful to debug. I’d love if someone could track this down and open a DMD bug report.
Co-authored-by: Elias Batek <[email protected]>
Avoid CTFE unsafe cast by swapping elements of
tupleof
.