Skip to content

Commit

Permalink
start poc to rust version 1.81.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bircni committed Sep 22, 2024
1 parent 06f7094 commit 62a907b
Show file tree
Hide file tree
Showing 63 changed files with 142 additions and 133 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/deploy_web_demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
# release:
# types: ["published"]


permissions:
contents: write # for committing to gh-pages branch

Expand Down Expand Up @@ -39,7 +38,7 @@ jobs:
with:
profile: minimal
target: wasm32-unknown-unknown
toolchain: 1.76.0
toolchain: 1.81.0
override: true

- uses: Swatinem/rust-cache@v2
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.76.0
toolchain: 1.81.0

- name: Install packages (Linux)
if: runner.os == 'Linux'
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.76.0
toolchain: 1.81.0
targets: wasm32-unknown-unknown

- run: sudo apt-get update && sudo apt-get install libgtk-3-dev libatk1.0-dev
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.76.0"
rust-version: "1.81.0"
log-level: error
command: check
arguments: --target ${{ matrix.target }}
Expand All @@ -174,7 +174,7 @@ jobs:

- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.76.0
toolchain: 1.81.0
targets: aarch64-linux-android

- name: Set up cargo cache
Expand All @@ -193,7 +193,7 @@ jobs:

- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.76.0
toolchain: 1.81.0
targets: aarch64-apple-ios

- name: Set up cargo cache
Expand All @@ -212,7 +212,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.76.0
toolchain: 1.81.0

- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
Expand Down
16 changes: 12 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2571,6 +2571,12 @@ dependencies = [
"minimal-lexical",
]

[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"

[[package]]
name = "num-traits"
version = "0.2.16"
Expand Down Expand Up @@ -3894,12 +3900,13 @@ dependencies = [

[[package]]
name = "time"
version = "0.3.30"
version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5"
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [
"deranged",
"itoa",
"num-conv",
"powerfmt",
"serde",
"time-core",
Expand All @@ -3914,10 +3921,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"

[[package]]
name = "time-macros"
version = "0.2.15"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20"
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [
"num-conv",
"time-core",
]

Expand Down
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ members = [
[workspace.package]
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.76"
rust-version = "1.81"
version = "0.28.1"


Expand Down Expand Up @@ -100,12 +100,13 @@ winit = { version = "0.30.5", default-features = false }
unsafe_code = "deny"

elided_lifetimes_in_paths = "warn"
future_incompatible = "warn"
nonstandard_style = "warn"
rust_2018_idioms = "warn"
# future_incompatible = "warn"
# nonstandard_style = "warn"
# rust_2018_idioms = "warn"
rust_2021_prelude_collisions = "warn"
semicolon_in_expressions_from_macros = "warn"
trivial_numeric_casts = "warn"
unexpected_cfgs = "warn"
unsafe_op_in_unsafe_fn = "warn" # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668
unused_extern_crates = "warn"
unused_import_braces = "warn"
Expand Down Expand Up @@ -191,7 +192,7 @@ match_same_arms = "warn"
match_wild_err_arm = "warn"
match_wildcard_for_single_variants = "warn"
mem_forget = "warn"
mismatched_target_os = "warn"
# mismatched_target_os = "warn" # renamed
mismatching_type_param_order = "warn"
missing_enforced_import_renames = "warn"
missing_errors_doc = "warn"
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# -----------------------------------------------------------------------------
# Section identical to scripts/clippy_wasm/clippy.toml:

msrv = "1.76"
msrv = "1.81"

allow-unwrap-in-tests = true

Expand Down
2 changes: 1 addition & 1 deletion crates/ecolor/src/hex_color_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ macro_rules! hex_color {
if array.len() == 3 {
$crate::Color32::from_rgb(array[0], array[1], array[2])
} else {
#[allow(unconditional_panic)]
#[allow(unconditional_panic, clippy::out_of_bounds_indexing)]
$crate::Color32::from_rgba_unmultiplied(array[0], array[1], array[2], array[3])
}
}};
Expand Down
9 changes: 5 additions & 4 deletions crates/eframe/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ pub struct NativeOptions {
pub window_builder: Option<WindowBuilderHook>,

#[cfg(feature = "glow")]
/// Needed for cross compiling for VirtualBox VMSVGA driver with OpenGL ES 2.0 and OpenGL 2.1 which doesn't support SRGB texture.
/// Needed for cross compiling for `VirtualBox` VMSVGA driver with OpenGL ES 2.0 and OpenGL 2.1 which doesn't support SRGB texture.
/// See <https://github.com/emilk/egui/pull/1993>.
///
/// For OpenGL ES 2.0: set this to [`egui_glow::ShaderVersion::Es100`] to solve blank texture problem (by using the "fallback shader").
Expand Down Expand Up @@ -439,7 +439,7 @@ pub struct WebOptions {
/// Unused by webgl context as of writing.
pub depth_buffer: u8,

/// Which version of WebGl context to select
/// Which version of `WebGl` context to select
///
/// Default: [`WebGlContextOption::BestFirst`].
#[cfg(feature = "glow")]
Expand Down Expand Up @@ -492,7 +492,7 @@ impl Default for WebOptions {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum WebGlContextOption {
/// Force Use WebGL1.
/// Force Use `WebGL1`.
WebGl1,

/// Force use WebGL2.
Expand All @@ -501,7 +501,7 @@ pub enum WebGlContextOption {
/// Use WebGL2 first.
BestFirst,

/// Use WebGL1 first
/// Use `WebGL1` first
CompatibilityFirst,
}

Expand Down Expand Up @@ -799,6 +799,7 @@ pub trait Storage {
}

/// Stores nothing.
#[allow(dead_code)]
#[derive(Clone, Default)]
pub(crate) struct DummyStorage {}

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
2 changes: 1 addition & 1 deletion crates/eframe/src/native/wgpu_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ impl<'app> WgpuWinitRunning<'app> {
fn save_and_destroy(&mut self) {
crate::profile_function!();

let mut shared = self.shared.borrow_mut();
let shared = self.shared.borrow_mut();
if let Some(Viewport { window, .. }) = shared.viewports.get(&ViewportId::ROOT) {
self.integration.save(self.app.as_mut(), window.as_deref());
}
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/web/app_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl AppRunner {
self.frame.info.cpu_usage = Some(cpu_usage_seconds);
}

fn handle_platform_output(&mut self, platform_output: egui::PlatformOutput) {
fn handle_platform_output(&self, platform_output: egui::PlatformOutput) {
#[cfg(feature = "web_screen_reader")]
if self.egui_ctx.options(|o| o.screen_reader) {
super::screen_reader::speak(&platform_output.events_description());
Expand Down
1 change: 1 addition & 0 deletions crates/eframe/src/web/web_painter_wgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::WebOptions;

use super::web_painter::WebPainter;

#[allow(dead_code)] // is not used in wasm
struct EguiWebWindow(u32);

#[allow(unsafe_code)]
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/web/web_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct WebRunner {
/// Have we ever panicked?
panic_handler: PanicHandler,

/// If we ever panic during running, this RefCell is poisoned.
/// If we ever panic during running, this `RefCell` is poisoned.
/// So before we use it, we need to check [`Self::panic_handler`].
runner: Rc<RefCell<Option<AppRunner>>>,

Expand Down
2 changes: 1 addition & 1 deletion crates/egui-wgpu/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub struct ScreenDescriptor {
/// Size of the window in physical pixels.
pub size_in_pixels: [u32; 2],

/// HiDPI scale factor (pixels per point).
/// `HiDPI` scale factor (pixels per point).
pub pixels_per_point: f32,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/egui-wgpu/src/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ impl Painter {
}

#[allow(clippy::unused_self)]
pub fn destroy(&mut self) {
pub fn destroy(&self) {
// TODO(emilk): something here?
}
}
4 changes: 2 additions & 2 deletions crates/egui/src/containers/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ struct Prepared {
}

impl Resize {
fn begin(&mut self, ui: &mut Ui) -> Prepared {
fn begin(&self, ui: &mut Ui) -> Prepared {
let position = ui.available_rect_before_wrap().min;
let id = self.id.unwrap_or_else(|| {
let id_salt = self.id_salt.unwrap_or_else(|| Id::new("resize"));
Expand Down Expand Up @@ -295,7 +295,7 @@ impl Resize {
}
}

pub fn show<R>(mut self, ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> R {
pub fn show<R>(self, ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> R {
let mut prepared = self.begin(ui);
let ret = add_contents(&mut prepared.content_ui);
self.end(ui, prepared);
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/containers/scroll_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct State {
scroll_start_offset_from_top_left: [Option<f32>; 2],

/// Is the scroll sticky. This is true while scroll handle is in the end position
/// and remains that way until the user moves the scroll_handle. Once unstuck (false)
/// and remains that way until the user moves the `scroll_handle`. Once unstuck (false)
/// it remains false until the scroll touches the end position, which reenables stickiness.
scroll_stuck_to_end: Vec2b,

Expand Down
4 changes: 2 additions & 2 deletions crates/egui/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl GridLayout {
self.col += 1;
}

fn paint_row(&mut self, cursor: &Rect, painter: &Painter) {
fn paint_row(&self, cursor: &Rect, painter: &Painter) {
// handle row color painting based on color-picker function
let Some(color_picker) = self.color_picker.as_ref() else {
return;
Expand Down Expand Up @@ -450,7 +450,7 @@ impl Grid {
ui.allocate_new_ui(ui_builder, |ui| {
ui.horizontal(|ui| {
let is_color = color_picker.is_some();
let mut grid = GridLayout {
let grid = GridLayout {
num_columns,
color_picker,
min_cell_size: vec2(min_col_width, min_row_height),
Expand Down
6 changes: 3 additions & 3 deletions crates/egui/src/input_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,9 @@ impl Default for PointerState {
press_start_time: None,
has_moved_too_much_for_a_click: false,
started_decidedly_dragging: false,
last_click_time: std::f64::NEG_INFINITY,
last_last_click_time: std::f64::NEG_INFINITY,
last_move_time: std::f64::NEG_INFINITY,
last_click_time: f64::NEG_INFINITY,
last_last_click_time: f64::NEG_INFINITY,
last_move_time: f64::NEG_INFINITY,
pointer_events: vec![],
input_options: Default::default(),
}
Expand Down
Loading

0 comments on commit 62a907b

Please sign in to comment.