-
-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix deprecation: std.utf.toUTF8 -> encode #5143
Conversation
std/json.d
Outdated
| @@ -823,7 +823,8 @@ if (isInputRange!T) | |||
| val += (isDigit(hex) ? hex - '0' : hex - ('A' - 10)) << (4 * i); | |||
| } | |||
| char[4] buf; | |||
| str.put(toUTF8(buf, val)); | |||
| encode(buf, val); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
immutable len = encode(buf, val);
str.put(buf[0 .. len]);
std/uri.d
Outdated
| import std.utf : toUTF8; | ||
| // selective imports trigger wrong deprecation | ||
| // https://issues.dlang.org/show_bug.cgi?id=17193 | ||
| import std.utf; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is going to trigger a failure in circle
std/json.d
Outdated
| @@ -703,7 +703,7 @@ JSONValue parseJSON(T)(T json, int maxDepth = -1, JSONOptions options = JSONOpti | |||
| if (isInputRange!T) | |||
| { | |||
| import std.ascii : isWhite, isDigit, isHexDigit, toUpper, toLower; | |||
| import std.utf : toUTF8; | |||
| import std.utf : encode, Yes; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes is from std.typecons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW any module using template flags is supposed to export Yes as well, so this is really personal preference or personal purism ;-)
std/stdio.d
Outdated
| auto b = toUTF8(buf, c); | ||
| foreach (i ; 0 .. b.length) | ||
| trustedFPUTC(b[i], handle_); | ||
| auto len = encode(buf, c); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
immutable
a4831ed to
31c4226
Compare
|
Auto-merge toggled on |
It seems like DMD doesn't like deprecating only one symbol. For selective imports it will always trigger a deprecation warning even if the symbol isn't used (issue 17193).
This PR fixes the deprecation warnings from
toUTF8on Posix.grepshows that there are more on Windows.