Skip to content

TcpListener docs example contains an explicit drop that can never be reached #35950

Closed
@sfackler

Description

@sfackler
Member

The incoming iterator never returns None, so the drop at the end will never be reached. The explicit matching against the socket result also seems potentially nonconventional docs-wise?

https://doc.rust-lang.org/std/net/struct.TcpListener.html#examples

Activity

abonander

abonander commented on Aug 23, 2016

@abonander
Contributor

Also, what are the semantics of this iterator when the listener is set to nonblocking mode? If it's equivalent to accept() it should run the loop with WouldBlock errors until a connection is made.

sfackler

sfackler commented on Aug 23, 2016

@sfackler
MemberAuthor

That's what it'd do, yeah. The next method is super simple: https://doc.rust-lang.org/src/std/up/src/libstd/sys/unix/ext/net.rs.html#532

added
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
on Mar 10, 2017
added a commit that references this issue on Apr 25, 2017
ca96892
added 2 commits that reference this issue on Apr 25, 2017

Rollup merge of rust-lang#41526 - steveklabnik:gh35950, r=GuillaumeGomez

a1a19e6

Rollup merge of rust-lang#41526 - steveklabnik:gh35950, r=GuillaumeGomez

f8b265e
added a commit that references this issue on Apr 26, 2017
7b7fe9b
added a commit that references this issue on Apr 27, 2017

Rollup merge of rust-lang#41526 - steveklabnik:gh35950, r=GuillaumeGomez

9ef22b8
added 2 commits that reference this issue on Apr 27, 2017

Rollup merge of rust-lang#41526 - steveklabnik:gh35950, r=GuillaumeGomez

cada869

Rollup merge of rust-lang#41526 - steveklabnik:gh35950, r=GuillaumeGomez

095936c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @steveklabnik@sfackler@abonander

        Issue actions

          TcpListener docs example contains an explicit drop that can never be reached · Issue #35950 · rust-lang/rust