Skip to content

Document what happens when Receiver::recv() is called on a closed channel when there are queued messages #26497

@daboross

Description

@daboross

http://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html#method.recv states that if the sender has disconnected, an Err result is returned. This is only partially true - recv() will first run on every message that was queued before the Sender disconnected, then return err.

Example of this: https://play.rust-lang.org/?gist=f9d9741f1e5ae5dca3c1&version=stable

I think the documentation deserves at least a mention of this behavior - as it is kind of ambiguous whether the receiver will return Err even if there are messages queued or not just reading the current documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions