Fix #10538 - Cannot swap a std.typecons.Tuple#8864
Fix #10538 - Cannot swap a std.typecons.Tuple#8864thewilsonator merged 2 commits intodlang:masterfrom
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.
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
| /* | ||
| 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.
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 <0xEAB@users.noreply.github.com>
Avoid CTFE unsafe cast by swapping elements of
tupleof.