druntime icon indicating copy to clipboard operation
druntime copied to clipboard

Move doesPointTo

Open TurkeyMan opened this issue 5 years ago • 7 comments

As a bonus on top of #2442, this re-enables the message that complains if you try and move a type with an interior pointer.

I'm not even convinced the assert should exist; if I want to move something, I want to bloody move it! If I was stupid enough to create a thing with an interior pointer; then shame on me, but that shouldn't cause a compile error when I move it... perhaps the interior pointer is a tiny subset of the thing, which I intend to handle manually. If I need to move it, there's no escape hatch here. It feels like a higher-level concern.

Anyway, aside from the question of whether that assert should even be there at all, this PR pulls ~2000 new lines of code... to emit that error message. I don't know if I'm comfortable with the idea of introducing 2000 lines to druntime that do nothing except emit an error message when the user made a possible mistake. I'm not convinced the value justifies the cost...

TurkeyMan avatar Jan 08 '19 02:01 TurkeyMan

Thanks for your pull request and interest in making D better, @TurkeyMan! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

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 references

Your 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 locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + druntime#2447"

dlang-bot avatar Jan 08 '19 02:01 dlang-bot

Is the second commit dependent on the first one? i.e. does the first one need to be there if its already in another PR?

thewilsonator avatar Jan 08 '19 02:01 thewilsonator

Yes, the first PR should be merged, this one should not be merged... unless someone can convince me otherwise.

TurkeyMan avatar Jan 08 '19 02:01 TurkeyMan

Another thought; opMove, which has been accepted, will make that check incorrect. It will be the case that with opMove, you will be able to move objects with interior pointers.

TurkeyMan avatar Jan 08 '19 03:01 TurkeyMan

Yeah, for compile generated moves you need DIP1014 implemented, but for explicit moves there's no reason why we can't start supporting it now.

thewilsonator avatar Jan 08 '19 03:01 thewilsonator

Note that without this PR we can't get rid of the now duplicate implementation of move,{Emplace} in Phobos as there are tests for the doesPointTo check. See also: https://github.com/dlang/phobos/pull/6848

wilzbach avatar Jan 31 '19 15:01 wilzbach

Yeah see, I didn't move that function, because it's obscene. The fact that function is like 2 thousand lines suggests at some serious deficiency somewhere. Whatever the hell it's for, it should be worked-around ;)

TurkeyMan avatar Feb 01 '19 02:02 TurkeyMan