Skip to content

Commit

Permalink
msrv: Bump to 1.80.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Dec 12, 2024
1 parent 9be0da4 commit ceaa97e
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
4 changes: 1 addition & 3 deletions anvil/src/udev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,8 @@ impl AnvilState<UdevData> {
render_node,
surfaces: HashMap::new(),
leasing_global: DrmLeaseState::new::<AnvilState<UdevData>>(&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(),
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
msrv = "1.72.0"
msrv = "1.80.1"
type-complexity-threshold = 400

disallowed-macros = [
Expand Down
8 changes: 2 additions & 6 deletions examples/buffer_test.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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)
})
Expand Down
14 changes: 7 additions & 7 deletions src/backend/renderer/gles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 11 additions & 11 deletions src/backend/renderer/gles/shaders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -223,10 +223,10 @@ pub(super) unsafe fn texture_program(
pub(super) unsafe fn solid_program(gl: &ffi::Gles2) -> Result<GlesSolidProgram, GlesError> {
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,
Expand Down
5 changes: 2 additions & 3 deletions src/backend/vulkan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//!
Expand Down
6 changes: 3 additions & 3 deletions src/input/keyboard/keymap_file.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand All @@ -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());

Expand All @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions src/wayland/dmabuf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ mod dispatch;

use std::{
collections::HashMap,
ffi::CStr,
ops::Sub,
os::unix::io::AsFd,
sync::{
Expand Down Expand Up @@ -397,7 +396,7 @@ impl DmabufFeedbackBuilder {
.flat_map(DmabufFeedbackFormat::to_ne_bytes)
.collect::<Vec<_>>();

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
Expand Down
5 changes: 2 additions & 3 deletions src/wayland/pointer_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/wayland/shm/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
os::unix::io::{AsFd, BorrowedFd, OwnedFd},
ptr,
sync::{
mpsc::{sync_channel, SyncSender},
mpsc::{channel, Sender},
OnceLock, RwLock,
},
thread,
Expand All @@ -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<SyncSender<InnerPool>> = Lazy::new(|| {
let (tx, rx) = sync_channel(16);
static DROP_THIS: Lazy<Sender<InnerPool>> = Lazy::new(|| {
let (tx, rx) = channel();
thread::Builder::new()
.name("Shm dropping thread".to_owned())
.spawn(move || {
Expand Down

0 comments on commit ceaa97e

Please sign in to comment.