chore: Bump Rust version to 1.88 (#33439)

Goodies in this version:
- if-let chains 🎉
- Better compiler perf for Zed
(https://github.com/rust-lang/rust/pull/138522)

For more, see: https://releases.rs/docs/1.88.0/

Release Notes:

- N/A

---------

Co-authored-by: Junkui Zhang <364772080@qq.com>
This commit is contained in:
Piotr Osiewicz
2025-06-26 20:54:19 +02:00
committed by GitHub
co-authored by Junkui Zhang
parent b079871428
commit 985dcf7523
31 changed files with 112 additions and 303 deletions
-26
View File
@@ -214,32 +214,6 @@ impl<T: ?Sized> DerefMut for ArenaBox<T> {
}
}
pub struct ArenaRef<T: ?Sized>(ArenaBox<T>);
impl<T: ?Sized> From<ArenaBox<T>> for ArenaRef<T> {
fn from(value: ArenaBox<T>) -> Self {
ArenaRef(value)
}
}
impl<T: ?Sized> Clone for ArenaRef<T> {
fn clone(&self) -> Self {
Self(ArenaBox {
ptr: self.0.ptr,
valid: self.0.valid.clone(),
})
}
}
impl<T: ?Sized> Deref for ArenaRef<T> {
type Target = T;
#[inline(always)]
fn deref(&self) -> &Self::Target {
self.0.deref()
}
}
#[cfg(test)]
mod tests {
use std::{cell::Cell, rc::Rc};
@@ -29,14 +29,14 @@ pub unsafe fn new_renderer(
}
impl rwh::HasWindowHandle for RawWindow {
fn window_handle(&self) -> Result<rwh::WindowHandle, rwh::HandleError> {
fn window_handle(&self) -> Result<rwh::WindowHandle<'_>, rwh::HandleError> {
let view = NonNull::new(self.view).unwrap();
let handle = rwh::AppKitWindowHandle::new(view);
Ok(unsafe { rwh::WindowHandle::borrow_raw(handle.into()) })
}
}
impl rwh::HasDisplayHandle for RawWindow {
fn display_handle(&self) -> Result<rwh::DisplayHandle, rwh::HandleError> {
fn display_handle(&self) -> Result<rwh::DisplayHandle<'_>, rwh::HandleError> {
let handle = rwh::AppKitDisplayHandle::new();
Ok(unsafe { rwh::DisplayHandle::borrow_raw(handle.into()) })
}
@@ -252,11 +252,11 @@ impl Drop for WaylandWindow {
}
impl WaylandWindow {
fn borrow(&self) -> Ref<WaylandWindowState> {
fn borrow(&self) -> Ref<'_, WaylandWindowState> {
self.0.state.borrow()
}
fn borrow_mut(&self) -> RefMut<WaylandWindowState> {
fn borrow_mut(&self) -> RefMut<'_, WaylandWindowState> {
self.0.state.borrow_mut()
}
+4 -24
View File
@@ -288,7 +288,7 @@ pub(crate) struct X11WindowStatePtr {
}
impl rwh::HasWindowHandle for RawWindow {
fn window_handle(&self) -> Result<rwh::WindowHandle, rwh::HandleError> {
fn window_handle(&self) -> Result<rwh::WindowHandle<'_>, rwh::HandleError> {
let Some(non_zero) = NonZeroU32::new(self.window_id) else {
log::error!("RawWindow.window_id zero when getting window handle.");
return Err(rwh::HandleError::Unavailable);
@@ -299,7 +299,7 @@ impl rwh::HasWindowHandle for RawWindow {
}
}
impl rwh::HasDisplayHandle for RawWindow {
fn display_handle(&self) -> Result<rwh::DisplayHandle, rwh::HandleError> {
fn display_handle(&self) -> Result<rwh::DisplayHandle<'_>, rwh::HandleError> {
let Some(non_zero) = NonNull::new(self.connection) else {
log::error!("Null RawWindow.connection when getting display handle.");
return Err(rwh::HandleError::Unavailable);
@@ -310,12 +310,12 @@ impl rwh::HasDisplayHandle for RawWindow {
}
impl rwh::HasWindowHandle for X11Window {
fn window_handle(&self) -> Result<rwh::WindowHandle, rwh::HandleError> {
fn window_handle(&self) -> Result<rwh::WindowHandle<'_>, rwh::HandleError> {
unimplemented!()
}
}
impl rwh::HasDisplayHandle for X11Window {
fn display_handle(&self) -> Result<rwh::DisplayHandle, rwh::HandleError> {
fn display_handle(&self) -> Result<rwh::DisplayHandle<'_>, rwh::HandleError> {
unimplemented!()
}
}
@@ -679,26 +679,6 @@ impl X11WindowState {
}
}
/// A handle to an X11 window which destroys it on Drop.
pub struct X11WindowHandle {
id: xproto::Window,
xcb: Rc<XCBConnection>,
}
impl Drop for X11WindowHandle {
fn drop(&mut self) {
maybe!({
check_reply(
|| "X11 DestroyWindow failed while dropping X11WindowHandle.",
self.xcb.destroy_window(self.id),
)?;
xcb_flush(&self.xcb);
anyhow::Ok(())
})
.log_err();
}
}
pub(crate) struct X11Window(pub X11WindowStatePtr);
impl Drop for X11Window {
+4 -2
View File
@@ -1074,8 +1074,10 @@ fn handle_nc_mouse_up_msg(
}
let last_pressed = state_ptr.state.borrow_mut().nc_button_pressed.take();
if button == MouseButton::Left && last_pressed.is_some() {
let handled = match (wparam.0 as u32, last_pressed.unwrap()) {
if button == MouseButton::Left
&& let Some(last_pressed) = last_pressed
{
let handled = match (wparam.0 as u32, last_pressed) {
(HTMINBUTTON, HTMINBUTTON) => {
unsafe { ShowWindowAsync(handle, SW_MINIMIZE).ok().log_err() };
true
+5 -7
View File
@@ -1250,11 +1250,13 @@ fn set_window_composition_attribute(hwnd: HWND, color: Option<Color>, state: u32
type SetWindowCompositionAttributeType =
unsafe extern "system" fn(HWND, *mut WINDOWCOMPOSITIONATTRIBDATA) -> BOOL;
let module_name = PCSTR::from_raw(c"user32.dll".as_ptr() as *const u8);
let user32 = GetModuleHandleA(module_name);
if user32.is_ok() {
if let Some(user32) = GetModuleHandleA(module_name)
.context("Unable to get user32.dll handle")
.log_err()
{
let func_name = PCSTR::from_raw(c"SetWindowCompositionAttribute".as_ptr() as *const u8);
let set_window_composition_attribute: SetWindowCompositionAttributeType =
std::mem::transmute(GetProcAddress(user32.unwrap(), func_name));
std::mem::transmute(GetProcAddress(user32, func_name));
let mut color = color.unwrap_or_default();
let is_acrylic = state == 4;
if is_acrylic && color.3 == 0 {
@@ -1275,10 +1277,6 @@ fn set_window_composition_attribute(hwnd: HWND, color: Option<Color>, state: u32
cb_data: std::mem::size_of::<AccentPolicy>(),
};
let _ = set_window_composition_attribute(hwnd, &mut data as *mut _ as _);
} else {
let _ = user32
.inspect_err(|e| log::error!("Error getting module: {e}"))
.ok();
}
}
}
+1 -1
View File
@@ -582,7 +582,7 @@ pub struct FontRun {
}
trait AsCacheKeyRef {
fn as_cache_key_ref(&self) -> CacheKeyRef;
fn as_cache_key_ref(&self) -> CacheKeyRef<'_>;
}
#[derive(Clone, Debug, Eq)]
-28
View File
@@ -83,34 +83,6 @@ where
timer.race(future).await
}
#[cfg(any(test, feature = "test-support"))]
pub struct CwdBacktrace<'a>(pub &'a backtrace::Backtrace);
#[cfg(any(test, feature = "test-support"))]
impl std::fmt::Debug for CwdBacktrace<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use backtrace::{BacktraceFmt, BytesOrWideString};
let cwd = std::env::current_dir().unwrap();
let cwd = cwd.parent().unwrap();
let mut print_path = |fmt: &mut std::fmt::Formatter<'_>, path: BytesOrWideString<'_>| {
std::fmt::Display::fmt(&path, fmt)
};
let mut fmt = BacktraceFmt::new(f, backtrace::PrintFmt::Full, &mut print_path);
for frame in self.0.frames() {
let mut formatted_frame = fmt.frame();
if frame
.symbols()
.iter()
.any(|s| s.filename().map_or(false, |f| f.starts_with(cwd)))
{
formatted_frame.backtrace_frame(frame)?;
}
}
fmt.finish()
}
}
/// Increment the given atomic counter if it is not zero.
/// Return the new value of the counter.
pub(crate) fn atomic_incr_if_not_zero(counter: &AtomicUsize) -> usize {