From 7aecde3a554c6ae70502eccaa49f72e2088a40fb Mon Sep 17 00:00:00 2001 From: Tomoya Tanjo Date: Mon, 28 Jul 2014 19:03:20 +0900 Subject: [PATCH] Mark std.file.readText as trusted --- std/file.d | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/std/file.d b/std/file.d index 4b724d92dbd..ccff06f3e6c 100644 --- a/std/file.d +++ b/std/file.d @@ -346,9 +346,10 @@ enforce(chomp(readText("deleteme")) == "abc"); ---- */ -S readText(S = string)(in char[] name) +S readText(S = string)(in char[] name) @safe if (isSomeString!S) { - auto result = cast(S) read(name); + static auto trustedCast(void[] buf) @trusted { return cast(S)buf; } + auto result = trustedCast(read(name)); std.utf.validate(result); return result; }