From 6bef53dd1a94e2a252b9bbce4c4ed3b2119a93e4 Mon Sep 17 00:00:00 2001 From: nordlow Date: Mon, 17 May 2021 00:02:04 +0200 Subject: [PATCH 1/2] Annotate std/algorithm/searching.d to please dlang/dmd#12520 #8076 --- std/algorithm/searching.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/std/algorithm/searching.d b/std/algorithm/searching.d index a7b5ba3f8f3..d5eb1612441 100644 --- a/std/algorithm/searching.d +++ b/std/algorithm/searching.d @@ -1601,7 +1601,7 @@ if (isInputRange!InputRange && { if (!__ctfe && canSearchInCodeUnits!char(needle)) { - static R trustedMemchr(ref R haystack, ref E needle) @trusted nothrow pure + static inout(R) trustedMemchr(ref return scope inout(R) haystack, ref const scope E needle) @trusted nothrow pure { import core.stdc.string : memchr; auto ptr = memchr(haystack.ptr, needle, haystack.length); @@ -1665,7 +1665,7 @@ if (isInputRange!InputRange && { import std.algorithm.comparison : max, min; - R findHelper(ref R haystack, ref E needle) @trusted nothrow pure + R findHelper(return scope ref R haystack, ref E needle) @trusted nothrow pure { import core.stdc.string : memchr; From 5d31a680823962a6f88df1b3036781fdf8946b74 Mon Sep 17 00:00:00 2001 From: nordlow Date: Mon, 17 May 2021 12:04:06 +0200 Subject: [PATCH 2/2] Break line to please maximum line length enforced by style checker --- std/algorithm/searching.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/std/algorithm/searching.d b/std/algorithm/searching.d index d5eb1612441..5b75ce1cfb5 100644 --- a/std/algorithm/searching.d +++ b/std/algorithm/searching.d @@ -1601,7 +1601,8 @@ if (isInputRange!InputRange && { if (!__ctfe && canSearchInCodeUnits!char(needle)) { - static inout(R) trustedMemchr(ref return scope inout(R) haystack, ref const scope E needle) @trusted nothrow pure + static inout(R) trustedMemchr(ref return scope inout(R) haystack, + ref const scope E needle) @trusted nothrow pure { import core.stdc.string : memchr; auto ptr = memchr(haystack.ptr, needle, haystack.length);