Skip to content

Commit 14668f2

Browse files
huonwalexcrichton
authored andcommitted
std: adjust the TCP io doc example to work reliably.
Fixes #11576 by making the code never run (and hence never pass when the test was marked `should_fail`).
1 parent 0581060 commit 14668f2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libstd/io/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,18 @@ Some examples of obvious things you might want to do
8181
8282
* Make a simple TCP client connection and request
8383
84-
```rust,should_fail
84+
```rust
8585
# #![allow(unused_must_use)]
8686
use std::io::net::tcp::TcpStream;
8787
88+
# // connection doesn't fail if a server is running on 8080
89+
# // locally, we still want to be type checking this code, so lets
90+
# // just stop it running (#11576)
91+
# if false {
8892
let mut socket = TcpStream::connect("127.0.0.1", 8080).unwrap();
8993
socket.write(bytes!("GET / HTTP/1.0\n\n"));
9094
let response = socket.read_to_end();
95+
# }
9196
```
9297
9398
* Make a simple TCP server

0 commit comments

Comments
 (0)