[Issue 20916] hard to find where a deprecation comes from

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 9 14:22:48 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20916

Mathias LANG <pro.mathias.lang at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang at gmail.com

--- Comment #2 from Mathias LANG <pro.mathias.lang at gmail.com> ---
Example code:
```
import std.stdio;

struct Foo
{
    pure nothrow @nogc @safe:
    deprecated string toString() const { return "Hello"; }
    int value;
}

void main ()
{
    Foo f;
    writeln(f);
}
```

Currently this prints:
```
std/format.d(3921): Deprecation: function foo.Foo.toString is deprecated
std/format.d(4053): Deprecation: function foo.Foo.toString is deprecated
```

We would like it to print something similar to how template instantiation
failures are printed, that is:
```
std/format.d(4053): Deprecation: function foo.Foo.toString is deprecated
std/format.d(4430):        instantiated from here:
formatObject!(LockingTextWriter, Foo, char)
std/format.d(1875):        instantiated from here:
formatValueImpl!(LockingTextWriter, Foo, char)
std/format.d(576):        instantiated from here:
formatValue!(LockingTextWriter, Foo, char)
std/stdio.d(1565):        instantiated from here:
formattedWrite!(LockingTextWriter, char, Foo)
std/stdio.d(3927):        instantiated from here: write!(Foo, char)
foo.d(15):        instantiated from here: writeln!(Foo)
```

--


More information about the Digitalmars-d-bugs mailing list