mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 14:10:30 +03:00
Fixes Issue 9373 - Add deprecation messages to Phobos.
This commit is contained in:
parent
c89b21e38f
commit
aaa6854eb7
8 changed files with 44 additions and 53 deletions
|
@ -4606,7 +4606,8 @@ unittest
|
||||||
* assert(std.algorithm.countUntil("日本語", '本') == 1);
|
* assert(std.algorithm.countUntil("日本語", '本') == 1);
|
||||||
* --------
|
* --------
|
||||||
*/
|
*/
|
||||||
deprecated ptrdiff_t indexOf(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle)
|
deprecated("Please use std.algorithm.countUntil instead.")
|
||||||
|
ptrdiff_t indexOf(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle)
|
||||||
if (is(typeof(startsWith!pred(haystack, needle))))
|
if (is(typeof(startsWith!pred(haystack, needle))))
|
||||||
{
|
{
|
||||||
return countUntil!pred(haystack, needle);
|
return countUntil!pred(haystack, needle);
|
||||||
|
@ -6160,7 +6161,7 @@ assert(minCount!("a > b")(a) == tuple(4, 2));
|
||||||
*/
|
*/
|
||||||
Tuple!(ElementType!Range, size_t)
|
Tuple!(ElementType!Range, size_t)
|
||||||
minCount(alias pred = "a < b", Range)(Range range)
|
minCount(alias pred = "a < b", Range)(Range range)
|
||||||
if (isInputRange!Range && !isInfinite!Range &&
|
if (isInputRange!Range && !isInfinite!Range &&
|
||||||
is(typeof(binaryFun!pred(range.front, range.front))))
|
is(typeof(binaryFun!pred(range.front, range.front))))
|
||||||
{
|
{
|
||||||
enforce(!range.empty, "Can't count elements from an empty range");
|
enforce(!range.empty, "Can't count elements from an empty range");
|
||||||
|
@ -6222,7 +6223,7 @@ assert(minPos!("a > b")(a) == [ 4, 1, 2, 4, 1, 1, 2 ]);
|
||||||
----
|
----
|
||||||
*/
|
*/
|
||||||
Range minPos(alias pred = "a < b", Range)(Range range)
|
Range minPos(alias pred = "a < b", Range)(Range range)
|
||||||
if (isForwardRange!Range && !isInfinite!Range &&
|
if (isForwardRange!Range && !isInfinite!Range &&
|
||||||
is(typeof(binaryFun!pred(range.front, range.front))))
|
is(typeof(binaryFun!pred(range.front, range.front))))
|
||||||
{
|
{
|
||||||
if (range.empty) return range;
|
if (range.empty) return range;
|
||||||
|
@ -9781,30 +9782,26 @@ unittest
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.canFind.
|
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.canFind.
|
||||||
deprecated bool canFindSorted(alias pred = "a < b", Range, V)(Range range, V value) {
|
deprecated("Please use std.range.SortedRange.canFind instead.")
|
||||||
pragma(msg, "std.algorithm.canFindSorted has been deprecated. " ~
|
bool canFindSorted(alias pred = "a < b", Range, V)(Range range, V value) {
|
||||||
"Please use std.range.SortedRange.canFind instead.");
|
|
||||||
return assumeSorted!pred(range).canFind!V(value);
|
return assumeSorted!pred(range).canFind!V(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.lowerBound.
|
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.lowerBound.
|
||||||
deprecated Range lowerBound(alias pred = "a < b", Range, V)(Range range, V value) {
|
deprecated("Please use std.range.SortedRange.lowerBound instead.")
|
||||||
pragma(msg, "std.algorithm.lowerBound has been deprecated. " ~
|
Range lowerBound(alias pred = "a < b", Range, V)(Range range, V value) {
|
||||||
"Please use std.range.SortedRange.lowerBound instead.");
|
|
||||||
return assumeSorted!pred(range).lowerBound!V(value).release;
|
return assumeSorted!pred(range).lowerBound!V(value).release;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.upperBound.
|
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.upperBound.
|
||||||
deprecated Range upperBound(alias pred = "a < b", Range, V)(Range range, V value) {
|
deprecated("Please use std.range.SortedRange.upperBound instead.")
|
||||||
pragma(msg, "std.algorithm.upperBound has been deprecated. " ~
|
Range upperBound(alias pred = "a < b", Range, V)(Range range, V value) {
|
||||||
"Please use std.range.SortedRange.upperBound instead.");
|
|
||||||
return assumeSorted!pred(range).upperBound!V(value).release;
|
return assumeSorted!pred(range).upperBound!V(value).release;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.equalRange.
|
// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.equalRange.
|
||||||
deprecated Range equalRange(alias pred = "a < b", Range, V)(Range range, V value) {
|
deprecated("Please use std.range.SortedRange.equalRange instead.")
|
||||||
pragma(msg, "std.algorithm.equalRange has been deprecated. " ~
|
Range equalRange(alias pred = "a < b", Range, V)(Range range, V value) {
|
||||||
"Please use std.range.SortedRange.equalRange instead.");
|
|
||||||
return assumeSorted!pred(range).equalRange!V(value).release;
|
return assumeSorted!pred(range).equalRange!V(value).release;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -744,7 +744,8 @@ unittest
|
||||||
}
|
}
|
||||||
|
|
||||||
//Explicitly undocumented. Do not use. To be removed in March 2013.
|
//Explicitly undocumented. Do not use. To be removed in March 2013.
|
||||||
deprecated bool receiveTimeout(T...)( long ms, T ops )
|
deprecated("Please use the overload of receiveTimeout which takes a Duration.")
|
||||||
|
bool receiveTimeout(T...)( long ms, T ops )
|
||||||
{
|
{
|
||||||
return receiveTimeout( dur!"msecs"( ms ), ops );
|
return receiveTimeout( dur!"msecs"( ms ), ops );
|
||||||
}
|
}
|
||||||
|
|
37
std/conv.d
37
std/conv.d
|
@ -1131,13 +1131,11 @@ unittest
|
||||||
|
|
||||||
Conversions to string with optional configures.
|
Conversions to string with optional configures.
|
||||||
*/
|
*/
|
||||||
deprecated T toImpl(T, S)(S s, in T leftBracket, in T separator = ", ", in T rightBracket = "]")
|
deprecated("Please use std.format.formattedWrite instead.")
|
||||||
|
T toImpl(T, S)(S s, in T leftBracket, in T separator = ", ", in T rightBracket = "]")
|
||||||
if (!isSomeChar!(ElementType!S) && (isInputRange!S || isInputRange!(Unqual!S)) &&
|
if (!isSomeChar!(ElementType!S) && (isInputRange!S || isInputRange!(Unqual!S)) &&
|
||||||
isExactSomeString!T)
|
isExactSomeString!T)
|
||||||
{
|
{
|
||||||
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
|
|
||||||
"std.format.formattedWrite"));
|
|
||||||
|
|
||||||
static if (!isInputRange!S)
|
static if (!isInputRange!S)
|
||||||
{
|
{
|
||||||
alias toImpl!(T, Unqual!S) ti;
|
alias toImpl!(T, Unqual!S) ti;
|
||||||
|
@ -1168,24 +1166,20 @@ deprecated T toImpl(T, S)(S s, in T leftBracket, in T separator = ", ", in T rig
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
deprecated T toImpl(T, S)(ref S s, in T leftBracket, in T separator = " ", in T rightBracket = "]")
|
deprecated("Please use std.format.formattedWrite instead.")
|
||||||
|
T toImpl(T, S)(ref S s, in T leftBracket, in T separator = " ", in T rightBracket = "]")
|
||||||
if ((is(S == void[]) || is(S == const(void)[]) || is(S == immutable(void)[])) &&
|
if ((is(S == void[]) || is(S == const(void)[]) || is(S == immutable(void)[])) &&
|
||||||
isExactSomeString!T)
|
isExactSomeString!T)
|
||||||
{
|
{
|
||||||
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
|
|
||||||
"std.format.formattedWrite"));
|
|
||||||
|
|
||||||
return toImpl(s);
|
return toImpl(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
deprecated T toImpl(T, S)(S s, in T leftBracket, in T keyval = ":", in T separator = ", ", in T rightBracket = "]")
|
deprecated("Please use std.format.formattedWrite instead.")
|
||||||
|
T toImpl(T, S)(S s, in T leftBracket, in T keyval = ":", in T separator = ", ", in T rightBracket = "]")
|
||||||
if (isAssociativeArray!S && !is(S == enum) &&
|
if (isAssociativeArray!S && !is(S == enum) &&
|
||||||
isExactSomeString!T)
|
isExactSomeString!T)
|
||||||
{
|
{
|
||||||
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
|
|
||||||
"std.format.formattedWrite"));
|
|
||||||
|
|
||||||
alias Unqual!(ElementEncodingType!T) Char;
|
alias Unqual!(ElementEncodingType!T) Char;
|
||||||
auto result = appender!(Char[])();
|
auto result = appender!(Char[])();
|
||||||
// hash-to-string conversion
|
// hash-to-string conversion
|
||||||
|
@ -1205,26 +1199,22 @@ deprecated T toImpl(T, S)(S s, in T leftBracket, in T keyval = ":", in T separat
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
deprecated T toImpl(T, S)(S s, in T nullstr)
|
deprecated("Please use std.format.formattedWrite instead.")
|
||||||
|
T toImpl(T, S)(S s, in T nullstr)
|
||||||
if (is(S : Object) &&
|
if (is(S : Object) &&
|
||||||
isExactSomeString!T)
|
isExactSomeString!T)
|
||||||
{
|
{
|
||||||
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
|
|
||||||
"std.format.formattedWrite"));
|
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return nullstr;
|
return nullstr;
|
||||||
return to!T(s.toString());
|
return to!T(s.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
deprecated T toImpl(T, S)(S s, in T left, in T separator = ", ", in T right = ")")
|
deprecated("Please use std.format.formattedWrite instead.")
|
||||||
|
T toImpl(T, S)(S s, in T left, in T separator = ", ", in T right = ")")
|
||||||
if (is(S == struct) && !is(typeof(&S.init.toString)) && !isInputRange!S &&
|
if (is(S == struct) && !is(typeof(&S.init.toString)) && !isInputRange!S &&
|
||||||
isExactSomeString!T)
|
isExactSomeString!T)
|
||||||
{
|
{
|
||||||
pragma(msg, hardDeprec!("2.060", "January 2013", "std.conv.toImpl with extra parameters",
|
|
||||||
"std.format.formattedWrite"));
|
|
||||||
|
|
||||||
Tuple!(FieldTypeTuple!S) * t = void;
|
Tuple!(FieldTypeTuple!S) * t = void;
|
||||||
static if ((*t).sizeof == S.sizeof)
|
static if ((*t).sizeof == S.sizeof)
|
||||||
{
|
{
|
||||||
|
@ -3800,10 +3790,3 @@ unittest
|
||||||
toTextRange(-1, result);
|
toTextRange(-1, result);
|
||||||
assert(result.data == "-1");
|
assert(result.data == "-1");
|
||||||
}
|
}
|
||||||
|
|
||||||
template hardDeprec(string vers, string date, string oldFunc, string newFunc)
|
|
||||||
{
|
|
||||||
enum hardDeprec = Format!("Notice: As of Phobos %s, %s has been deprecated. " ~
|
|
||||||
"It will be removed in %s. Please use %s instead.",
|
|
||||||
vers, oldFunc, date, newFunc);
|
|
||||||
}
|
|
||||||
|
|
|
@ -562,7 +562,8 @@ template enforceEx(E)
|
||||||
If $(D !!value) is $(D true), $(D value) is returned. Otherwise,
|
If $(D !!value) is $(D true), $(D value) is returned. Otherwise,
|
||||||
$(D new E(msg)) is thrown.
|
$(D new E(msg)) is thrown.
|
||||||
+/
|
+/
|
||||||
deprecated template enforceEx(E)
|
deprecated("Please use the version of enforceEx which takes an exception that constructs with new E(msg, file, line).")
|
||||||
|
template enforceEx(E)
|
||||||
if (is(typeof(new E(""))) && !is(typeof(new E("", __FILE__, __LINE__))) && !is(typeof(new E(__FILE__, __LINE__))))
|
if (is(typeof(new E(""))) && !is(typeof(new E("", __FILE__, __LINE__))) && !is(typeof(new E(__FILE__, __LINE__))))
|
||||||
{
|
{
|
||||||
T enforceEx(T)(T value, lazy string msg = "")
|
T enforceEx(T)(T value, lazy string msg = "")
|
||||||
|
|
12
std/file.d
12
std/file.d
|
@ -2028,7 +2028,8 @@ unittest
|
||||||
* }
|
* }
|
||||||
* ----
|
* ----
|
||||||
*/
|
*/
|
||||||
deprecated alias listDir listdir;
|
deprecated("Please use dirEntries instead.")
|
||||||
|
alias listDir listdir;
|
||||||
|
|
||||||
|
|
||||||
/***************************************************
|
/***************************************************
|
||||||
|
@ -3027,7 +3028,8 @@ void main(string[] args)
|
||||||
}
|
}
|
||||||
--------------------
|
--------------------
|
||||||
+/
|
+/
|
||||||
deprecated string[] listDir(C)(in C[] pathname)
|
deprecated("Please use dirEntries instead.")
|
||||||
|
string[] listDir(C)(in C[] pathname)
|
||||||
{
|
{
|
||||||
auto result = appender!(string[])();
|
auto result = appender!(string[])();
|
||||||
|
|
||||||
|
@ -3097,7 +3099,8 @@ void main(string[] args)
|
||||||
}
|
}
|
||||||
--------------------
|
--------------------
|
||||||
+/
|
+/
|
||||||
deprecated string[] listDir(C, U)(in C[] pathname, U filter, bool followSymlink = true)
|
deprecated("Please use dirEntries instead.")
|
||||||
|
string[] listDir(C, U)(in C[] pathname, U filter, bool followSymlink = true)
|
||||||
if(is(C : char) && !is(U: bool delegate(string filename)))
|
if(is(C : char) && !is(U: bool delegate(string filename)))
|
||||||
{
|
{
|
||||||
import std.regexp;
|
import std.regexp;
|
||||||
|
@ -3169,7 +3172,8 @@ deprecated string[] listDir(C, U)(in C[] pathname, U filter, bool followSymlink
|
||||||
* }
|
* }
|
||||||
* ----
|
* ----
|
||||||
*/
|
*/
|
||||||
deprecated void listDir(C, U)(in C[] pathname, U callback)
|
deprecated("Please use dirEntries instead.")
|
||||||
|
void listDir(C, U)(in C[] pathname, U callback)
|
||||||
if(is(C : char) && is(U: bool delegate(string filename)))
|
if(is(C : char) && is(U: bool delegate(string filename)))
|
||||||
{
|
{
|
||||||
_listDir(pathname, callback);
|
_listDir(pathname, callback);
|
||||||
|
|
|
@ -66,7 +66,8 @@ class FormatException : Exception
|
||||||
$(RED Deprecated. It will be removed In January 2013.
|
$(RED Deprecated. It will be removed In January 2013.
|
||||||
Please use $(D FormatException) instead.)
|
Please use $(D FormatException) instead.)
|
||||||
+/
|
+/
|
||||||
deprecated alias FormatException FormatError;
|
deprecated("Please use FormatException instead.")
|
||||||
|
alias FormatException FormatError;
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Interprets variadic argument list $(D args), formats them according
|
Interprets variadic argument list $(D args), formats them according
|
||||||
|
|
|
@ -12,7 +12,8 @@ module std.syserror;
|
||||||
|
|
||||||
// Deprecated - instead use std.windows.syserror.sysErrorString()
|
// Deprecated - instead use std.windows.syserror.sysErrorString()
|
||||||
|
|
||||||
deprecated class SysError
|
deprecated("Please use std.windows.syserror.sysErrorString instead")
|
||||||
|
class SysError
|
||||||
{
|
{
|
||||||
private import std.c.stdio;
|
private import std.c.stdio;
|
||||||
private import std.c.string;
|
private import std.c.string;
|
||||||
|
|
|
@ -1265,12 +1265,14 @@ public:
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated uint value_DWORD_LITTLEENDIAN()
|
deprecated("Please use value_DWORD instead.")
|
||||||
|
uint value_DWORD_LITTLEENDIAN()
|
||||||
{
|
{
|
||||||
return value_DWORD;
|
return value_DWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated uint value_DWORD_BIGENDIAN()
|
deprecated("Please use value_DWORD instead.")
|
||||||
|
uint value_DWORD_BIGENDIAN()
|
||||||
{
|
{
|
||||||
return value_DWORD;
|
return value_DWORD;
|
||||||
}
|
}
|
||||||
|
@ -1293,7 +1295,8 @@ public:
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated ulong value_QWORD_LITTLEENDIAN()
|
deprecated("Please use value_QWORD instead.")
|
||||||
|
ulong value_QWORD_LITTLEENDIAN()
|
||||||
{
|
{
|
||||||
return value_QWORD;
|
return value_QWORD;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue