]> git.lizzy.rs Git - rust.git/commitdiff
std: adjust the TCP io doc example to work reliably.
authorHuon Wilson <dbau.pp+github@gmail.com>
Mon, 9 Jun 2014 14:33:04 +0000 (00:33 +1000)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 10 Jun 2014 00:46:53 +0000 (17:46 -0700)
Fixes #11576 by making the code never run (and hence never
pass when the test was marked `should_fail`).

src/libstd/io/mod.rs

index 6f3eec01e8e34678b8ed133e57422e44021680ba..a1e0fa889789f39b3b59a1f3a50c6cdd781d1641 100644 (file)
 
 * Make a simple TCP client connection and request
 
-    ```rust,should_fail
+    ```rust
     # #![allow(unused_must_use)]
     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();
     socket.write(bytes!("GET / HTTP/1.0\n\n"));
     let response = socket.read_to_end();
+    # }
     ```
 
 * Make a simple TCP server