From de760f56df2818f6eb79023a69fd24a6d448eea1 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 20 Mar 2024 11:29:35 +0000 Subject: [PATCH] Use @trusted qualifier cast Needed for https://github.com/dlang/dmd/pull/16315. --- src/dparse/lexer.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dparse/lexer.d b/src/dparse/lexer.d index 168943af..dcc56823 100644 --- a/src/dparse/lexer.d +++ b/src/dparse/lexer.d @@ -147,7 +147,7 @@ mixin template TokenTriviaFields() import dparse.trivia : extractLeadingDdoc; if (memoizedLeadingComment !is null) return memoizedLeadingComment; - return (cast()memoizedLeadingComment) = this.extractLeadingDdoc; + return (ref () @trusted => cast() memoizedLeadingComment)() = this.extractLeadingDdoc; } /// ditto @@ -155,7 +155,7 @@ mixin template TokenTriviaFields() import dparse.trivia : extractTrailingDdoc; if (memoizedTrailingComment !is null) return memoizedTrailingComment; - return (cast()memoizedTrailingComment) = this.extractTrailingDdoc; + return (ref () @trusted => cast() memoizedLeadingComment)() = this.extractTrailingDdoc; } int opCmp(size_t i) const pure nothrow @safe @nogc {