summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Wissner <belka@caraus.de>2019-04-22 10:50:58 +0200
committerGitHub <noreply@github.com>2019-04-22 10:50:58 +0200
commit73535568b79a0b124bc1653002637a830ce0fcb8 (patch)
treef6fd7a54a535810cd45e9917ce5e518815e1710e
parent76bda0ac8df2f9e5d49e126d16d785f5c63c4430 (diff)
parentb2a1a849f84c202618c4f463da5b008085f6cebf (diff)
downloadtanya-73535568b79a0b124bc1653002637a830ce0fcb8.tar.gz
Merge pull request #87 from n8sh/getAndPopFrontSafety
Ensure getAndPopFront/getAndPopBack don't promote `system` to `safe`
-rw-r--r--source/tanya/range/primitive.d12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/tanya/range/primitive.d b/source/tanya/range/primitive.d
index 258d5d5..c4cb54a 100644
--- a/source/tanya/range/primitive.d
+++ b/source/tanya/range/primitive.d
@@ -1566,6 +1566,12 @@ in (!range.empty)
{
static if (hasLvalueElements!R)
{
+ if (false)
+ {
+ // This code is removed by the compiler but ensures that
+ // this function isn't @safe if range.front isn't @safe.
+ auto _ = range.front();
+ }
auto el = (() @trusted => &range.front())();
}
else
@@ -1613,6 +1619,12 @@ in (!range.empty)
{
static if (hasLvalueElements!R)
{
+ if (false)
+ {
+ // This code is removed by the compiler but ensures that
+ // this function isn't @safe if range.back isn't @safe.
+ auto _ = range.back();
+ }
auto el = (() @trusted => &range.back())();
}
else