Skip to content

Commit

Permalink
Rust 1.77 changes & fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xangelix committed Oct 29, 2024
1 parent ce592b4 commit d80213f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions crates/ecolor/src/hex_color_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@
macro_rules! hex_color {
($s:literal) => {{
let array = $crate::color_hex::color_from_hex!($s);
if array.len() == 3 {
$crate::Color32::from_rgb(array[0], array[1], array[2])
} else {
#[allow(unconditional_panic)]
$crate::Color32::from_rgba_unmultiplied(array[0], array[1], array[2], array[3])
match array.as_slice() {
[r, g, b] => $crate::Color32::from_rgb(*r, *g, *b),
[r, g, b, a] => $crate::Color32::from_rgba_unmultiplied(*r, *g, *b, *a),
_ => panic!("Invalid hex color length: expected 3 (RGB) or 4 (RGBA) bytes"),
}
}};
}
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/native/event_loop_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::cell::Cell;
use winit::event_loop::ActiveEventLoop;

thread_local! {
static CURRENT_EVENT_LOOP: Cell<Option<*const ActiveEventLoop>> = Cell::new(None);
static CURRENT_EVENT_LOOP: Cell<Option<*const ActiveEventLoop>> = const { Cell::new(None) };
}

struct EventLoopGuard;
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/native/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn with_event_loop<R>(
mut native_options: epi::NativeOptions,
f: impl FnOnce(&mut EventLoop<UserEvent>, epi::NativeOptions) -> R,
) -> Result<R> {
thread_local!(static EVENT_LOOP: std::cell::RefCell<Option<EventLoop<UserEvent>>> = std::cell::RefCell::new(None));
thread_local!(static EVENT_LOOP: std::cell::RefCell<Option<EventLoop<UserEvent>>> = const { std::cell::RefCell::new(None) });

EVENT_LOOP.with(|event_loop| {
// Since we want to reference NativeOptions when creating the EventLoop we can't
Expand Down

0 comments on commit d80213f

Please sign in to comment.