We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d52190c + 7aecde3 commit b5a783bCopy full SHA for b5a783b
1 file changed
std/file.d
@@ -346,9 +346,10 @@ enforce(chomp(readText("deleteme")) == "abc");
346
----
347
*/
348
349
-S readText(S = string)(in char[] name)
+S readText(S = string)(in char[] name) @safe if (isSomeString!S)
350
{
351
- auto result = cast(S) read(name);
+ static auto trustedCast(void[] buf) @trusted { return cast(S)buf; }
352
+ auto result = trustedCast(read(name));
353
std.utf.validate(result);
354
return result;
355
}
0 commit comments