Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: Bump rust-version to 1.78 #4954

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -43,7 +42,7 @@ jobs:
with:
profile: minimal
target: wasm32-unknown-unknown
toolchain: 1.76.0
toolchain: 1.78.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 @@ -19,7 +19,7 @@ jobs:

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

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

- run: sudo apt-get update && sudo apt-get install libgtk-3-dev libatk1.0-dev
Expand All @@ -108,7 +108,7 @@ jobs:
- name: wasm-bindgen
uses: jetli/wasm-bindgen-action@v0.1.0
with:
version: "0.2.92"
version: "0.2.93"

- run: ./scripts/wasm_bindgen_check.sh --skip-setup

Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.76.0"
rust-version: "1.78.0"
log-level: error
command: check
arguments: --target ${{ matrix.target }}
Expand All @@ -156,7 +156,7 @@ jobs:

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

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

- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
Expand Down
29 changes: 15 additions & 14 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2235,9 +2235,9 @@ dependencies = [

[[package]]
name = "js-sys"
version = "0.3.69"
version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
dependencies = [
"wasm-bindgen",
]
Expand Down Expand Up @@ -4208,19 +4208,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"

[[package]]
name = "wasm-bindgen"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
dependencies = [
"cfg-if",
"once_cell",
"wasm-bindgen-macro",
]

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
dependencies = [
"bumpalo",
"log",
Expand All @@ -4245,19 +4246,19 @@ dependencies = [

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -4268,9 +4269,9 @@ dependencies = [

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.92"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"

[[package]]
name = "wayland-backend"
Expand Down Expand Up @@ -4383,9 +4384,9 @@ dependencies = [

[[package]]
name = "web-sys"
version = "0.3.69"
version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"
dependencies = [
"js-sys",
"wasm-bindgen",
Expand Down
4 changes: 2 additions & 2 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.78"
version = "0.28.1"


Expand Down Expand Up @@ -90,7 +90,7 @@ thiserror = "1.0.37"
web-time = "1.1.0" # Timekeeping for native and web
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
web-sys = "0.3.58"
web-sys = "0.3.70"
wgpu = { version = "22.0.0", default-features = false, features = [
# Make the renderer `Sync` even on wasm32, because it makes the code simpler:
"fragile-send-sync-non-atomic-wasm",
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.78"

allow-unwrap-in-tests = true

Expand Down
2 changes: 2 additions & 0 deletions crates/ecolor/src/hex_color_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ macro_rules! hex_color {
$crate::Color32::from_rgb(array[0], array[1], array[2])
} else {
#[allow(unconditional_panic)]
// We need to allow the out_of_bounds_indexing lint because the array length is checked above
#[allow(clippy::out_of_bounds_indexing)]
$crate::Color32::from_rgba_unmultiplied(array[0], array[1], array[2], array[3])
}
}};
Expand Down
10 changes: 5 additions & 5 deletions crates/eframe/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,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 @@ -438,7 +438,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 @@ -481,16 +481,16 @@ 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.
WebGl2,

/// Use WebGL2 first.
/// Use `WebGL2` first.
BestFirst,

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

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 @@ -36,7 +36,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: RefCell<Option<EventLoop<UserEvent>>> = RefCell::new(None));
thread_local!(static EVENT_LOOP: RefCell<Option<EventLoop<UserEvent>>> = const { RefCell::new(None) });

EVENT_LOOP.with(|event_loop| {
// Since we want to reference NativeOptions when creating the EventLoop we can't
Expand Down
4 changes: 2 additions & 2 deletions crates/eframe/src/web/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ pub(crate) fn install_resize_observer(runner_ref: &WebRunner) -> Result<(), JsVa
}) as Box<dyn FnMut(js_sys::Array)>);

let observer = web_sys::ResizeObserver::new(closure.as_ref().unchecked_ref())?;
let mut options = web_sys::ResizeObserverOptions::new();
options.box_(web_sys::ResizeObserverBoxOptions::ContentBox);
let options = web_sys::ResizeObserverOptions::new();
options.set_box(web_sys::ResizeObserverBoxOptions::ContentBox);
if let Some(runner_lock) = runner_ref.try_lock() {
observer.observe_with_options(runner_lock.canvas(), &options);
drop(runner_lock);
Expand Down
23 changes: 7 additions & 16 deletions crates/eframe/src/web/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,14 @@ fn set_cursor_icon(cursor: egui::CursorIcon) -> Option<()> {
#[cfg(web_sys_unstable_apis)]
fn set_clipboard_text(s: &str) {
if let Some(window) = web_sys::window() {
if let Some(clipboard) = window.navigator().clipboard() {
let promise = clipboard.write_text(s);
let future = wasm_bindgen_futures::JsFuture::from(promise);
let future = async move {
if let Err(err) = future.await {
log::error!("Copy/cut action failed: {}", string_from_js_value(&err));
}
};
wasm_bindgen_futures::spawn_local(future);
} else {
let is_secure_context = window.is_secure_context();
if is_secure_context {
log::warn!("window.navigator.clipboard is null; can't copy text");
} else {
log::warn!("window.navigator.clipboard is null; can't copy text, probably because we're not in a secure context. See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts");
let promise = window.navigator().clipboard().write_text(s);
let future = wasm_bindgen_futures::JsFuture::from(promise);
let future = async move {
if let Err(err) = future.await {
log::error!("Copy/cut action failed: {}", string_from_js_value(&err));
}
}
};
wasm_bindgen_futures::spawn_local(future);
}
}

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)] //TODO(emilk): check if this is needed
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 @@ -114,7 +114,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/src/containers/scroll_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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
1 change: 1 addition & 0 deletions crates/egui/src/data/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub enum Key {
// `]`
CloseBracket,

#[allow(clippy::doc_markdown)]
/// \`, also known as "backquote" or "grave"
Backtick,

Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ pub struct Style {
/// If true and scrolling is enabled for only one direction, allow horizontal scrolling without pressing shift
pub always_scroll_the_only_direction: bool,

/// The animation that should be used when scrolling a [`crate::ScrollArea`] using e.g. [Ui::scroll_to_rect].
/// The animation that should be used when scrolling a [`crate::ScrollArea`] using e.g. [`Ui::scroll_to_rect`].
pub scroll_animation: ScrollAnimation,
}

Expand Down
9 changes: 7 additions & 2 deletions crates/egui_demo_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ web_app = ["http", "persistence"]

http = ["ehttp", "image", "poll-promise", "egui_extras/image"]
image_viewer = ["image", "egui_extras/all_loaders", "rfd"]
persistence = ["eframe/persistence", "egui/persistence", "serde", "egui_extras/serde"]
persistence = [
"eframe/persistence",
"egui/persistence",
"serde",
"egui_extras/serde",
]
puffin = ["eframe/puffin", "dep:puffin", "dep:puffin_http"]
serde = ["dep:serde", "egui_demo_lib/serde", "egui/serde"]
syntect = ["egui_demo_lib/syntect"]
Expand Down Expand Up @@ -77,6 +82,6 @@ rfd = { version = "0.13", optional = true }

# web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "=0.2.92"
wasm-bindgen = "=0.2.93"
wasm-bindgen-futures.workspace = true
web-sys.workspace = true
7 changes: 4 additions & 3 deletions crates/egui_demo_app/src/apps/image_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ impl eframe::App for ImageViewer {
ui.text_edit_singleline(&mut self.uri_edit_text);
if ui.small_button("✔").clicked() {
ctx.forget_image(&self.current_uri);
self.uri_edit_text = self.uri_edit_text.trim().to_owned();
self.current_uri = self.uri_edit_text.clone();
self.uri_edit_text
.clone_from(&self.uri_edit_text.trim().to_owned());
self.current_uri.clone_from(&self.uri_edit_text);
};

#[cfg(not(target_arch = "wasm32"))]
if ui.button("file…").clicked() {
if let Some(path) = rfd::FileDialog::new().pick_file() {
self.uri_edit_text = format!("file://{}", path.display());
self.current_uri = self.uri_edit_text.clone();
self.current_uri.clone_from(&self.uri_edit_text);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_demo_lib/src/easy_mark/easy_mark_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum Item<'a> {
// TODO(emilk): add Style here so empty heading still uses up the right amount of space.
Newline,

///
/// title
Text(Style, &'a str),

/// title, url
Expand Down
Loading