Commit 268c812c authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Remove r-value qualification of folly::Try in makeSemiFuture and makeFuture.

Summary: The && overload here caused me to call the wrong function and delay an error as it changed the type of the Future completely. There seems to be little benefit to making this r-value qualified, and is likely a side effect of consistency with the forwarding reference in the non-Try overload.

Reviewed By: yfeldblum

Differential Revision: D9979805

fbshipit-source-id: e8121d5bc2e5fe02d38d6ea9cb83adbe98010df2
parent 7d64af65
...@@ -764,7 +764,7 @@ typename std:: ...@@ -764,7 +764,7 @@ typename std::
} }
template <class T> template <class T>
SemiFuture<T> makeSemiFuture(Try<T>&& t) { SemiFuture<T> makeSemiFuture(Try<T> t) {
return SemiFuture<T>(SemiFuture<T>::Core::make(std::move(t))); return SemiFuture<T>(SemiFuture<T>::Core::make(std::move(t)));
} }
...@@ -1372,7 +1372,7 @@ typename std::enable_if<std::is_base_of<std::exception, E>::value, Future<T>>:: ...@@ -1372,7 +1372,7 @@ typename std::enable_if<std::is_base_of<std::exception, E>::value, Future<T>>::
} }
template <class T> template <class T>
Future<T> makeFuture(Try<T>&& t) { Future<T> makeFuture(Try<T> t) {
return Future<T>(Future<T>::Core::make(std::move(t))); return Future<T>(Future<T>::Core::make(std::move(t)));
} }
......
...@@ -885,7 +885,7 @@ class SemiFuture : private futures::detail::FutureBase<T> { ...@@ -885,7 +885,7 @@ class SemiFuture : private futures::detail::FutureBase<T> {
using typename Base::Core; using typename Base::Core;
template <class T2> template <class T2>
friend SemiFuture<T2> makeSemiFuture(Try<T2>&&); friend SemiFuture<T2> makeSemiFuture(Try<T2>);
explicit SemiFuture(Core* obj) : Base(obj) {} explicit SemiFuture(Core* obj) : Base(obj) {}
...@@ -1901,7 +1901,7 @@ class Future : private futures::detail::FutureBase<T> { ...@@ -1901,7 +1901,7 @@ class Future : private futures::detail::FutureBase<T> {
: Base(futures::detail::EmptyConstruct{}) {} : Base(futures::detail::EmptyConstruct{}) {}
template <class T2> template <class T2>
friend Future<T2> makeFuture(Try<T2>&&); friend Future<T2> makeFuture(Try<T2>);
/// Repeat the given future (i.e., the computation it contains) n times. /// Repeat the given future (i.e., the computation it contains) n times.
/// ///
......
...@@ -154,7 +154,7 @@ typename std:: ...@@ -154,7 +154,7 @@ typename std::
/** Make a Future out of a Try */ /** Make a Future out of a Try */
template <class T> template <class T>
SemiFuture<T> makeSemiFuture(Try<T>&& t); SemiFuture<T> makeSemiFuture(Try<T> t);
/** /**
Make a completed Future by moving in a value. e.g. Make a completed Future by moving in a value. e.g.
...@@ -252,7 +252,7 @@ typename std::enable_if<std::is_base_of<std::exception, E>::value, Future<T>>:: ...@@ -252,7 +252,7 @@ typename std::enable_if<std::is_base_of<std::exception, E>::value, Future<T>>::
valid Future where necessary. valid Future where necessary.
*/ */
template <class T> template <class T>
Future<T> makeFuture(Try<T>&& t); Future<T> makeFuture(Try<T> t);
/* /*
* Return a new Future that will call back on the given Executor. * Return a new Future that will call back on the given Executor.
......
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