about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-03-21 21:57:38 +0000
committerbors <bors@rust-lang.org>2020-03-21 21:57:38 +0000
commitc6b172f7885cb83842fa15e4b0e2ff1647aebb40 (patch)
treec9c762cf63210999b8cdc8630b98efa02bc8a6ee /src/libstd
parent38114ff16e7856f98b2b4be7ab4cd29b38bed59a (diff)
parent17e6ed1fd97980146f63fb65e83da8702f294d31 (diff)
downloadrust-c6b172f7885cb83842fa15e4b0e2ff1647aebb40.tar.gz
rust-c6b172f7885cb83842fa15e4b0e2ff1647aebb40.zip
Auto merge of #70246 - Dylan-DPC:rollup-vt9wex2, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #70003 (symbol_names: treat ReifyShim like VtableShim.)
 - #70051 (Allow `hir().find` to return `None`)
 - #70126 (Fix ICE caused by truncating a negative ZST enum discriminant)
 - #70197 (For issue 53957: revise unit test to focus on underlying bug of 23076.)
 - #70215 (ast: Compress `AttrId` from `usize` to `u32`)
 - #70218 (Fix deprecated Error.description() usage in docs)
 - #70228 (Remove CARGO_BUILD_TARGET from bootstrap.py)
 - #70231 (Add explanation message for E0224)
 - #70232 (Tweak wording for std::io::Read::read function)
 - #70238 (Add a test for out-of-line module passed through a proc macro)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/error.rs2
-rw-r--r--src/libstd/io/mod.rs2
-rw-r--r--src/libstd/net/addr.rs23
3 files changed, 21 insertions, 6 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index 2a370f19296..b394f2efc2e 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -88,7 +88,7 @@ pub trait Error: Debug + Display {
     /// fn main() {
     ///     match get_super_error() {
     ///         Err(e) => {
-    ///             println!("Error: {}", e.description());
+    ///             println!("Error: {}", e);
     ///             println!("Caused by: {}", e.source().unwrap());
     ///         }
     ///         _ => println!("No error"),
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index dc831432c17..83c492fecf9 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -502,7 +502,7 @@ pub trait Read {
     /// how many bytes were read.
     ///
     /// This function does not provide any guarantees about whether it blocks
-    /// waiting for data, but if an object needs to block for a read but cannot
+    /// waiting for data, but if an object needs to block for a read and cannot,
     /// it will typically signal this via an [`Err`] return value.
     ///
     /// If the return value of this method is [`Ok(n)`], then it must be
diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs
index 57cba6b1f7a..de6360cf020 100644
--- a/src/libstd/net/addr.rs
+++ b/src/libstd/net/addr.rs
@@ -989,11 +989,26 @@ mod tests {
         // s has been moved into the tsa call
     }
 
-    // FIXME: figure out why this fails on openbsd and fix it
     #[test]
-    #[cfg(not(any(windows, target_os = "openbsd")))]
-    fn to_socket_addr_str_bad() {
-        assert!(tsa("1200::AB00:1234::2552:7777:1313:34300").is_err());
+    fn bind_udp_socket_bad() {
+        // rust-lang/rust#53957: This is a regression test for a parsing problem
+        // discovered as part of issue rust-lang/rust#23076, where we were
+        // incorrectly parsing invalid input and then that would result in a
+        // successful `UdpSocket` binding when we would expect failure.
+        //
+        // At one time, this test was written as a call to `tsa` with
+        // INPUT_23076. However, that structure yields an unreliable test,
+        // because it ends up passing junk input to the DNS server, and some DNS
+        // servers will respond with `Ok` to such input, with the ip address of
+        // the DNS server itself.
+        //
+        // This form of the test is more robust: even when the DNS server
+        // returns its own address, it is still an error to bind a UDP socket to
+        // a non-local address, and so we still get an error here in that case.
+
+        const INPUT_23076: &'static str = "1200::AB00:1234::2552:7777:1313:34300";
+
+        assert!(crate::net::UdpSocket::bind(INPUT_23076).is_err())
     }
 
     #[test]