Commit ddea466e authored by Emy Sun's avatar Emy Sun Committed by Facebook Github Bot

Revert D7840699: [folly::futures] Future::get() - make postcond testable by callers

Summary:
This reverts commit 5102e9c3de026c021bf322b5109aafcc115207a2

bypass-lint

An infra SEV is better than not reverting this diff.
If you copy this password, see you in SEV Review!
cause_a_sev_many_files

Differential Revision:
D7840699

Original commit changeset: 5102e9c3de02

fbshipit-source-id: 13e97d5497ac383c0eff18a4b947d5b3d82a19b7
parent 2c2452d0
...@@ -1891,8 +1891,7 @@ Future<T>&& Future<T>::waitVia(TimedDrivableExecutor* e, Duration dur) && { ...@@ -1891,8 +1891,7 @@ Future<T>&& Future<T>::waitVia(TimedDrivableExecutor* e, Duration dur) && {
template <class T> template <class T>
T Future<T>::get() { T Future<T>::get() {
wait(); return std::move(wait().value());
return copy(std::move(*this)).value();
} }
template <class T> template <class T>
...@@ -1901,7 +1900,7 @@ T Future<T>::get(Duration dur) { ...@@ -1901,7 +1900,7 @@ T Future<T>::get(Duration dur) {
if (!this->isReady()) { if (!this->isReady()) {
throwTimedOut(); throwTimedOut();
} }
return copy(std::move(*this)).value(); return std::move(this->value());
} }
template <class T> template <class T>
......
...@@ -223,6 +223,7 @@ TEST(Future, hasPostconditionValid) { ...@@ -223,6 +223,7 @@ TEST(Future, hasPostconditionValid) {
DOIT(swallow(f.poll())); DOIT(swallow(f.poll()));
DOIT(f.raise(std::logic_error("foo"))); DOIT(f.raise(std::logic_error("foo")));
DOIT(f.cancel()); DOIT(f.cancel());
DOIT(swallow(f.get()));
DOIT(swallow(f.getTry())); DOIT(swallow(f.getTry()));
DOIT(f.wait()); DOIT(f.wait());
DOIT(std::move(f.wait())); DOIT(std::move(f.wait()));
...@@ -277,8 +278,6 @@ TEST(Future, hasPostconditionInvalid) { ...@@ -277,8 +278,6 @@ TEST(Future, hasPostconditionInvalid) {
DOIT(makeValid(), swallow(std::move(f).wait())); DOIT(makeValid(), swallow(std::move(f).wait()));
DOIT(makeValid(), swallow(std::move(f.wait()))); DOIT(makeValid(), swallow(std::move(f.wait())));
DOIT(makeValid(), swallow(f.semi())); DOIT(makeValid(), swallow(f.semi()));
DOIT(makeValid(), swallow(f.get()));
DOIT(makeValid(), std::move(f).get());
#undef DOIT #undef DOIT
} }
......
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