From 83c921c8f6798dc897fb3c381853273ee9121fd4 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Sun, 23 Jul 2023 23:04:06 +0200 Subject: [PATCH] Fix compiling net::udp::UdpSocket doctest with Rust 1.71 --- ...t-udp-UdpSocket-doctest-with-Rust-1..patch | 31 +++++++++++++++++++ rust-mio0.7.spec | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 0001-Fix-compiling-net-udp-UdpSocket-doctest-with-Rust-1..patch diff --git a/0001-Fix-compiling-net-udp-UdpSocket-doctest-with-Rust-1..patch b/0001-Fix-compiling-net-udp-UdpSocket-doctest-with-Rust-1..patch new file mode 100644 index 0000000..f19e1e6 --- /dev/null +++ b/0001-Fix-compiling-net-udp-UdpSocket-doctest-with-Rust-1..patch @@ -0,0 +1,31 @@ +From a09c71a8c1a4fcf992606dedc65cd2a50e90fdee Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Sun, 23 Jul 2023 22:56:50 +0200 +Subject: [PATCH] Fix compiling net::udp::UdpSocket doctest with Rust 1.71 + +With Rust 1.71 this doctest fails to compile because of a new +`dropping_copy_types` warning, which is elevated to a hard +error because of "deny(warnings)". + +This PR changes the doctest from calling "drop(buffer)" +to using the "assign to underscore to drop" trick. +--- + src/net/udp.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/net/udp.rs b/src/net/udp.rs +index c5c3ba9..a750da1 100644 +--- a/src/net/udp.rs ++++ b/src/net/udp.rs +@@ -79,7 +79,7 @@ use std::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket} + /// let num_recv = echoer_socket.recv(&mut buffer)?; + /// println!("echo {:?} -> {:?}", buffer, num_recv); + /// buffer = [0; 9]; +-/// # drop(buffer); // Silence unused assignment warning. ++/// # let _ = buffer; // Silence unused assignment warning. + /// # return Ok(()); + /// } + /// _ => unreachable!() +-- +2.41.0 + diff --git a/rust-mio0.7.spec b/rust-mio0.7.spec index c3f3624..a75cce3 100644 --- a/rust-mio0.7.spec +++ b/rust-mio0.7.spec @@ -14,6 +14,8 @@ URL: https://crates.io/crates/mio Source: %{crates_source} # Automatically generated patch to strip foreign dependencies Patch: mio-fix-metadata-auto.diff +# https://github.com/tokio-rs/mio/pull/1693 +Patch: 0001-Fix-compiling-net-udp-UdpSocket-doctest-with-Rust-1..patch BuildRequires: rust-packaging >= 21