rust/src/libcore
Mark Rousskov 858adfe21d
Rollup merge of #52721 - cramertj:try-poll, r=aturon
std::ops::Try impl for std::task::Poll

I originally left out the `Try` impl for `Poll` because I was curious if we needed it, and @MajorBreakfast and I had discussed the potential for it to introduce confusion about exactly what control-flow was happening at different points. However, after porting a pretty significant chunk of Fuchsia over to futures 0.3, I discovered that I was *constantly* having to do repetitive matching on `Poll<Result<...>>` or `Poll<Option<Result<...>>>` in order to propagate errors correctly. `try_poll` (propagate `Poll::Ready(Err(..))`s) helped in some places, but it was far more common to need some form of conversion between `Result`, `Poll<Result<...>>`, and `Poll<Option<Result<...>>>`. The `Try` trait conveniently provides all of these conversions in addition to a more concise syntax (`?`), so I'd like to experiment with using these instead.

cc @seanmonstar

r? @aturon

Note: this change means that far more futures 0.1 code can work without significant changes since it papers over the fact that `Result` is no longer at the top-level when using `Stream` and `Future` (since it's now `Poll<Result<...>>` or `Poll<Option<Result<...>>>` instead of `Result<Poll<..>>` and `Result<Poll<Option<...>>>`).
2018-07-26 09:18:40 -06:00
..
benches Move deny(warnings) into rustbuild 2018-04-08 16:59:14 -06:00
char migrate codebase to ..= inclusive range patterns 2018-06-26 07:53:30 -07:00
fmt migrate codebase to ..= inclusive range patterns 2018-06-26 07:53:30 -07:00
future Implement UnsafeFutureObj for &mut Future 2018-07-02 19:07:59 +02:00
hash impl PartialEq+Eq for BuildHasherDefault 2018-07-15 17:37:46 +02:00
iter Clarify short-circuiting behvaior of Iterator::zip. 2018-07-17 23:39:37 -04:00
num use proper footnote syntax for references 2018-07-11 13:26:56 -04:00
ops Changed implementation of the third field to make LLVM optimize it better. 2018-07-13 13:26:07 +08:00
prelude Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
slice fix safety-related comment in slice::rotate 2018-07-19 09:11:56 +02:00
str libcore: Prefer Option::map over match where applicable 2018-07-23 22:04:33 -07:00
sync Add #[repr(transparent)] to Atomic* types 2018-07-07 20:09:34 -07:00
task Rollup merge of #52721 - cramertj:try-poll, r=aturon 2018-07-26 09:18:40 -06:00
tests Rollup merge of #52003 - Kerollmops:option-replace, r=Kimundi 2018-07-14 02:56:40 +08:00
unicode Handle array manually in string case conversion methods 2018-07-06 17:20:39 +02:00
alloc.rs Implement #[alloc_error_handler] 2018-07-09 23:13:24 +02:00
any.rs Any docs preposition change 2018-07-03 13:13:49 -07:00
array.rs Revert "Stabilize the TryFrom and TryInto traits" 2018-04-20 18:10:00 +02:00
ascii.rs migrate codebase to ..= inclusive range patterns 2018-06-26 07:53:30 -07:00
borrow.rs Fix formatting. 2018-03-18 13:05:00 +01:00
Cargo.toml Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
cell.rs use inherent method instead 2018-07-23 20:58:40 +08:00
clone.rs Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
cmp.rs Add message to rustc_on_unimplemented attributes in core 2018-06-19 15:19:13 -07:00
convert.rs AsRef doc wording tweaks 2018-07-15 10:16:36 +10:00
default.rs Fix "Quasi-quoting is inefficient" warning in incremental rustbuild. 2017-07-18 01:49:40 +08:00
hint.rs Stabilize core::hint::unreachable_unchecked. 2018-04-16 18:29:40 +08:00
internal_macros.rs Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
intrinsics.rs Add unaligned volatile intrinsics 2018-07-14 23:28:39 +01:00
iter_private.rs Various fixes to wording consistency in the docs 2017-03-22 17:19:52 +01:00
lib.rs Update stdsimd to undo an accidental stabilization 2018-07-20 22:34:09 -07:00
macros.rs Avoid using #[macro_export] for documenting builtin macros 2018-07-21 02:49:34 +03:00
marker.rs Fix doc link 2018-07-17 14:10:11 +02:00
mem.rs Don't use SIMD in mem::swap for types smaller than the block size 2018-07-21 21:43:37 -07:00
nonzero.rs Add #[repr(transparent)] to some libcore types 2018-06-16 18:25:15 +02:00
option.rs Rollup merge of #52218 - rivertam:patch-1, r=withoutboats 2018-07-18 22:34:56 +08:00
panic.rs Avoid unwrapping in PanicInfo doc example. 2018-07-10 22:25:38 -04:00
panicking.rs Bootstrap from 1.28.0-beta.3 2018-06-30 13:17:49 -07:00
ptr.rs clarify offset function safety concerns 2018-07-24 18:23:10 +02:00
raw.rs Fix up various links 2017-03-20 10:10:16 -04:00
result.rs Add explanation for #[must_use] on Result 2018-05-07 10:26:28 -07:00
time.rs Make rounding down clear in duration documentation 2018-07-14 15:48:52 +02:00
tuple.rs Update bootstrap compiler 2017-08-31 06:58:58 -07:00
unit.rs impl FromIterator<()> for () 2017-10-18 23:12:37 -07:00