Skip to content

Commit

Permalink
Explicitly specify minimum supported rust version
Browse files Browse the repository at this point in the history
This should help with distributing apps using winit.

Fixes rust-windowing#1075.
  • Loading branch information
kchibisov committed Jul 27, 2022
1 parent 5003564 commit afa29c2
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
rust_version: [stable, nightly]
rust_version: [1.57.0, stable, nightly]
platform:
# Note: Make sure that we test all the `docs.rs` targets defined in Cargo.toml!
- { target: x86_64-pc-windows-msvc, os: windows-latest, }
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:

- name: Lint with clippy
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

- name: Build with serde enabled
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ And please only add new entries to the top of this list, right below the `# Unre

# Unreleased

- The minimum supported rust version was lowered to `1.57.0` and now explicitly tested.

# 0.27.0 (2022-07-26)

- On Windows, fix hiding a maximized window.
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

- 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
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
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ readme = "README.md"
repository = "https://github.com/rust-windowing/winit"
documentation = "https://docs.rs/winit"
categories = ["gui"]
rust-version = "1.57.0"

[package.metadata.docs.rs]
features = ["serde"]
Expand Down
4 changes: 2 additions & 2 deletions examples/fullscreen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ fn main() {
}
VirtualKeyCode::F => {
let fullscreen = Some(Fullscreen::Exclusive(mode.clone()));
println!("Setting mode: {fullscreen:?}");
println!("Setting mode: {:?}", fullscreen);
window.set_fullscreen(fullscreen);
}
VirtualKeyCode::B => {
let fullscreen = Some(Fullscreen::Borderless(Some(monitor.clone())));
println!("Setting mode: {fullscreen:?}");
println!("Setting mode: {:?}", fullscreen);
window.set_fullscreen(fullscreen);
}
VirtualKeyCode::S => {
Expand Down
6 changes: 2 additions & 4 deletions src/platform/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,8 @@ impl WindowExtUnix for Window {
#[inline]
#[cfg(feature = "wayland")]
fn wayland_set_csd_theme(&self, theme: Theme) {
match self.window {
LinuxWindow::Wayland(ref w) => w.set_csd_theme(theme),
#[cfg(feature = "x11")]
_ => {}
if let LinuxWindow::Wayland(ref window) = self.window {
window.set_csd_theme(theme);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/platform_impl/ios/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,8 @@ pub unsafe fn handle_main_events_cleared() {
if !this.has_launched() {
return;
}
match this.state_mut() {
&mut AppStateImpl::ProcessingEvents { .. } => {}
match *this.state_mut() {
AppStateImpl::ProcessingEvents { .. } => {}
_ => bug!("`ProcessingRedraws` happened unexpectedly"),
};
drop(this);
Expand Down
7 changes: 4 additions & 3 deletions src/platform_impl/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ impl Window {

/// Hooks for X11 errors.
#[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")]
unsafe extern "C" fn x_error_callback(
Expand Down Expand Up @@ -633,7 +634,7 @@ unsafe extern "C" fn x_error_callback(

pub enum EventLoop<T: 'static> {
#[cfg(feature = "wayland")]
Wayland(wayland::EventLoop<T>),
Wayland(Box<wayland::EventLoop<T>>),
#[cfg(feature = "x11")]
X(x11::EventLoop<T>),
}
Expand Down Expand Up @@ -723,7 +724,7 @@ impl<T: 'static> EventLoop<T> {

#[cfg(feature = "wayland")]
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")]
Expand Down

0 comments on commit afa29c2

Please sign in to comment.