Explicitly specify minimum supported rust version

This should help with distributing apps using winit.

Fixes #1075.
This commit is contained in:
Kirill Chibisov 2022-07-29 14:39:41 +03:00 committed by GitHub
parent 50035643f7
commit bf537009d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 9 deletions

View file

@ -22,7 +22,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
rust_version: [stable, nightly] rust_version: [1.57.0, stable, nightly]
platform: platform:
# Note: Make sure that we test all the `docs.rs` targets defined in Cargo.toml! # Note: Make sure that we test all the `docs.rs` targets defined in Cargo.toml!
- { target: x86_64-pc-windows-msvc, os: windows-latest, } - { target: x86_64-pc-windows-msvc, os: windows-latest, }
@ -103,7 +103,7 @@ jobs:
- name: Lint with clippy - name: Lint with clippy
shell: bash shell: bash
if: (matrix.rust_version != 'nightly') && !contains(matrix.platform.options, '--no-default-features') if: (matrix.rust_version == '1.57.0') && !contains(matrix.platform.options, '--no-default-features')
run: cargo clippy --all-targets --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES -- -Dwarnings run: cargo clippy --all-targets --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES -- -Dwarnings
- name: Build with serde enabled - name: Build with serde enabled

View file

@ -8,6 +8,8 @@ And please only add new entries to the top of this list, right below the `# Unre
# Unreleased # Unreleased
- The minimum supported Rust version was lowered to `1.57.0` and now explicitly tested.
# 0.27.0 (2022-07-26) # 0.27.0 (2022-07-26)
- On Windows, fix hiding a maximized window. - On Windows, fix hiding a maximized window.

View file

@ -20,6 +20,7 @@ your description of the issue as detailed as possible:
When making a code contribution to winit, before opening your pull request, please make sure that: When making a code contribution to winit, before opening your pull request, please make sure that:
- your patch builds with Winit's minimal supported rust version - Rust 1.57.0.
- you tested your modifications on all the platforms impacted, or if not possible detail which platforms - you tested your modifications on all the platforms impacted, or if not possible detail which platforms
were not tested, and what should be tested, so that a maintainer or another contributor can test them were not tested, and what should be tested, so that a maintainer or another contributor can test them
- you updated any relevant documentation in winit - you updated any relevant documentation in winit

View file

@ -10,6 +10,7 @@ readme = "README.md"
repository = "https://github.com/rust-windowing/winit" repository = "https://github.com/rust-windowing/winit"
documentation = "https://docs.rs/winit" documentation = "https://docs.rs/winit"
categories = ["gui"] categories = ["gui"]
rust-version = "1.57.0"
[package.metadata.docs.rs] [package.metadata.docs.rs]
features = ["serde"] features = ["serde"]

View file

@ -59,12 +59,12 @@ fn main() {
} }
VirtualKeyCode::F => { VirtualKeyCode::F => {
let fullscreen = Some(Fullscreen::Exclusive(mode.clone())); let fullscreen = Some(Fullscreen::Exclusive(mode.clone()));
println!("Setting mode: {fullscreen:?}"); println!("Setting mode: {:?}", fullscreen);
window.set_fullscreen(fullscreen); window.set_fullscreen(fullscreen);
} }
VirtualKeyCode::B => { VirtualKeyCode::B => {
let fullscreen = Some(Fullscreen::Borderless(Some(monitor.clone()))); let fullscreen = Some(Fullscreen::Borderless(Some(monitor.clone())));
println!("Setting mode: {fullscreen:?}"); println!("Setting mode: {:?}", fullscreen);
window.set_fullscreen(fullscreen); window.set_fullscreen(fullscreen);
} }
VirtualKeyCode::S => { VirtualKeyCode::S => {

View file

@ -299,10 +299,11 @@ impl WindowExtUnix for Window {
#[inline] #[inline]
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
fn wayland_set_csd_theme(&self, theme: Theme) { fn wayland_set_csd_theme(&self, theme: Theme) {
#[allow(clippy::single_match)]
match self.window { match self.window {
LinuxWindow::Wayland(ref w) => w.set_csd_theme(theme), LinuxWindow::Wayland(ref w) => w.set_csd_theme(theme),
#[cfg(feature = "x11")] #[cfg(feature = "x11")]
_ => {} _ => (),
} }
} }

View file

@ -793,7 +793,7 @@ pub unsafe fn handle_main_events_cleared() {
return; return;
} }
match this.state_mut() { match this.state_mut() {
&mut AppStateImpl::ProcessingEvents { .. } => {} AppStateImpl::ProcessingEvents { .. } => {}
_ => bug!("`ProcessingRedraws` happened unexpectedly"), _ => bug!("`ProcessingRedraws` happened unexpectedly"),
}; };
drop(this); drop(this);

View file

@ -587,7 +587,8 @@ impl Window {
/// Hooks for X11 errors. /// Hooks for X11 errors.
#[cfg(feature = "x11")] #[cfg(feature = "x11")]
pub(crate) static mut XLIB_ERROR_HOOKS: Mutex<Vec<XlibErrorHook>> = Mutex::new(Vec::new()); pub(crate) static mut XLIB_ERROR_HOOKS: Lazy<Mutex<Vec<XlibErrorHook>>> =
Lazy::new(|| Mutex::new(Vec::new()));
#[cfg(feature = "x11")] #[cfg(feature = "x11")]
unsafe extern "C" fn x_error_callback( unsafe extern "C" fn x_error_callback(
@ -633,7 +634,7 @@ unsafe extern "C" fn x_error_callback(
pub enum EventLoop<T: 'static> { pub enum EventLoop<T: 'static> {
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
Wayland(wayland::EventLoop<T>), Wayland(Box<wayland::EventLoop<T>>),
#[cfg(feature = "x11")] #[cfg(feature = "x11")]
X(x11::EventLoop<T>), X(x11::EventLoop<T>),
} }
@ -723,7 +724,7 @@ impl<T: 'static> EventLoop<T> {
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
fn new_wayland_any_thread() -> Result<EventLoop<T>, Box<dyn Error>> { fn new_wayland_any_thread() -> Result<EventLoop<T>, Box<dyn Error>> {
wayland::EventLoop::new().map(EventLoop::Wayland) wayland::EventLoop::new().map(|evlp| EventLoop::Wayland(Box::new(evlp)))
} }
#[cfg(feature = "x11")] #[cfg(feature = "x11")]