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

byLine and byLineCopy should be safe #10605

Open
0xEAB opened this issue Jan 1, 2025 · 1 comment
Open

byLine and byLineCopy should be safe #10605

0xEAB opened this issue Jan 1, 2025 · 1 comment

Comments

@0xEAB
Copy link
Member

0xEAB commented Jan 1, 2025

(@MartinNowak) commented on 2017-12-21T17:01:39Z

std.stdio.File.byLine:

Should be @safe as the internally used buffer is GC allocated, thus unexpected mutation of an escaped line is possible, but cannot cause a memory corruption.

@safe function 'foo' cannot call @system function 'std.stdio.File.byLine!(char, char).byLine'
@safe function 'foo' cannot call @system destructor 'std.stdio.File.ByLine!(char, char).ByLine.~this'

std.stdio.File.byLineCopy:

obviously

@safe function 'foo' cannot call @system function 'std.stdio.File.byLineCopy!(char, immutable(char)).byLineCopy'
@safe function 'foo' cannot call @system destructor 'std.stdio.File.ByLineCopy!(immutable(char), char).ByLineCopy.~this'

From: #10273

@0xEAB
Copy link
Member Author

0xEAB commented Jan 1, 2025

I think #9035 might take care of this, but it still is WIP and lacks testcases is only a small step in that direction AFAICT.

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

1 participant