From 50a1ec4f7f5fc8be8c785768e0d93245d8b0a238 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 22 Jul 2023 22:17:51 +0200 Subject: [PATCH] Replace io-lifetimes with std::os::fd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since Rust 1.63, most of the features of io-lifetimes have been merged into std, including the only three we are using: OwnedFd, BorrowedFd and the AsFd trait. This bumps our MSRV, but this is the MSRV of the newest io-lifetimes anyway. I kept reexporting io_lifetimes as it was part of the public interface, but since it isn’t used any more it would be nice to remove it before the next minor version bump. I can prepare a commit for that. --- README.md | 2 +- wayland-backend/Cargo.toml | 2 +- wayland-backend/src/client_api.rs | 3 +- wayland-backend/src/rs/client_impl/mod.rs | 2 +- wayland-backend/src/rs/server_impl/client.rs | 2 +- .../src/rs/server_impl/common_poll.rs | 2 +- wayland-backend/src/rs/server_impl/handle.rs | 3 +- wayland-backend/src/rs/server_impl/mod.rs | 2 +- wayland-backend/src/rs/socket.rs | 2 +- wayland-backend/src/rs/wire.rs | 3 +- wayland-backend/src/server_api.rs | 3 +- wayland-backend/src/sys/client_impl/mod.rs | 2 +- wayland-backend/src/sys/server_impl/mod.rs | 2 +- wayland-backend/src/test/mod.rs | 3 +- wayland-client/src/conn.rs | 2 +- wayland-client/src/event_queue.rs | 2 +- wayland-client/src/globals.rs | 2 +- wayland-client/src/lib.rs | 2 +- wayland-cursor/src/lib.rs | 2 +- wayland-scanner/src/client_gen.rs | 5 ++-- wayland-scanner/src/common.rs | 2 +- wayland-scanner/src/server_gen.rs | 5 ++-- .../tests/scanner_assets/test-client-code.rs | 30 +++++++++---------- .../tests/scanner_assets/test-server-code.rs | 22 +++++++------- wayland-server/Cargo.toml | 2 +- wayland-server/src/dispatch.rs | 2 +- wayland-server/src/display.rs | 6 ++-- wayland-server/src/global.rs | 3 +- wayland-server/src/lib.rs | 2 +- wayland-server/src/socket.rs | 2 +- wayland-tests/tests/attach_to_surface.rs | 2 +- wayland-tests/tests/helpers/mod.rs | 2 +- 32 files changed, 64 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index d1197310031..f192c0e9c5d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The documentation for the releases can be found on [docs.rs](https://docs.rs/): ## Requirements -Requires at least rust 1.59.0 to be used, and version 1.15 of the wayland system libraries if using the +Requires at least rust 1.63.0 to be used, and version 1.15 of the wayland system libraries if using the system backend. ## Chat and support diff --git a/wayland-backend/Cargo.toml b/wayland-backend/Cargo.toml index 0d2bcbb3790..cd65c4cf3f4 100644 --- a/wayland-backend/Cargo.toml +++ b/wayland-backend/Cargo.toml @@ -18,7 +18,7 @@ wayland-sys = { version = "0.31.0", path = "../wayland-sys", features = [] } log = { version = "0.4", optional = true } scoped-tls = "1.0" downcast-rs = "1.2" -io-lifetimes = "1.0.0" +io-lifetimes = "2" raw-window-handle = { version = "0.5.0", optional = true } [dependencies.smallvec] diff --git a/wayland-backend/src/client_api.rs b/wayland-backend/src/client_api.rs index e48671a754a..8e944d88ed6 100644 --- a/wayland-backend/src/client_api.rs +++ b/wayland-backend/src/client_api.rs @@ -3,10 +3,9 @@ use std::{ fmt, os::unix::{io::RawFd, net::UnixStream}, sync::Arc, + os::fd::{OwnedFd, BorrowedFd}, }; -use io_lifetimes::{BorrowedFd, OwnedFd}; - use crate::protocol::{Interface, Message, ObjectInfo}; use super::client_impl; diff --git a/wayland-backend/src/rs/client_impl/mod.rs b/wayland-backend/src/rs/client_impl/mod.rs index fe3edddd7c9..32fac9fcaaf 100644 --- a/wayland-backend/src/rs/client_impl/mod.rs +++ b/wayland-backend/src/rs/client_impl/mod.rs @@ -7,6 +7,7 @@ use std::{ net::UnixStream, }, sync::{Arc, Condvar, Mutex, MutexGuard, Weak}, + os::fd::{OwnedFd, BorrowedFd}, }; use crate::{ @@ -17,7 +18,6 @@ use crate::{ INLINE_ARGS, }, }; -use io_lifetimes::{BorrowedFd, OwnedFd}; use smallvec::SmallVec; use super::{ diff --git a/wayland-backend/src/rs/server_impl/client.rs b/wayland-backend/src/rs/server_impl/client.rs index 1e97d514d17..f95460abe28 100644 --- a/wayland-backend/src/rs/server_impl/client.rs +++ b/wayland-backend/src/rs/server_impl/client.rs @@ -2,6 +2,7 @@ use std::{ ffi::CString, os::unix::{io::RawFd, net::UnixStream}, sync::Arc, + os::fd::OwnedFd, }; use crate::{ @@ -15,7 +16,6 @@ use crate::{ types::server::{DisconnectReason, InvalidId}, }; -use io_lifetimes::OwnedFd; use smallvec::SmallVec; use crate::rs::{ diff --git a/wayland-backend/src/rs/server_impl/common_poll.rs b/wayland-backend/src/rs/server_impl/common_poll.rs index 0b655921022..7e81dca02f8 100644 --- a/wayland-backend/src/rs/server_impl/common_poll.rs +++ b/wayland-backend/src/rs/server_impl/common_poll.rs @@ -1,6 +1,7 @@ use std::{ os::unix::io::{AsRawFd, FromRawFd}, sync::{Arc, Mutex}, + os::fd::{OwnedFd, BorrowedFd}, }; use super::{ @@ -14,7 +15,6 @@ use crate::{ types::server::InitError, }; -use io_lifetimes::{BorrowedFd, OwnedFd}; #[cfg(any(target_os = "linux", target_os = "android"))] use nix::sys::epoll::*; diff --git a/wayland-backend/src/rs/server_impl/handle.rs b/wayland-backend/src/rs/server_impl/handle.rs index 8fe8656b1ab..45853665465 100644 --- a/wayland-backend/src/rs/server_impl/handle.rs +++ b/wayland-backend/src/rs/server_impl/handle.rs @@ -5,10 +5,9 @@ use std::{ net::UnixStream, }, sync::{Arc, Mutex, Weak}, + os::fd::OwnedFd, }; -use io_lifetimes::OwnedFd; - use crate::{ protocol::{same_interface, Interface, Message, ObjectInfo, ANONYMOUS_INTERFACE}, types::server::{DisconnectReason, GlobalInfo, InvalidId}, diff --git a/wayland-backend/src/rs/server_impl/mod.rs b/wayland-backend/src/rs/server_impl/mod.rs index 8fdd6695436..e16a5ef7623 100644 --- a/wayland-backend/src/rs/server_impl/mod.rs +++ b/wayland-backend/src/rs/server_impl/mod.rs @@ -1,6 +1,7 @@ //! Server-side rust implementation of a Wayland protocol backend use std::{fmt, sync::Arc}; +use std::os::fd::OwnedFd; use crate::protocol::{same_interface, Interface, Message}; @@ -12,7 +13,6 @@ mod registry; pub use crate::types::server::{Credentials, DisconnectReason, GlobalInfo, InitError, InvalidId}; pub use common_poll::InnerBackend; pub use handle::{InnerHandle, WeakInnerHandle}; -use io_lifetimes::OwnedFd; use super::server::*; diff --git a/wayland-backend/src/rs/socket.rs b/wayland-backend/src/rs/socket.rs index a6204e21d35..293870ad587 100644 --- a/wayland-backend/src/rs/socket.rs +++ b/wayland-backend/src/rs/socket.rs @@ -3,8 +3,8 @@ use std::io::{ErrorKind, IoSlice, IoSliceMut, Result as IoResult}; use std::os::unix::io::{AsRawFd, RawFd}; use std::os::unix::net::UnixStream; +use std::os::fd::{OwnedFd, BorrowedFd, AsFd}; -use io_lifetimes::{AsFd, BorrowedFd, OwnedFd}; use nix::sys::socket; use crate::protocol::{ArgumentType, Message}; diff --git a/wayland-backend/src/rs/wire.rs b/wayland-backend/src/rs/wire.rs index bc232fd4be6..00a559792ed 100644 --- a/wayland-backend/src/rs/wire.rs +++ b/wayland-backend/src/rs/wire.rs @@ -3,8 +3,7 @@ use std::os::unix::io::{FromRawFd, RawFd}; use std::ptr; use std::{ffi::CStr, os::unix::prelude::AsRawFd}; - -use io_lifetimes::{BorrowedFd, OwnedFd}; +use std::os::fd::{OwnedFd, BorrowedFd}; use crate::protocol::{Argument, ArgumentType, Message}; diff --git a/wayland-backend/src/server_api.rs b/wayland-backend/src/server_api.rs index 9ad35a5783c..7b81bf8d5f1 100644 --- a/wayland-backend/src/server_api.rs +++ b/wayland-backend/src/server_api.rs @@ -3,10 +3,9 @@ use std::{ fmt, os::unix::{io::RawFd, net::UnixStream}, sync::Arc, + os::fd::{OwnedFd, BorrowedFd}, }; -use io_lifetimes::{BorrowedFd, OwnedFd}; - use crate::protocol::{Interface, Message, ObjectInfo}; pub use crate::types::server::{Credentials, DisconnectReason, GlobalInfo, InitError, InvalidId}; diff --git a/wayland-backend/src/sys/client_impl/mod.rs b/wayland-backend/src/sys/client_impl/mod.rs index 4a08de5dbff..7a8e5fe6eed 100644 --- a/wayland-backend/src/sys/client_impl/mod.rs +++ b/wayland-backend/src/sys/client_impl/mod.rs @@ -12,6 +12,7 @@ use std::{ atomic::{AtomicBool, Ordering}, Arc, Mutex, MutexGuard, Weak, }, + os::fd::{OwnedFd, BorrowedFd}, }; use crate::{ @@ -21,7 +22,6 @@ use crate::{ ObjectInfo, ProtocolError, ANONYMOUS_INTERFACE, }, }; -use io_lifetimes::{BorrowedFd, OwnedFd}; use scoped_tls::scoped_thread_local; use smallvec::SmallVec; diff --git a/wayland-backend/src/sys/server_impl/mod.rs b/wayland-backend/src/sys/server_impl/mod.rs index 1b37ae0f067..cc6c9ffe163 100644 --- a/wayland-backend/src/sys/server_impl/mod.rs +++ b/wayland-backend/src/sys/server_impl/mod.rs @@ -11,13 +11,13 @@ use std::{ atomic::{AtomicBool, Ordering}, Arc, Mutex, Weak, }, + os::fd::{OwnedFd, BorrowedFd}, }; use crate::protocol::{ check_for_signature, same_interface, AllowNull, Argument, ArgumentType, Interface, Message, ObjectInfo, ANONYMOUS_INTERFACE, }; -use io_lifetimes::{BorrowedFd, OwnedFd}; use scoped_tls::scoped_thread_local; use smallvec::SmallVec; diff --git a/wayland-backend/src/test/mod.rs b/wayland-backend/src/test/mod.rs index d3375915e8b..6a74de13fcf 100644 --- a/wayland-backend/src/test/mod.rs +++ b/wayland-backend/src/test/mod.rs @@ -1,8 +1,7 @@ #![allow(dead_code, non_snake_case)] use std::sync::Arc; - -use io_lifetimes::OwnedFd; +use std::os::fd::OwnedFd; use crate::protocol::{Argument, Message}; diff --git a/wayland-client/src/conn.rs b/wayland-client/src/conn.rs index d3ef75df585..55706941d3c 100644 --- a/wayland-client/src/conn.rs +++ b/wayland-client/src/conn.rs @@ -8,11 +8,11 @@ use std::{ atomic::{AtomicBool, Ordering}, Arc, }, + os::fd::OwnedFd, }; use wayland_backend::{ client::{Backend, InvalidId, ObjectData, ObjectId, ReadEventsGuard, WaylandError}, - io_lifetimes::OwnedFd, protocol::{ObjectInfo, ProtocolError}, }; diff --git a/wayland-client/src/event_queue.rs b/wayland-client/src/event_queue.rs index b27b8d888cc..fc48d9adf88 100644 --- a/wayland-client/src/event_queue.rs +++ b/wayland-client/src/event_queue.rs @@ -4,11 +4,11 @@ use std::convert::Infallible; use std::marker::PhantomData; use std::sync::{atomic::Ordering, Arc, Condvar, Mutex}; use std::task; +use std::os::fd::OwnedFd; use nix::Error; use wayland_backend::{ client::{Backend, ObjectData, ObjectId, ReadEventsGuard, WaylandError}, - io_lifetimes::OwnedFd, protocol::{Argument, Message}, }; diff --git a/wayland-client/src/globals.rs b/wayland-client/src/globals.rs index b06daeb8ae7..60fa3b88cc1 100644 --- a/wayland-client/src/globals.rs +++ b/wayland-client/src/globals.rs @@ -59,11 +59,11 @@ use std::{ atomic::{AtomicBool, Ordering}, Arc, Mutex, }, + os::fd::OwnedFd, }; use wayland_backend::{ client::{Backend, InvalidId, ObjectData, ObjectId, WaylandError}, - io_lifetimes::OwnedFd, protocol::Message, }; diff --git a/wayland-client/src/lib.rs b/wayland-client/src/lib.rs index 00320d2c0b6..6debba71695 100644 --- a/wayland-client/src/lib.rs +++ b/wayland-client/src/lib.rs @@ -170,11 +170,11 @@ use std::{ fmt, hash::{Hash, Hasher}, os::unix::io::RawFd, + os::fd::OwnedFd, sync::Arc, }; use wayland_backend::{ client::{InvalidId, ObjectData, ObjectId, WaylandError, WeakBackend}, - io_lifetimes::OwnedFd, protocol::{Interface, Message}, }; diff --git a/wayland-cursor/src/lib.rs b/wayland-cursor/src/lib.rs index c88eba7ac5b..9a04e6a91e9 100644 --- a/wayland-cursor/src/lib.rs +++ b/wayland-cursor/src/lib.rs @@ -52,6 +52,7 @@ use std::ops::{Deref, Index}; use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; use std::sync::Arc; use std::time::{SystemTime, UNIX_EPOCH}; +use std::os::fd::OwnedFd; use nix::errno::Errno; use nix::fcntl; @@ -60,7 +61,6 @@ use nix::unistd; #[cfg(any(target_os = "linux", target_os = "android"))] use {nix::sys::memfd, std::ffi::CStr}; -use wayland_client::backend::io_lifetimes::OwnedFd; use wayland_client::backend::{InvalidId, ObjectData, WeakBackend}; use wayland_client::protocol::wl_buffer::WlBuffer; use wayland_client::protocol::wl_shm::{self, Format, WlShm}; diff --git a/wayland-scanner/src/client_gen.rs b/wayland-scanner/src/client_gen.rs index f02518c3831..6c02830d146 100644 --- a/wayland-scanner/src/client_gen.rs +++ b/wayland-scanner/src/client_gen.rs @@ -53,10 +53,11 @@ fn generate_objects_for(interface: &Interface) -> TokenStream { #mod_doc pub mod #mod_name { use std::sync::Arc; + use std::os::fd::OwnedFd; use super::wayland_client::{ backend::{ - Backend, WeakBackend, smallvec, ObjectData, ObjectId, InvalidId, io_lifetimes, + Backend, WeakBackend, smallvec, ObjectData, ObjectId, InvalidId, protocol::{WEnum, Argument, Message, Interface, same_interface} }, QueueProxyData, Proxy, Connection, Dispatch, QueueHandle, DispatchError, Weak, @@ -163,7 +164,7 @@ fn generate_objects_for(interface: &Interface) -> TokenStream { #iface_name { id: ObjectId::null(), data: None, version: 0, backend } } - fn parse_event(conn: &Connection, msg: Message) -> Result<(Self, Self::Event), DispatchError> { + fn parse_event(conn: &Connection, msg: Message) -> Result<(Self, Self::Event), DispatchError> { #parse_body } diff --git a/wayland-scanner/src/common.rs b/wayland-scanner/src/common.rs index 3844f6dc85e..494e5713a8b 100644 --- a/wayland-scanner/src/common.rs +++ b/wayland-scanner/src/common.rs @@ -197,7 +197,7 @@ pub(crate) fn gen_message_enum( Type::Array => quote! { Vec }, Type::Fd => { if receiver { - quote! { io_lifetimes::OwnedFd } + quote! { OwnedFd } } else { quote! { std::os::unix::io::RawFd } } diff --git a/wayland-scanner/src/server_gen.rs b/wayland-scanner/src/server_gen.rs index cde8db6de83..eb475fe4709 100644 --- a/wayland-scanner/src/server_gen.rs +++ b/wayland-scanner/src/server_gen.rs @@ -58,10 +58,11 @@ fn generate_objects_for(interface: &Interface) -> TokenStream { #mod_doc pub mod #mod_name { use std::sync::Arc; + use std::os::fd::OwnedFd; use super::wayland_server::{ backend::{ - smallvec, ObjectData, ObjectId, InvalidId, io_lifetimes, WeakHandle, + smallvec, ObjectData, ObjectId, InvalidId, WeakHandle, protocol::{WEnum, Argument, Message, Interface, same_interface} }, Resource, Dispatch, DisplayHandle, DispatchError, ResourceData, New, Weak, @@ -155,7 +156,7 @@ fn generate_objects_for(interface: &Interface) -> TokenStream { handle.send_event(self, evt) } - fn parse_request(conn: &DisplayHandle, msg: Message) -> Result<(Self, Self::Request), DispatchError> { + fn parse_request(conn: &DisplayHandle, msg: Message) -> Result<(Self, Self::Request), DispatchError> { #parse_body } diff --git a/wayland-scanner/tests/scanner_assets/test-client-code.rs b/wayland-scanner/tests/scanner_assets/test-client-code.rs index 0bd739b4ae7..9fca84efbc8 100644 --- a/wayland-scanner/tests/scanner_assets/test-client-code.rs +++ b/wayland-scanner/tests/scanner_assets/test-client-code.rs @@ -2,13 +2,13 @@ pub mod wl_display { use super::wayland_client::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, Backend, InvalidId, ObjectData, ObjectId, WeakBackend, }, Connection, Dispatch, DispatchError, Proxy, QueueHandle, QueueProxyData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = "global error values\n\nThese errors are global and can be emitted in response to any\nserver request."] #[repr(u32)] #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -185,7 +185,7 @@ pub mod wl_display { } fn parse_event( conn: &Connection, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Event), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -309,13 +309,13 @@ pub mod wl_display { pub mod wl_registry { use super::wayland_client::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, Backend, InvalidId, ObjectData, ObjectId, WeakBackend, }, Connection, Dispatch, DispatchError, Proxy, QueueHandle, QueueProxyData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this request"] pub const REQ_BIND_SINCE: u32 = 1u32; #[doc = r" The wire opcode for this request"] @@ -459,7 +459,7 @@ pub mod wl_registry { } fn parse_event( conn: &Connection, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Event), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -556,13 +556,13 @@ pub mod wl_registry { pub mod wl_callback { use super::wayland_client::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, Backend, InvalidId, ObjectData, ObjectId, WeakBackend, }, Connection, Dispatch, DispatchError, Proxy, QueueHandle, QueueProxyData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this event"] pub const EVT_DONE_SINCE: u32 = 1u32; #[doc = r" The wire opcode for this event"] @@ -678,7 +678,7 @@ pub mod wl_callback { } fn parse_event( conn: &Connection, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Event), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -717,13 +717,13 @@ pub mod wl_callback { pub mod test_global { use super::wayland_client::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, Backend, InvalidId, ObjectData, ObjectId, WeakBackend, }, Connection, Dispatch, DispatchError, Proxy, QueueHandle, QueueProxyData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this request"] pub const REQ_MANY_ARGS_SINCE: u32 = 1u32; #[doc = r" The wire opcode for this request"] @@ -828,7 +828,7 @@ pub mod test_global { #[doc = "some text"] some_text: String, #[doc = "a file descriptor"] - file_descriptor: io_lifetimes::OwnedFd, + file_descriptor: OwnedFd, }, #[doc = "acking the creation of a secondary"] AckSecondary { sec: super::secondary::Secondary }, @@ -930,7 +930,7 @@ pub mod test_global { } fn parse_event( conn: &Connection, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Event), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -1293,13 +1293,13 @@ pub mod test_global { pub mod secondary { use super::wayland_client::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, Backend, InvalidId, ObjectData, ObjectId, WeakBackend, }, Connection, Dispatch, DispatchError, Proxy, QueueHandle, QueueProxyData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this request"] pub const REQ_DESTROY_SINCE: u32 = 2u32; #[doc = r" The wire opcode for this request"] @@ -1412,7 +1412,7 @@ pub mod secondary { } fn parse_event( conn: &Connection, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Event), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -1456,13 +1456,13 @@ pub mod secondary { pub mod tertiary { use super::wayland_client::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, Backend, InvalidId, ObjectData, ObjectId, WeakBackend, }, Connection, Dispatch, DispatchError, Proxy, QueueHandle, QueueProxyData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this request"] pub const REQ_DESTROY_SINCE: u32 = 3u32; #[doc = r" The wire opcode for this request"] @@ -1575,7 +1575,7 @@ pub mod tertiary { } fn parse_event( conn: &Connection, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Event), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -1619,13 +1619,13 @@ pub mod tertiary { pub mod quad { use super::wayland_client::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, Backend, InvalidId, ObjectData, ObjectId, WeakBackend, }, Connection, Dispatch, DispatchError, Proxy, QueueHandle, QueueProxyData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this request"] pub const REQ_DESTROY_SINCE: u32 = 3u32; #[doc = r" The wire opcode for this request"] @@ -1738,7 +1738,7 @@ pub mod quad { } fn parse_event( conn: &Connection, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Event), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); diff --git a/wayland-scanner/tests/scanner_assets/test-server-code.rs b/wayland-scanner/tests/scanner_assets/test-server-code.rs index 0ace6920c39..bc99f851bc8 100644 --- a/wayland-scanner/tests/scanner_assets/test-server-code.rs +++ b/wayland-scanner/tests/scanner_assets/test-server-code.rs @@ -2,13 +2,13 @@ pub mod wl_callback { use super::wayland_server::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, InvalidId, ObjectData, ObjectId, WeakHandle, }, Dispatch, DispatchError, DisplayHandle, New, Resource, ResourceData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this event"] pub const EVT_DONE_SINCE: u32 = 1u32; #[doc = r" The wire opcode for this event"] @@ -112,7 +112,7 @@ pub mod wl_callback { } fn parse_request( conn: &DisplayHandle, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Request), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -159,13 +159,13 @@ pub mod wl_callback { pub mod test_global { use super::wayland_server::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, InvalidId, ObjectData, ObjectId, WeakHandle, }, Dispatch, DispatchError, DisplayHandle, New, Resource, ResourceData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this request"] pub const REQ_MANY_ARGS_SINCE: u32 = 1u32; #[doc = r" The wire opcode for this request"] @@ -222,7 +222,7 @@ pub mod test_global { #[doc = "some text"] some_text: String, #[doc = "a file descriptor"] - file_descriptor: io_lifetimes::OwnedFd, + file_descriptor: OwnedFd, }, #[doc = "Only available since version 2 of the interface"] GetSecondary { @@ -367,7 +367,7 @@ pub mod test_global { } fn parse_request( conn: &DisplayHandle, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Request), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -757,13 +757,13 @@ pub mod test_global { pub mod secondary { use super::wayland_server::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, InvalidId, ObjectData, ObjectId, WeakHandle, }, Dispatch, DispatchError, DisplayHandle, New, Resource, ResourceData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this request"] pub const REQ_DESTROY_SINCE: u32 = 2u32; #[doc = r" The wire opcode for this request"] @@ -864,7 +864,7 @@ pub mod secondary { } fn parse_request( conn: &DisplayHandle, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Request), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -906,13 +906,13 @@ pub mod secondary { pub mod tertiary { use super::wayland_server::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, InvalidId, ObjectData, ObjectId, WeakHandle, }, Dispatch, DispatchError, DisplayHandle, New, Resource, ResourceData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this request"] pub const REQ_DESTROY_SINCE: u32 = 3u32; #[doc = r" The wire opcode for this request"] @@ -1013,7 +1013,7 @@ pub mod tertiary { } fn parse_request( conn: &DisplayHandle, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Request), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); @@ -1055,13 +1055,13 @@ pub mod tertiary { pub mod quad { use super::wayland_server::{ backend::{ - io_lifetimes, protocol::{same_interface, Argument, Interface, Message, WEnum}, smallvec, InvalidId, ObjectData, ObjectId, WeakHandle, }, Dispatch, DispatchError, DisplayHandle, New, Resource, ResourceData, Weak, }; use std::sync::Arc; + use std::os::fd::OwnedFd; #[doc = r" The minimal object version supporting this request"] pub const REQ_DESTROY_SINCE: u32 = 3u32; #[doc = r" The wire opcode for this request"] @@ -1162,7 +1162,7 @@ pub mod quad { } fn parse_request( conn: &DisplayHandle, - msg: Message, + msg: Message, ) -> Result<(Self, Self::Request), DispatchError> { let me = Self::from_id(conn, msg.sender_id.clone()).unwrap(); let mut arg_iter = msg.args.into_iter(); diff --git a/wayland-server/Cargo.toml b/wayland-server/Cargo.toml index 366ef765dce..336e78fdb31 100644 --- a/wayland-server/Cargo.toml +++ b/wayland-server/Cargo.toml @@ -19,7 +19,7 @@ bitflags = "2" log = { version = "0.4", optional = true } nix = { version = "0.26.0", default-features = false } downcast-rs = "1.2" -io-lifetimes = "1.0.0" +io-lifetimes = "2" [package.metadata.docs.rs] all-features = true diff --git a/wayland-server/src/dispatch.rs b/wayland-server/src/dispatch.rs index c3a0d2878b2..30e2e5acf51 100644 --- a/wayland-server/src/dispatch.rs +++ b/wayland-server/src/dispatch.rs @@ -1,7 +1,7 @@ use std::sync::Arc; +use std::os::fd::OwnedFd; use wayland_backend::{ - io_lifetimes::OwnedFd, protocol::ProtocolError, server::{ClientId, DisconnectReason, ObjectData, ObjectId}, }; diff --git a/wayland-server/src/display.rs b/wayland-server/src/display.rs index fb3e8def6f1..1a44788a7ee 100644 --- a/wayland-server/src/display.rs +++ b/wayland-server/src/display.rs @@ -1,7 +1,9 @@ -use std::{os::unix::net::UnixStream, sync::Arc}; +use std::{ + os::unix::net::UnixStream, sync::Arc, + os::fd::{BorrowedFd, AsFd}, +}; use wayland_backend::{ - io_lifetimes::{AsFd, BorrowedFd}, protocol::ObjectInfo, server::{Backend, ClientData, GlobalId, Handle, InitError, InvalidId, ObjectId}, }; diff --git a/wayland-server/src/global.rs b/wayland-server/src/global.rs index 6335bf769da..5f8c4eefee8 100644 --- a/wayland-server/src/global.rs +++ b/wayland-server/src/global.rs @@ -1,4 +1,5 @@ use std::sync::Arc; +use std::os::fd::OwnedFd; use wayland_backend::server::{ ClientData, ClientId, GlobalHandler, GlobalId, Handle, ObjectData, ObjectId, @@ -72,7 +73,7 @@ impl ObjectData for ProtocolErrorData { _handle: &Handle, _data: &mut D, _client_id: ClientId, - _msg: wayland_backend::protocol::Message, + _msg: wayland_backend::protocol::Message, ) -> Option>> { None } diff --git a/wayland-server/src/lib.rs b/wayland-server/src/lib.rs index 9be5f6e86fb..5442bcf6401 100644 --- a/wayland-server/src/lib.rs +++ b/wayland-server/src/lib.rs @@ -78,9 +78,9 @@ use std::{ fmt, hash::{Hash, Hasher}, + os::fd::OwnedFd, }; use wayland_backend::{ - io_lifetimes::OwnedFd, protocol::{Interface, Message}, server::{InvalidId, ObjectId, WeakHandle}, }; diff --git a/wayland-server/src/socket.rs b/wayland-server/src/socket.rs index d39681444ef..21e4b66ac65 100644 --- a/wayland-server/src/socket.rs +++ b/wayland-server/src/socket.rs @@ -8,10 +8,10 @@ use std::{ net::{UnixListener, UnixStream}, prelude::MetadataExt, }, + os::fd::{BorrowedFd, AsFd}, path::PathBuf, }; -use io_lifetimes::{AsFd, BorrowedFd}; use nix::{ fcntl::{flock, open, FlockArg, OFlag}, sys::stat::{lstat, Mode}, diff --git a/wayland-tests/tests/attach_to_surface.rs b/wayland-tests/tests/attach_to_surface.rs index 0ef6e13e203..aa167980b28 100644 --- a/wayland-tests/tests/attach_to_surface.rs +++ b/wayland-tests/tests/attach_to_surface.rs @@ -3,6 +3,7 @@ extern crate tempfile; use std::fs::File; use std::io::{Read, Seek, Write}; use std::os::unix::io::AsRawFd; +use std::os::fd::OwnedFd; #[macro_use] mod helpers; @@ -11,7 +12,6 @@ use helpers::{globals, roundtrip, wayc, ways, TestServer}; use wayc::protocol::wl_shm::Format; -use wayland_backend::io_lifetimes::OwnedFd; use ways::protocol::wl_buffer::WlBuffer as ServerBuffer; #[test] diff --git a/wayland-tests/tests/helpers/mod.rs b/wayland-tests/tests/helpers/mod.rs index f32947292ef..2cf204dacf6 100644 --- a/wayland-tests/tests/helpers/mod.rs +++ b/wayland-tests/tests/helpers/mod.rs @@ -9,9 +9,9 @@ pub extern crate wayland_server as ways; use std::os::unix::net::UnixStream; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use std::os::fd::OwnedFd; use wayland_backend::client::ObjectData; -use wayland_backend::io_lifetimes::OwnedFd; pub mod globals;