-
-
Notifications
You must be signed in to change notification settings - Fork 741
Fix Issue 6644 - std.stdio write/writef(ln) are not @trusted #2233
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
Conversation
@@ -2208,7 +2208,7 @@ $(D Range) that locks the file and allows fast writing to it. | |||
|
|||
See $(LREF byChunk) for an example. | |||
*/ | |||
auto lockingTextWriter() | |||
auto lockingTextWriter() @trusted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of blunt, see #2225
ping |
This needs to be updated on top of #2225 - |
Will update this to work with #2225. |
#2321 was merged, please update/rebase this, currently fails the auto-tester |
Updated to be compatible with #2321. Tests pass locally and will fix any issues that come up in the auto-tester. |
Thanks. LGTM from me, need one more reviewer |
} | ||
} | ||
|
||
@trusted void trustedTests() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System is the same as trusted, as far as the allowed operations are concerned, so just get rid of this section.
@rbanderton: Thanks a lot, looks good to me now! One last request: Could you please squash the commits together into one? |
Of course. Rebased to master/squashed commits. |
LGTM. This will make |
Auto-merge toggled on |
Fix Issue 6644 - std.stdio write/writef(ln) are not @trusted
https://issues.dlang.org/show_bug.cgi?id=6644
More discussion here: http://stackoverflow.com/questions/19101305/how-can-i-do-i-o-in-safe-functions-in-d
Changes I have made to get
write
and family callable from@safe
code:LockingTextWriter
and factory function@trusted
- I didn't see anything inherently unsafe about the way it manages the lock. I'm certainly open to correction, though.stdout
global variable's usage in aprivate @trusted
property that is used bywrite
and friends. If this is not done they always infer to@system
due to accessing a global variable. I'm not 100% sure this is safe to to, but with the property being private all external use of the global will still be@system
.This is much like #2230 except it does not use free functions - after more testing I found they worked fine as member functions. This is a separate pull request because I'm terrible at git :/