Skip to content

Commit 1e526bd

Browse files
committed
Auto merge of rust-lang#88165 - GuillaumeGomez:rollup-4o0v2ps, r=GuillaumeGomez
Rollup of 8 pull requests Successful merges: - rust-lang#86123 (Preserve more spans in internal `rustc_queries!` macro) - rust-lang#87874 (Add TcpStream type to TcpListener::incoming docs) - rust-lang#88034 (rustc_privacy: Replace `HirId`s and `DefId`s with `LocalDefId`s where possible) - rust-lang#88050 (Remove `HashStable` impls for `FileName` and `RealFileName`) - rust-lang#88093 ([rustdoc] Wrap code blocks in `<code>` tag) - rust-lang#88146 (Add tests for some `feature(const_evaluatable_checked)` incr comp issues) - rust-lang#88153 (Update .mailmap) - rust-lang#88159 (Use a trait instead of the now disallowed missing trait there) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 254a596 + 21e6aa6 commit 1e526bd

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

std/src/net/tcp.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -767,17 +767,24 @@ impl TcpListener {
767767
/// # Examples
768768
///
769769
/// ```no_run
770-
/// use std::net::TcpListener;
770+
/// use std::net::{TcpListener, TcpStream};
771771
///
772-
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
772+
/// fn handle_connection(stream: TcpStream) {
773+
/// //...
774+
/// }
773775
///
774-
/// for stream in listener.incoming() {
775-
/// match stream {
776-
/// Ok(stream) => {
777-
/// println!("new client!");
776+
/// fn main() -> std::io::Result<()> {
777+
/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
778+
///
779+
/// for stream in listener.incoming() {
780+
/// match stream {
781+
/// Ok(stream) => {
782+
/// handle_connection(stream);
783+
/// }
784+
/// Err(e) => { /* connection failed */ }
778785
/// }
779-
/// Err(e) => { /* connection failed */ }
780786
/// }
787+
/// Ok(())
781788
/// }
782789
/// ```
783790
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)