• Marshall Cline's avatar
    remove lvalue-qual Future::get(...) · 0b1134d2
    Marshall Cline authored
    Summary:
    This is part of "the great r-valuification of folly::Future":
    
    * This is something we should do for safety in general.
    * Using lvalue-qualified `Future::get(...)` has caused some failures around D7840699 since lvalue-qualification hides that operation's move-out semantics - leads to some use of future operations that are really not correct, but are not obviously incorrect.
    * Problems with `Future::get(...) &`: it moves-out the result but doesn't invalidate the Future - the Future remains (technically) valid even though it actually is partially moved-out. Callers can subsequently access that moved-out result via things like `future.get()`, `future.result()`, `future.value()`, etc. - these access an already-moved-out result which is/can be surprising.
    * Reasons `Future::get(...) &&` is better: its semantics are more obvious and user-testable. It moves-out the Future, leaving it with `future.valid() == false`.
    * Note: `get(...)` refers to `get()` and `get(Duration)`.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D8710296
    
    fbshipit-source-id: ae201af1928eb2f6a2897c9b7db884393b36b910
    0b1134d2
FutureTest.cpp 41.4 KB