What I do is make my own @trusted debug_writeln.
@trusted void debug_writeln(T...)(T t) {
import std.stdio;
writeln(t);
}
Since this is @trusted, it will work inside @safe functions without changing anything. You can also just call it writeln and then don't import std.stdio or alias to force the disambiguation.