Commit 43b93a0a authored by Nick Sukhanov's avatar Nick Sukhanov Committed by Facebook Github Bot

Remove std::move after co_return for local variables

Summary:
Compiler passes rvalue reference for named local variable to return_value:
https://reviews.llvm.org/D51741

Reviewed By: lewissbaker

Differential Revision: D16963353

fbshipit-source-id: 98d846153adb2235b61bb8fb54d10f032d4c0055
parent 823a28c3
...@@ -170,7 +170,7 @@ auto collectAllRange(InputRange awaitables) ...@@ -170,7 +170,7 @@ auto collectAllRange(InputRange awaitables)
values.push_back(std::move(result).value()); values.push_back(std::move(result).value());
} }
co_return std::move(values); co_return values;
} }
template < template <
...@@ -294,7 +294,7 @@ auto collectAllTryRange(InputRange awaitables) ...@@ -294,7 +294,7 @@ auto collectAllTryRange(InputRange awaitables)
co_await detail::UnsafeResumeInlineSemiAwaitable{barrier.arriveAndWait()}; co_await detail::UnsafeResumeInlineSemiAwaitable{barrier.arriveAndWait()};
} }
co_return std::move(results); co_return results;
} }
template < template <
...@@ -413,7 +413,7 @@ auto collectAllWindowed(InputRange awaitables, std::size_t maxConcurrency) ...@@ -413,7 +413,7 @@ auto collectAllWindowed(InputRange awaitables, std::size_t maxConcurrency)
results.emplace_back(std::move(tryResult).value()); results.emplace_back(std::move(tryResult).value());
} }
co_return std::move(results); co_return results;
} }
template <typename InputRange> template <typename InputRange>
...@@ -548,7 +548,7 @@ auto collectAllTryWindowed(InputRange awaitables, std::size_t maxConcurrency) ...@@ -548,7 +548,7 @@ auto collectAllTryWindowed(InputRange awaitables, std::size_t maxConcurrency)
std::rethrow_exception(std::move(workerCreationException)); std::rethrow_exception(std::move(workerCreationException));
} }
co_return std::move(results); co_return results;
} }
} // namespace coro } // namespace coro
......
...@@ -183,10 +183,7 @@ TEST(InlineTask, TaskOfMoveOnlyType) { ...@@ -183,10 +183,7 @@ TEST(InlineTask, TaskOfMoveOnlyType) {
TEST(InlineTask, MoveOnlyTypeNRVO) { TEST(InlineTask, MoveOnlyTypeNRVO) {
auto f = []() -> InlineTask<MoveOnlyType> { auto f = []() -> InlineTask<MoveOnlyType> {
MoveOnlyType x{10}; MoveOnlyType x{10};
co_return x;
// Shouldn't need std::move(x) here, according to
// N4760 15.8.3(3) Copy/move elision
co_return std::move(x);
}; };
auto x = folly::coro::blockingWait(f()); auto x = folly::coro::blockingWait(f());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment