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

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-05-16T08:46:41Z
Last change time
2024-12-01T16:35:02Z
Assigned to
No Owner
Creator
Andrej Mitrovic
Moved to GitHub: phobos#10373 →

Comments

Comment #0 by andrej.mitrovich — 2019-05-16T08:46:41Z
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 by andrej.mitrovich — 2019-06-17T06:42:21Z
Alternative: Make the ` hasLocalAliasing` function public. That way we can add the check to composite types on our own.
Comment #2 by andrej.mitrovich — 2019-06-17T06:43:09Z
Actually I've just noticed it just uses std.traits.hasUnsharedAliasing internally, so never mind about the last suggestion.
Comment #3 by robert.schadek — 2024-12-01T16:35:02Z
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