Skip to content

Commit

Permalink
Fix std.utf + stdx.logger for -dip1000
Browse files Browse the repository at this point in the history
  • Loading branch information
wilzbach committed Mar 15, 2018
1 parent d51fd2a commit 1cbd3db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 3 additions & 4 deletions std/experimental/logger/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,9 @@ private struct MsgRange

void put(dchar elem) @safe
{
import std.utf : encode;
char[4] buffer;
size_t len = encode(buffer, elem);
log.logMsgPart(buffer[0 .. len]);
import std.utf : toUTF8;
import std.range : only;
log.logMsgPart(elem.only.toUTF8);
}
}

Expand Down
12 changes: 12 additions & 0 deletions std/utf.d
Original file line number Diff line number Diff line change
Expand Up @@ -4091,6 +4091,7 @@ if (isSomeChar!C)

static if (isForwardRange!R)
{
static if (hasIndirections!R)
@property auto save() return scope
/* `return scope` cannot be inferred because compiler does not
* track it backwards from assignment to local `ret`
Expand All @@ -4100,6 +4101,17 @@ if (isSomeChar!C)
ret.r = r.save;
return ret;
}

static if (!hasIndirections!R)
@property auto save() scope
/* `return scope` cannot be inferred because compiler does not
* track it backwards from assignment to local `ret`
*/
{
auto ret = this;
ret.r = r.save;
return ret;
}
}

private:
Expand Down

0 comments on commit 1cbd3db

Please sign in to comment.