This is very bad. getAddressInfo() takes an ARBITRARY TYPE for its `options` parameter, yet it's marked @trusted ??! That's clearly ridiculous. What we need is a @safe unittest to ensure that it does not add any non-safety in the function body, but let the compiler determine whether the resulting combination with T is actually @safe.
Unfortunately, even this is not enough, because getAddressInfoImpl is @system, so we need to wrap the call to it in a @trusted nested function. Ugh.
Comment #3 by hsteoh — 2016-02-18T06:21:52Z
The sheer amount of @trusted functions in std.socket is utterly frightening. How sure are we that this code is adequately reviewed??
Comment #5 by github-bugzilla — 2016-04-18T13:51:43Z
Commits pushed to master at https://github.com/dlang/phoboshttps://github.com/dlang/phobos/commit/c35d4aa26efd0907ccb48d7406dffc50f470971c
Fix issue 14137: std.socket.getAddressInfo breaks @safe
Remove abuse of @trusted in template function getAddressInfo that cannot
guarantee that the incoming type argument is @safe. Localize @trusted
block of the function to the single call to getAddressInfoImpl(), so
that any @system code in T will be caught by the type system.
Add unittest to ensure such examples of T will be rejected at
compile-time.
Mark normal unittest for getAddressInfo as @safe to ensure that the
function body itself does not introduce any non-@safe code.
https://github.com/dlang/phobos/commit/8a3453129f57a9db19c15026d184fc4e9da18ac3
Merge pull request #4009 from quickfur/issue14137
Fix issue 14137: std.socket.getAddressInfo breaks @safe