From ceaa97ee74f6727cae5f8f2a3bc2a555c17871bb Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Tue, 10 Dec 2024 19:30:21 +0100 Subject: [PATCH] msrv: Bump to 1.80.1 --- .github/workflows/ci.yml | 2 +- Cargo.toml | 2 +- anvil/src/udev.rs | 4 +--- clippy.toml | 2 +- examples/buffer_test.rs | 8 ++------ src/backend/renderer/gles/mod.rs | 14 +++++++------- src/backend/renderer/gles/shaders/mod.rs | 22 +++++++++++----------- src/backend/vulkan/mod.rs | 5 ++--- src/desktop/mod.rs | 2 +- src/input/keyboard/keymap_file.rs | 6 +++--- src/wayland/dmabuf/mod.rs | 3 +-- src/wayland/pointer_constraints.rs | 5 ++--- src/wayland/shm/pool.rs | 8 +++----- 13 files changed, 36 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d11a862d1e12..0c21b535ef7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - name: Rust toolchain - uses: dtolnay/rust-toolchain@1.72.0 + uses: dtolnay/rust-toolchain@1.80.1 - name: Get date for registry cache id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" diff --git a/Cargo.toml b/Cargo.toml index 4c6da0e4d75e..09842a62fee3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ readme = "README.md" homepage = "https://smithay.github.io/" keywords = ["wayland", "compositor", "graphics", "server"] categories = ["gui"] -rust-version = "1.72.0" +rust-version = "1.80.1" [package.metadata.docs.rs] features = ["test_all_features"] diff --git a/anvil/src/udev.rs b/anvil/src/udev.rs index cc74e09cbadb..509fae823b7b 100644 --- a/anvil/src/udev.rs +++ b/anvil/src/udev.rs @@ -771,10 +771,8 @@ impl AnvilState { render_node, surfaces: HashMap::new(), leasing_global: DrmLeaseState::new::>(&self.display_handle, &node) - .map_err(|err| { - // TODO replace with inspect_err, once stable + .inspect_err(|err| { warn!(?err, "Failed to initialize drm lease global for: {}", node); - err }) .ok(), active_leases: Vec::new(), diff --git a/clippy.toml b/clippy.toml index 7904b9c642d3..d5b3a37f2da2 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,4 +1,4 @@ -msrv = "1.72.0" +msrv = "1.80.1" type-complexity-threshold = 400 disallowed-macros = [ diff --git a/examples/buffer_test.rs b/examples/buffer_test.rs index 32f7896e186a..671d3f8d2c4e 100644 --- a/examples/buffer_test.rs +++ b/examples/buffer_test.rs @@ -1,4 +1,4 @@ -use std::{ffi::CStr, fmt, fs::File, os::unix::io::OwnedFd, path::PathBuf}; +use std::{fmt, fs::File, os::unix::io::OwnedFd, path::PathBuf}; use clap::{Args, Parser, Subcommand, ValueEnum}; use smithay::{ @@ -189,11 +189,7 @@ fn buffer_test(args: TestArgs) { Instance::new(Version::VERSION_1_2, None).expect("Unable to create vulkan instance"); let physical_device = PhysicalDevice::enumerate(&instance) .expect("Failed to enumerate physical devices") - .filter(|phd| { - phd.has_device_extension(unsafe { - CStr::from_bytes_with_nul_unchecked(b"VK_EXT_physical_device_drm\0") - }) - }) + .filter(|phd| phd.has_device_extension(c"VK_EXT_physical_device_drm")) .find(|phd| { phd.primary_node().unwrap() == Some(node) || phd.render_node().unwrap() == Some(node) }) diff --git a/src/backend/renderer/gles/mod.rs b/src/backend/renderer/gles/mod.rs index a59dd3cd1525..7e7cb38eefc5 100644 --- a/src/backend/renderer/gles/mod.rs +++ b/src/backend/renderer/gles/mod.rs @@ -1847,13 +1847,13 @@ impl GlesRenderer { let debug_shader = format!("#version 100\n#define {}\n{}", shaders::DEBUG_FLAGS, src.as_ref()); let debug_program = unsafe { link_program(&self.gl, shaders::VERTEX_SHADER, &debug_shader)? }; - let vert = CStr::from_bytes_with_nul(b"vert\0").expect("NULL terminated"); - let vert_position = CStr::from_bytes_with_nul(b"vert_position\0").expect("NULL terminated"); - let matrix = CStr::from_bytes_with_nul(b"matrix\0").expect("NULL terminated"); - let tex_matrix = CStr::from_bytes_with_nul(b"tex_matrix\0").expect("NULL terminated"); - let size = CStr::from_bytes_with_nul(b"size\0").expect("NULL terminated"); - let alpha = CStr::from_bytes_with_nul(b"alpha\0").expect("NULL terminated"); - let tint = CStr::from_bytes_with_nul(b"tint\0").expect("NULL terminated"); + let vert = c"vert"; + let vert_position = c"vert_position"; + let matrix = c"matrix"; + let tex_matrix = c"tex_matrix"; + let size = c"size"; + let alpha = c"alpha"; + let tint = c"tint"; unsafe { Ok(GlesPixelProgram(Rc::new(GlesPixelProgramInner { diff --git a/src/backend/renderer/gles/shaders/mod.rs b/src/backend/renderer/gles/shaders/mod.rs index 148b6e16eacb..6125f730dc23 100644 --- a/src/backend/renderer/gles/shaders/mod.rs +++ b/src/backend/renderer/gles/shaders/mod.rs @@ -142,13 +142,13 @@ pub(super) unsafe fn texture_program( let program = unsafe { link_program(gl, shaders::VERTEX_SHADER, &shader)? }; let debug_program = unsafe { link_program(gl, shaders::VERTEX_SHADER, debug_shader.as_ref())? }; - let vert = CStr::from_bytes_with_nul(b"vert\0").expect("NULL terminated"); - let vert_position = CStr::from_bytes_with_nul(b"vert_position\0").expect("NULL terminated"); - let tex = CStr::from_bytes_with_nul(b"tex\0").expect("NULL terminated"); - let matrix = CStr::from_bytes_with_nul(b"matrix\0").expect("NULL terminated"); - let tex_matrix = CStr::from_bytes_with_nul(b"tex_matrix\0").expect("NULL terminated"); - let alpha = CStr::from_bytes_with_nul(b"alpha\0").expect("NULL terminated"); - let tint = CStr::from_bytes_with_nul(b"tint\0").expect("NULL terminated"); + let vert = c"vert"; + let vert_position = c"vert_position"; + let tex = c"tex"; + let matrix = c"matrix"; + let tex_matrix = c"tex_matrix"; + let alpha = c"alpha"; + let tint = c"tint"; Ok(GlesTexProgramVariant { normal: GlesTexProgramInternal { @@ -223,10 +223,10 @@ pub(super) unsafe fn texture_program( pub(super) unsafe fn solid_program(gl: &ffi::Gles2) -> Result { let program = link_program(gl, shaders::VERTEX_SHADER_SOLID, shaders::FRAGMENT_SHADER_SOLID)?; - let matrix = CStr::from_bytes_with_nul(b"matrix\0").expect("NULL terminated"); - let color = CStr::from_bytes_with_nul(b"color\0").expect("NULL terminated"); - let vert = CStr::from_bytes_with_nul(b"vert\0").expect("NULL terminated"); - let position = CStr::from_bytes_with_nul(b"position\0").expect("NULL terminated"); + let matrix = c"matrix"; + let color = c"color"; + let vert = c"vert"; + let position = c"position"; Ok(GlesSolidProgram { program, diff --git a/src/backend/vulkan/mod.rs b/src/backend/vulkan/mod.rs index 889f4a5e6000..0298df62f6ca 100644 --- a/src/backend/vulkan/mod.rs +++ b/src/backend/vulkan/mod.rs @@ -219,8 +219,7 @@ impl Instance { // Enable debug layers if present and debug assertions are enabled. if cfg!(debug_assertions) { - const VALIDATION: &CStr = - unsafe { CStr::from_bytes_with_nul_unchecked(b"VK_LAYER_KHRONOS_validation\0") }; + const VALIDATION: &CStr = c"VK_LAYER_KHRONOS_validation"; if available_layers .iter() @@ -257,7 +256,7 @@ impl Instance { let mut app_info = vk::ApplicationInfo::default() .api_version(api_version.to_raw()) // SAFETY: null terminated with no interior null bytes. - .engine_name(unsafe { CStr::from_bytes_with_nul_unchecked(b"Smithay\0") }) + .engine_name(c"Smithay") .engine_version(Version::SMITHAY.to_raw()); if let Some(app_version) = app_version { diff --git a/src/desktop/mod.rs b/src/desktop/mod.rs index 3c66bbdcf62a..efd73c219539 100644 --- a/src/desktop/mod.rs +++ b/src/desktop/mod.rs @@ -14,7 +14,7 @@ //! //! A window represents what is typically understood by the end-user as a single application window. //! -//! Currently it abstracts over xdg-shell toplevels and Xwayland surfaces (TODO). +//! Currently it abstracts over xdg-shell toplevels and Xwayland surfaces. //! It provides a bunch of methods to calculate and retrieve its size, manage itself, attach additional user_data //! as well as a [drawing function](`crate::backend::renderer::element::AsRenderElements::render_elements`) to ease rendering it's related surfaces. //! diff --git a/src/input/keyboard/keymap_file.rs b/src/input/keyboard/keymap_file.rs index 596175149656..6568c7c47636 100644 --- a/src/input/keyboard/keymap_file.rs +++ b/src/input/keyboard/keymap_file.rs @@ -1,4 +1,4 @@ -use std::ffi::{CStr, CString}; +use std::ffi::CString; use std::os::unix::io::{AsFd, BorrowedFd}; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -21,7 +21,7 @@ pub struct KeymapFile { impl KeymapFile { /// Turn the keymap into a string using KEYMAP_FORMAT_TEXT_V1, create a sealed file for it, and store the string pub fn new(keymap: &Keymap) -> Self { - let name = CStr::from_bytes_with_nul(b"smithay-keymap\0").unwrap(); + let name = c"smithay-keymap"; let keymap = keymap.get_as_string(KEYMAP_FORMAT_TEXT_V1); let sealed = SealedFile::with_content(name, &CString::new(keymap.as_str()).unwrap()); @@ -42,7 +42,7 @@ impl KeymapFile { pub(crate) fn change_keymap(&mut self, keymap: &Keymap) { let keymap = keymap.get_as_string(xkb::KEYMAP_FORMAT_TEXT_V1); - let name = CStr::from_bytes_with_nul(b"smithay-keymap-file\0").unwrap(); + let name = c"smithay-keymap-file"; let sealed = SealedFile::with_content(name, &CString::new(keymap.clone()).unwrap()); if let Err(err) = sealed.as_ref() { diff --git a/src/wayland/dmabuf/mod.rs b/src/wayland/dmabuf/mod.rs index 9270c96e3299..2a159621e3b8 100644 --- a/src/wayland/dmabuf/mod.rs +++ b/src/wayland/dmabuf/mod.rs @@ -189,7 +189,6 @@ mod dispatch; use std::{ collections::HashMap, - ffi::CStr, ops::Sub, os::unix::io::AsFd, sync::{ @@ -397,7 +396,7 @@ impl DmabufFeedbackBuilder { .flat_map(DmabufFeedbackFormat::to_ne_bytes) .collect::>(); - let name = CStr::from_bytes_with_nul(b"smithay-dmabuffeedback-format-table\0").unwrap(); + let name = c"smithay-dmabuffeedback-format-table"; let format_table_file = SealedFile::with_data(name, &formats)?; // remove all formats from the main tranche that are already covered diff --git a/src/wayland/pointer_constraints.rs b/src/wayland/pointer_constraints.rs index 51c6b1176526..59c1bab4cf84 100644 --- a/src/wayland/pointer_constraints.rs +++ b/src/wayland/pointer_constraints.rs @@ -192,9 +192,8 @@ impl PointerConstraint { } Self::Locked(locked) => { locked.region.clone_from(&locked.pending_region); - locked.pending_cursor_position_hint.take().map(|hint| { - locked.cursor_position_hint = Some(hint); - hint + locked.pending_cursor_position_hint.take().inspect(|hint| { + locked.cursor_position_hint = Some(*hint); }) } } diff --git a/src/wayland/shm/pool.rs b/src/wayland/shm/pool.rs index eed8059d24e1..d3ca7524afe2 100644 --- a/src/wayland/shm/pool.rs +++ b/src/wayland/shm/pool.rs @@ -7,7 +7,7 @@ use std::{ os::unix::io::{AsFd, BorrowedFd, OwnedFd}, ptr, sync::{ - mpsc::{sync_channel, SyncSender}, + mpsc::{channel, Sender}, OnceLock, RwLock, }, thread, @@ -28,10 +28,8 @@ use tracing::{debug, instrument, trace}; // // To work around this problem, we spawn a separate thread whose sole purpose is dropping stuff we // send it through a channel. Conveniently, Pool is already Send, so there's no problem doing this. -// -// We use SyncSender because the regular Sender only got Sync in 1.72 which is above our MSRV. -static DROP_THIS: Lazy> = Lazy::new(|| { - let (tx, rx) = sync_channel(16); +static DROP_THIS: Lazy> = Lazy::new(|| { + let (tx, rx) = channel(); thread::Builder::new() .name("Shm dropping thread".to_owned()) .spawn(move || {