提交 14668f27 编写于 作者: H Huon Wilson 提交者: Alex Crichton

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`).
上级 05810604
...@@ -81,13 +81,18 @@ ...@@ -81,13 +81,18 @@
* Make a simple TCP client connection and request * Make a simple TCP client connection and request
```rust,should_fail ```rust
# #![allow(unused_must_use)] # #![allow(unused_must_use)]
use std::io::net::tcp::TcpStream; use std::io::net::tcp::TcpStream;
# // connection doesn't fail if a server is running on 8080
# // locally, we still want to be type checking this code, so lets
# // just stop it running (#11576)
# if false {
let mut socket = TcpStream::connect("127.0.0.1", 8080).unwrap(); let mut socket = TcpStream::connect("127.0.0.1", 8080).unwrap();
socket.write(bytes!("GET / HTTP/1.0\n\n")); socket.write(bytes!("GET / HTTP/1.0\n\n"));
let response = socket.read_to_end(); let response = socket.read_to_end();
# }
``` ```
* Make a simple TCP server * Make a simple TCP server
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册