From b2a1a849f84c202618c4f463da5b008085f6cebf Mon Sep 17 00:00:00 2001 From: Nathan Sashihara <21227491+n8sh@users.noreply.github.com> Date: Fri, 19 Apr 2019 09:34:30 -0400 Subject: [PATCH] Ensure getAndPopFront/getAndPopBack don't promote `system` to `safe` --- source/tanya/range/primitive.d | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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