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
WIP: Extend cases where expressions are passed by move [skip ci] #11686
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request and interest in making D better, @nordlow! 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. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#11686" |
6cd8f44
to
b2a0a61
Compare
Taking a quick look, I'm not 100% certain I understand exactly how you plan to achieve this. Bear in mind that anything that requires caller-callee coordination cannot be done "magically", because of separate compilation. Even for templates, the compiler will not emit templates that it knows are already instantiated in the root module that defines the template.
Why not use |
2e77530
to
c4393ea
Compare
Pointer is not @andralex has approved this move-enhancement here dlang/phobos#4971. |
Currently, there is a move DIP in the DIP queue that is authored by @WalterBright . I suspect that part of this implementation is going to be part the implementation of the DFA that identifies where to insert calls to the move constructor. |
This enables more situations where variables and parameters are automatically passed by move. It works by detecting when all the references to a
VarDeclaration
can be passed by move. For those cases move is triggered by settingSTC.rvalue
of theVarDeclaration
.The first goal here is to enable a lazy range to be constructed with a non-copyable container type as its source ranges, typically, as
. This case can be activated by a simple special-casing in
inferStatementRvalues
without the current added book-keepingsVarExp.vrefOrder
VarDeclaration.vrefCount
VarDeclaraiton.wasMovedBy
which are currently there for experimenting purposes.
There book-keepings are here because they enable more pass-by-move cases. The question is if we should try enabling these as well.
There's now also a possibility to enable better error messages by giving the location of the
VarExp
that already moved aVarDeclaration
if more than one move occurs for the sameVarDeclaration
.