Skip to content
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

std.concurrency: Emit offending field name when failing to spawn() with mutable thread-local data #10373

Open
dlangBugzillaToGithub opened this issue May 16, 2019 · 2 comments

Comments

@dlangBugzillaToGithub
Copy link

andrej.mitrovich (@AndrejMitrovic) reported this on 2019-05-16T08:46:41Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=19879

Description

This message should be improved:

-----
/usr/local/opt/dmd/include/dlang/dmd/std/concurrency.d(449,5): Error: static assert:  "Aliases to mutable thread-local data not allowed."
mod.d(171,30):        instantiated from here: `spawn!(void function(Config) @system, Config)`
mod2.d(48,25):        instantiated from here: `__ctor!(Config)`
-----

It doesn't say which field is the offending one, just that there is some pointer or array somewhere, but it's really hard to determine what is the offending field when the data structure is complex.

With all the traits power D has, emitting the field name should be possible.
@dlangBugzillaToGithub
Copy link
Author

andrej.mitrovich (@AndrejMitrovic) commented on 2019-06-17T06:42:21Z

Alternative:

Make the ` hasLocalAliasing` function public. That way we can add the check to composite types on our own.

@dlangBugzillaToGithub
Copy link
Author

andrej.mitrovich (@AndrejMitrovic) commented on 2019-06-17T06:43:09Z

Actually I've just noticed it just uses std.traits.hasUnsharedAliasing internally, so never mind about the last suggestion.

@LightBender LightBender removed the P4 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants