Fix druntime -preview=nosharedaccess errors#23056
Conversation
|
Thanks for your pull request and interest in making D better, @atilaneves! 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#23056" |
bdaf3f7 to
7603e09
Compare
91c4949 to
b5c212a
Compare
|
Do ping when this is no longer draft |
|
Thanks for moving on this! I added some comments. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ping |
|
I don't think this is ready; the Repeated for visibility:
That's surprising on impact... but I can see how it manifests. Is it correct though? Let's think this through. It starts These are obvious, because the unshared pointer/slice are a variable in its own right. shared(int) i;
shared(int)* pi = &i; // obviously, we can handle the address of a shared thing!
// so, this should be legal:
shared(int[10]) s;
shared(int[10])* y = &s; // <- obviously acceptable
shared(int)[] x = s[]; // <- if it's not, then that's a bug; valid to take the address of a shared thing, 10 is just an int literal
shared(int)* p = x.ptr + 5; // <- clearly legal, x.ptr/length are not shared
shared(int)* q = &x[5]; // <- so, same operation? or does the compiler 'imagine' a value resolution before the `&`?
// and then these cases:
shared(int)* r = &s[5]; // obviously legal, and valid code can arrive here as shown above
shared(int)* s = &y[5]; // dittoSo, I think I'm convinced that Needs a language fix, then remove this mess :) |
|
Also, the problem with How do we distinguish a With this in mind; We also DESPERATELY need struct inheritence! We've needed it forever, we need it more than ever. |
|
A lot of these problems originate in a single decision, trying to force There is a reason why I have long held and suggested that we needed a dedicated atomic storage class. The atomic nature of a cell does not reflect the atomic nature of any contained cells that are stored via a pointer. Just keep in mind those sync classes, which support synchronized won't be supported as structs. |
This makes druntime build and run its unittest target with -preview=nosharedaccess enabled.