Skip to content

Conversation

@taiki-e
Copy link
Member

@taiki-e taiki-e commented Aug 30, 2019

No description provided.

@taiki-e taiki-e force-pushed the private-field branch 2 times, most recently from 9ee47f2 to 67eaf16 Compare August 30, 2019 12:26
@taiki-e taiki-e changed the title Add private fields for forward compatibility Add private fields to public types for forward compatibility Aug 30, 2019
@taiki-e taiki-e force-pushed the private-field branch 6 times, most recently from 36a4a16 to 7df2688 Compare August 30, 2019 14:48

/// Error returned from a [`Receiver`](Receiver) when the corresponding
/// [`Sender`](Sender) is dropped.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually like this one as-is because it allows you to easily write it as a pattern-- e.g.

match recv.await {
    Ok(x) => ...,
    Err(Canceled) => ...
}

I can't really imagine what else we'd want to add to it in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, these are in util/channel, so we can change them if we need them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I tend to write it like:

match rx.await {
    Err(_canceled) => (),
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanmonstar That doesn't actually assert that cancelled is what happened there, though-- you could be silencing a real error by accident.

}

/// Indicator that the `Abortable` future was aborted.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as with Canceled-- this is nice for matching on, and I can't forsee wanting to add anything here.

@taiki-e taiki-e closed this Aug 30, 2019
@taiki-e taiki-e reopened this Aug 30, 2019

drop(tx2);

assert_eq!(Poll::Ready(Some(Err(oneshot::Canceled))), queue.poll_next_unpin(cx));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the bad thing about this PR is that we cannot do this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, actually, this is not just a problem for this PR. I also encountered this in #1785.

@taiki-e taiki-e mentioned this pull request Aug 31, 2019
@taiki-e taiki-e closed this Sep 2, 2019
@taiki-e taiki-e deleted the private-field branch September 2, 2019 14:23
@taiki-e taiki-e restored the private-field branch September 2, 2019 14:28
@taiki-e taiki-e deleted the private-field branch September 8, 2019 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants