-
-
Notifications
You must be signed in to change notification settings - Fork 668
Skip over return parameters for return destination #12601
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
Conversation
|
Thanks for your pull request and interest in making D better, @dkorpel! 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#12601" |
|
Ping @WalterBright @atilaneves, it's a language change, so this needs approval from you. I'll add a changelog entry and spec PR if this gets the green light. If you want more information or time to ponder, please say so. Currently I'm not sure whether you're busy or simply overlooked this. |
|
Let me confer with @WalterBright |
|
I think we should be careful with changes in this direction - this seems better than what we have now, but (although they seem to be non grata in D) I prefer the redundancy of a proper annotation. |
|
To be clear, the short term goal is to fix Issue 20150 - -dip1000 defeated by pure, which is blocked by Phobos and Druntime relying on the accepts-invalid bug to compile, so I've been working on removing the violations. Awaiting dlang/phobos#8123, this is the current list of remaining functions: Druntime build: ✔️ Druntime unittest build: src/core/internal/dassert.d(166): Warning: parameter `val` of `atomicLoad` is cheating `scope`
src/core/lifetime.d(1881): Warning: parameter `source` of `moveImpl` is cheating `scope`Phobos build: std/path.d(1495): Warning: parameter `segments` of `buildPath` is cheating `scope`
std/file.d(3058): Warning: parameter `path` of `dirName` is cheating `scope`
std/algorithm/mutation.d(1192): Warning: parameter `source` of `moveImpl` is cheating `scope`
std/path.d(2758): Warning: parameter `r` of `array` is cheating `scope`
std/internal/cstring.d(303): Warning: parameter `ptr` of `enforceRealloc` is cheating `scope`
std/algorithm/mutation.d(1192): Warning: parameter `source` of `moveImpl` is cheating `scope`
std/uni/package.d(1836): Warning: parameter `ptr` of `enforceRealloc` is cheating `scope`
std/algorithm/mutation.d(1192): Warning: parameter `source` of `moveImpl` is cheating `scope`Phobos unittest build: TODO As you can see,
Me too, but the issue is long overdue for fixing. Considering what @atilaneves says about dip1000 bugs: #12578 (comment)
I think options 3 and 4 (or 6?) are the most viable, but I need an executive decision. |
|
This needs an enhancement request bugzilla entry or a changelog. |
|
My evaluation of the situation: |
Extension of #8504 in an attempt to make
core.lifetime: movecompatible with -dip1000.Additional context: DIP1000: The return of 'Extend Return Scope Semantics'
The idea is: instead of only considering the first parameter as the return destination, skip over parameters already determined to be
return. After all, in the signature of move:Making
returnparametersourceits own return destination accomplishes nothing.This could be further extended to skip over parameters without pointer types, e.g.:
But it deliberately does not do that to keep it a bit simpler.
@WalterBright @atilaneves