Issue 19879 - std.concurrency: Emit offending field name when failing to spawn() with mutable thread-local data
Summary: std.concurrency: Emit offending field name when failing to spawn() with mutab...
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-16 08:46 UTC by Andrej Mitrovic
Modified: 2024-12-01 16:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2019-05-16 08:46:41 UTC
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.
Comment 1 Andrej Mitrovic 2019-06-17 06:42:21 UTC
Alternative:

Make the ` hasLocalAliasing` function public. That way we can add the check to composite types on our own.
Comment 2 Andrej Mitrovic 2019-06-17 06:43:09 UTC
Actually I've just noticed it just uses std.traits.hasUnsharedAliasing internally, so never mind about the last suggestion.
Comment 3 dlangBugzillaToGithub 2024-12-01 16:35:02 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10373

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB