From f37180f7dc49e155ddebd89c8f707b91eb2ea999 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 9 Sep 2021 00:16:06 +0200 Subject: [PATCH] Bump MSRV (Minimum Supported Rust Version) to 1.54.0 (#703) 1.51.0 clippy has been giving me trouble (not reporting all problems), and so I take the easy way out and just bump MSRV. We will upgrade to 1.56.0 once it comes around anyway to get access to that sweet disjoint capture in closures (https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html) --- .github/workflows/rust.yml | 18 ++++++++-------- CHANGELOG.md | 1 + eframe/src/lib.rs | 9 +------- egui/src/lib.rs | 10 ++------- egui_demo_app/src/lib.rs | 7 ------ egui_demo_app/src/main.rs | 7 ------ egui_demo_lib/src/lib.rs | 8 +------ egui_glium/src/lib.rs | 9 +------- egui_web/src/lib.rs | 9 +------- egui_web/src/shader/vertex_100es.glsl | 31 --------------------------- egui_web/src/webgl1.rs | 15 +++++-------- emath/src/lib.rs | 8 +------ epaint/src/lib.rs | 8 +------ epi/src/lib.rs | 10 +++------ rust-toolchain | 2 +- 15 files changed, 27 insertions(+), 125 deletions(-) delete mode 100644 egui_web/src/shader/vertex_100es.glsl diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 41ae98f14..9f4747a7d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -17,7 +17,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.51.0 + toolchain: 1.54.0 override: true - run: sudo apt-get install libspeechd-dev - uses: actions-rs/cargo@v1 @@ -32,7 +32,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.51.0 + toolchain: 1.54.0 override: true - run: sudo apt-get install libspeechd-dev - uses: actions-rs/cargo@v1 @@ -48,7 +48,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.51.0 + toolchain: 1.54.0 override: true - run: rustup target add wasm32-unknown-unknown - uses: actions-rs/cargo@v1 @@ -64,7 +64,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.51.0 + toolchain: 1.54.0 override: true - run: rustup target add wasm32-unknown-unknown - uses: actions-rs/cargo@v1 @@ -80,7 +80,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.51.0 + toolchain: 1.54.0 override: true - run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev - uses: actions-rs/cargo@v1 @@ -96,7 +96,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.51.0 + toolchain: 1.54.0 override: true - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 @@ -112,7 +112,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.51.0 + toolchain: 1.54.0 override: true - run: rustup component add clippy - run: sudo apt-get install libspeechd-dev @@ -129,7 +129,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.51.0 + toolchain: 1.54.0 override: true - run: sudo apt-get install libspeechd-dev - run: cargo doc -p emath -p epaint -p egui -p eframe -p epi -p egui_web -p egui_glium --lib --no-deps --all-features @@ -142,7 +142,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.51.0 + toolchain: 1.54.0 override: true - run: sudo apt-get install libspeechd-dev - run: rustup target add wasm32-unknown-unknown diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af873aef..fe9b93adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ NOTE: [`eframe`](eframe/CHANGELOG.md), [`egui_web`](egui_web/CHANGELOG.md) and [ * All `Ui`:s must now have a finite `max_rect`. * Deprecated: `max_rect_finite`, `available_size_before_wrap_finite` and `available_rect_before_wrap_finite`. * `Painter`/`Fonts`: text layout now expect color when creating a `Galley`. You may override that color with `Painter::galley_with_color`. +* MSRV (Minimum Supported Rust Version) is now `1.54.0`. ### Fixed 🐛 * Fix wrongly sized multiline `TextEdit` in justified layouts. diff --git a/eframe/src/lib.rs b/eframe/src/lib.rs index 219d63e9e..51daeaf59 100644 --- a/eframe/src/lib.rs +++ b/eframe/src/lib.rs @@ -13,15 +13,8 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] -#![warn(clippy::all, missing_docs, rust_2018_idioms)] +#![warn(clippy::all, missing_crate_level_docs, missing_docs, rust_2018_idioms)] pub use {egui, epi}; diff --git a/egui/src/lib.rs b/egui/src/lib.rs index 89eb15449..9817baadb 100644 --- a/egui/src/lib.rs +++ b/egui/src/lib.rs @@ -3,7 +3,7 @@ //! Try the live web demo: . Read more about egui at . //! //! `egui` is in heavy development, with each new version having breaking changes. -//! You need to have rust 1.51.0 or later to use `egui`. +//! You need to have rust 1.54.0 or later to use `egui`. //! //! To quickly get started with egui, you can take a look at [`egui_template`](https://github.com/emilk/egui_template) //! which uses [`eframe`](https://docs.rs/eframe). @@ -267,13 +267,6 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] #![warn( clippy::all, @@ -336,6 +329,7 @@ clippy::verbose_file_reads, clippy::zero_sized_map_values, future_incompatible, + missing_crate_level_docs, nonstandard_style, rust_2018_idioms )] diff --git a/egui_demo_app/src/lib.rs b/egui_demo_app/src/lib.rs index 2f86c13c9..2ef88b502 100644 --- a/egui_demo_app/src/lib.rs +++ b/egui_demo_app/src/lib.rs @@ -1,12 +1,5 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] #![warn(clippy::all, rust_2018_idioms)] diff --git a/egui_demo_app/src/main.rs b/egui_demo_app/src/main.rs index a5ad89ae9..806fbe0c7 100644 --- a/egui_demo_app/src/main.rs +++ b/egui_demo_app/src/main.rs @@ -1,12 +1,5 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] #![warn(clippy::all, rust_2018_idioms)] diff --git a/egui_demo_lib/src/lib.rs b/egui_demo_lib/src/lib.rs index f9fc22b90..2bd10bce4 100644 --- a/egui_demo_lib/src/lib.rs +++ b/egui_demo_lib/src/lib.rs @@ -4,13 +4,6 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] #![warn( clippy::all, @@ -73,6 +66,7 @@ clippy::verbose_file_reads, clippy::zero_sized_map_values, future_incompatible, + missing_crate_level_docs, nonstandard_style, rust_2018_idioms )] diff --git a/egui_glium/src/lib.rs b/egui_glium/src/lib.rs index a280ce86a..84151d7c7 100644 --- a/egui_glium/src/lib.rs +++ b/egui_glium/src/lib.rs @@ -7,15 +7,8 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] -#![warn(clippy::all, rust_2018_idioms)] +#![warn(clippy::all, missing_crate_level_docs, rust_2018_idioms)] #![allow(clippy::manual_range_contains, clippy::single_match)] mod backend; diff --git a/egui_web/src/lib.rs b/egui_web/src/lib.rs index de4633b5a..a390522f7 100644 --- a/egui_web/src/lib.rs +++ b/egui_web/src/lib.rs @@ -11,15 +11,8 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] -#![warn(clippy::all, rust_2018_idioms)] +#![warn(clippy::all, missing_crate_level_docs, rust_2018_idioms)] pub mod backend; mod painter; diff --git a/egui_web/src/shader/vertex_100es.glsl b/egui_web/src/shader/vertex_100es.glsl deleted file mode 100644 index c45c628db..000000000 --- a/egui_web/src/shader/vertex_100es.glsl +++ /dev/null @@ -1,31 +0,0 @@ -precision mediump float; -uniform vec2 u_screen_size; -attribute vec2 a_pos; -attribute vec2 a_tc; -attribute vec4 a_srgba; -varying vec4 v_rgba; -varying vec2 v_tc; - -// 0-1 linear from 0-255 sRGB -vec3 linear_from_srgb(vec3 srgb) { - bvec3 cutoff = lessThan(srgb, vec3(10.31475)); - vec3 lower = srgb / vec3(3294.6); - vec3 higher = pow((srgb + vec3(14.025)) / vec3(269.025), vec3(2.4)); - return mix(higher, lower, vec3(cutoff)); -} - -// 0-1 linear from 0-255 sRGBA -vec4 linear_from_srgba(vec4 srgba) { - return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0); -} - -void main() { - gl_Position = vec4( - 2.0 * a_pos.x / u_screen_size.x - 1.0, - 1.0 - 2.0 * a_pos.y / u_screen_size.y, - 0.0, - 1.0); - // egui encodes vertex colors in gamma spaces, so we must decode the colors here: - v_rgba = linear_from_srgba(a_srgba); - v_tc = a_tc; -} diff --git a/egui_web/src/webgl1.rs b/egui_web/src/webgl1.rs index c627e01e9..377f7c4f3 100644 --- a/egui_web/src/webgl1.rs +++ b/egui_web/src/webgl1.rs @@ -64,12 +64,12 @@ impl WebGlPainter { let srgb_supported = matches!(gl.get_extension("EXT_sRGB"), Ok(Some(_))); + let vert_shader = compile_shader( + &gl, + Gl::VERTEX_SHADER, + include_str!("shader/main_vertex_100es.glsl"), + )?; let (texture_format, program, post_process) = if srgb_supported { - let vert_shader = compile_shader( - &gl, - Gl::VERTEX_SHADER, - include_str!("shader/main_vertex_100es.glsl"), - )?; let frag_shader = compile_shader( &gl, Gl::FRAGMENT_SHADER, @@ -82,11 +82,6 @@ impl WebGlPainter { (ExtSRgb::SRGB_ALPHA_EXT, program, Some(post_process)) } else { - let vert_shader = compile_shader( - &gl, - Gl::VERTEX_SHADER, - include_str!("shader/vertex_100es.glsl"), - )?; let frag_shader = compile_shader( &gl, Gl::FRAGMENT_SHADER, diff --git a/emath/src/lib.rs b/emath/src/lib.rs index 1aa50604a..d8fb5ce66 100644 --- a/emath/src/lib.rs +++ b/emath/src/lib.rs @@ -11,13 +11,6 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] #![warn( clippy::all, @@ -80,6 +73,7 @@ clippy::verbose_file_reads, clippy::zero_sized_map_values, future_incompatible, + missing_crate_level_docs, nonstandard_style, rust_2018_idioms )] diff --git a/epaint/src/lib.rs b/epaint/src/lib.rs index 79bc7c183..17fcd07ce 100644 --- a/epaint/src/lib.rs +++ b/epaint/src/lib.rs @@ -2,13 +2,6 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] #![warn( clippy::all, @@ -71,6 +64,7 @@ clippy::verbose_file_reads, clippy::zero_sized_map_values, future_incompatible, + missing_crate_level_docs, nonstandard_style, rust_2018_idioms )] diff --git a/epi/src/lib.rs b/epi/src/lib.rs index b1b5f0e62..9398bb7bd 100644 --- a/epi/src/lib.rs +++ b/epi/src/lib.rs @@ -8,13 +8,6 @@ // Forbid warnings in release builds: #![cfg_attr(not(debug_assertions), deny(warnings))] -// Disabled so we can support rust 1.51: -// #![deny( -// rustdoc::broken_intra_doc_links, -// rustdoc::invalid_codeblock_attributes, -// rustdoc::missing_crate_level_docs, -// rustdoc::private_intra_doc_links -// )] #![forbid(unsafe_code)] #![warn( clippy::all, @@ -77,11 +70,13 @@ clippy::verbose_file_reads, clippy::zero_sized_map_values, future_incompatible, + missing_crate_level_docs, nonstandard_style, rust_2018_idioms )] #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] +#![warn(missing_docs)] // Let's keep `epi` well-documented. pub use egui; // Re-export for user convenience @@ -312,6 +307,7 @@ pub trait TextureAllocator { /// Abstraction for platform dependent texture reference pub trait NativeTexture { + /// The native texture type. type Texture; /// Bind native texture to egui texture diff --git a/rust-toolchain b/rust-toolchain index b47bc688e..fd917d1c0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -5,6 +5,6 @@ # to the user in the error, instead of "error: invalid channel name '[toolchain]'". [toolchain] -channel = "1.51.0" +channel = "1.54.0" components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ]