From dbacb42e9bb89bedc30e52f0714d280a68a81f45 Mon Sep 17 00:00:00 2001 From: Harris Hancock Date: Wed, 22 Jan 2025 16:23:25 +0000 Subject: [PATCH] DeferredProxyCoroutine::await_transform() perfectly-forwards result Our current implementation of await_transform() requires that we return a result by value, by dint of returning `auto`. An upcoming capnproto patch will change await_transform()'s behavior to just be a pass-through, deferring the actual awaiter construction to a new `operator co_await` implementation. By returning `decltype(auto)`, we become compatible with capnproto both before and after that patch. --- src/workerd/api/deferred-proxy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workerd/api/deferred-proxy.h b/src/workerd/api/deferred-proxy.h index 086a8e711b6..9d4c4ee5c35 100644 --- a/src/workerd/api/deferred-proxy.h +++ b/src/workerd/api/deferred-proxy.h @@ -181,7 +181,7 @@ class DeferredProxyCoroutine: public kj::_::PromiseNode, } template - auto await_transform(U&& awaitable) { + decltype(auto) await_transform(U&& awaitable) { // Trivially forward everything, so we can await anything a kj::Promise can. return inner.await_transform(kj::fwd(awaitable)); }