Skip to content

Commit

Permalink
Merge pull request #358 from vibe-d/fix_deprecation_warnings
Browse files Browse the repository at this point in the history
Fix deprecation warnings
  • Loading branch information
s-ludwig authored Sep 2, 2023
2 parents 050c5c1 + 91bc4ae commit a1258ab
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 33 deletions.
15 changes: 1 addition & 14 deletions source/vibe/core/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -838,20 +838,7 @@ struct DirectoryWatcher { // TODO: avoid all those heap allocations!
LocalManualEvent changeEvent;
shared(NativeEventDriver) driver;

// Support for `-preview=in`
static if (!is(typeof(mixin(q{(in ref int a) => a}))))
{
void onChange(WatcherID id, const scope ref FileChange change) nothrow {
this.onChangeImpl(id, change);
}
} else {
mixin(q{
void onChange(WatcherID id, in ref FileChange change) nothrow {
this.onChangeImpl(id, change);
}});
}

void onChangeImpl(WatcherID, const scope ref FileChange change)
void onChange(WatcherID id, scope ref const(FileChange) change)
nothrow {
DirectoryChangeType ct;
final switch (change.kind) {
Expand Down
6 changes: 4 additions & 2 deletions source/vibe/core/path.d
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,10 @@ struct GenericPath(F) {
@property GenericPath parentPath()
const @nogc {
auto b = Format.getBackNode(m_path);
static immutable Exception e = new Exception("Path has no parent path");
if (b.length >= m_path.length) throw e;
() @trusted {
static __gshared e = new Exception("Path has no parent path");
if (b.length >= m_path.length) throw e;
} ();
return GenericPath.fromTrustedString(m_path[0 .. $ - b.length]);
}

Expand Down
13 changes: 5 additions & 8 deletions source/vibe/core/task.d
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,13 @@ struct Task {
return app.data;
}

// Remove me when `-preview=in` becomes the default
static if (is(typeof(mixin(q{(in ref int a) => a}))))
mixin(q{
bool opEquals(in ref Task other) const @safe nothrow {
return m_fiber is other.m_fiber && m_taskCounter == other.m_taskCounter;
}});
bool opEquals(in Task other) const @safe nothrow {
bool opEquals(scope ref const(Task) other) const @safe nothrow {
return m_fiber is other.m_fiber && m_taskCounter == other.m_taskCounter;
}
bool opEquals(shared(Task) other) const shared @safe nothrow {
bool opEquals(scope const(Task) other) const @safe nothrow {
return m_fiber is other.m_fiber && m_taskCounter == other.m_taskCounter;
}
bool opEquals(scope shared(const(Task)) other) const shared @safe nothrow {
return m_fiber is other.m_fiber && m_taskCounter == other.m_taskCounter;
}
}
Expand Down
18 changes: 9 additions & 9 deletions source/vibe/internal/interfaceproxy.d
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ struct InterfaceProxy(I) if (is(I == interface)) {
{
}

~this() @safe
~this() @safe scope
{
clear();
}

this(this) @safe
this(this) @safe scope
{
if (m_intf) m_intf._postblit(m_value);
}

void clear() @safe nothrow
void clear() @safe nothrow scope
{
if (m_intf) {
m_intf._destroy(m_value);
Expand Down Expand Up @@ -200,9 +200,9 @@ struct InterfaceProxy(I) if (is(I == interface)) {
import std.meta : AliasSeq;
import std.traits : FunctionAttribute, MemberFunctionsTuple, ReturnType, ParameterTypeTuple, functionAttributes;

void _destroy(scope void[] stor) @safe nothrow;
void _postblit(scope void[] stor) @safe nothrow;
TypeInfo _typeInfo() @safe nothrow;
void _destroy(scope void[] stor) @safe nothrow scope;
void _postblit(scope void[] stor) @safe nothrow scope;
TypeInfo _typeInfo() @safe nothrow scope;

mixin methodDecls!0;

Expand Down Expand Up @@ -242,23 +242,23 @@ struct InterfaceProxy(I) if (is(I == interface)) {
}

override void _destroy(scope void[] stor)
@trusted nothrow {
@trusted nothrow scope {
static if (is(O == struct)) {
try destroy(*_extract(stor));
catch (Exception e) assert(false, "Destructor has thrown: "~e.msg);
}
}

override void _postblit(scope void[] stor)
@trusted nothrow {
@trusted nothrow scope {
static if (is(O == struct)) {
try typeid(O).postblit(stor.ptr);
catch (Exception e) assert(false, "Postblit contructor has thrown: "~e.msg);
}
}

override TypeInfo _typeInfo()
@safe nothrow {
@safe nothrow scope {
return typeid(O);
}

Expand Down

0 comments on commit a1258ab

Please sign in to comment.