Skip to content

Commit

Permalink
Update to MSRV 1.82 in preparation for color (#745)
Browse files Browse the repository at this point in the history
Co-authored-by: Kaur Kuut <[email protected]>
  • Loading branch information
DJMcNab and xStrom authored Nov 27, 2024
1 parent 3f19650 commit e6ead09
Show file tree
Hide file tree
Showing 33 changed files with 143 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
# If the compilation fails, then the version specified here needs to be bumped up to reality.
# Be sure to also update the rust-version property in the workspace Cargo.toml file,
# plus all the README.md files of the affected packages.
RUST_MIN_VER: "1.76"
RUST_MIN_VER: "1.82"
# List of packages that will be checked with the minimum supported Rust version.
# This should be limited to packages that are intended for publishing.
RUST_MIN_VER_PKGS: "-p vello -p vello_encoding -p vello_shaders"
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ You can find its changes [documented below](#030---2024-10-04).

## [Unreleased]

This release has an [MSRV][] of 1.76.
This release has an [MSRV][] of 1.82.

### Changed

- Breaking: Updated `wgpu` to 23.0.1, increased MSRV to 1.76 ([#735][], [#743][] by [@waywardmonkeys])
- Breaking: Updated `wgpu` to 23.0.1 ([#735][], [#743][] by [@waywardmonkeys])

### Fixed

Expand Down
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ version = "0.3.0"
edition = "2021"
# Keep in sync with RUST_MIN_VER in .github/workflows/ci.yml, with the relevant README.md files
# and with the MSRV in the `Unreleased` section of CHANGELOG.md.
rust-version = "1.76"
rust-version = "1.82"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/vello"

[workspace.lints]
# LINEBENDER LINT SET - Cargo.toml - v2

# LINEBENDER LINT SET - Cargo.toml - v3
# See https://linebender.org/wiki/canonical-lints/
rust.keyword_idents_2024 = "forbid"
rust.non_ascii_idents = "forbid"
Expand All @@ -55,6 +56,8 @@ rust.unused_macro_rules = "warn"
rust.unused_qualifications = "warn"
rust.variant_size_differences = "warn"

clippy.too_many_arguments = "allow"

clippy.allow_attributes = "warn"
clippy.allow_attributes_without_reason = "warn"
clippy.cast_possible_truncation = "warn"
Expand All @@ -63,7 +66,7 @@ clippy.dbg_macro = "warn"
clippy.debug_assert_with_mut_call = "warn"
clippy.doc_markdown = "warn"
clippy.exhaustive_enums = "warn"
clippy.fn_to_numeric_cast_any = "warn" # Can't be forbid due to 'scenes' requiring an exception.
clippy.fn_to_numeric_cast_any = "warn"
clippy.infinite_loop = "warn"
clippy.large_include_file = "warn"
clippy.large_stack_arrays = "warn"
Expand All @@ -80,7 +83,6 @@ clippy.semicolon_if_nothing_returned = "warn"
clippy.shadow_unrelated = "warn"
clippy.should_panic_without_expect = "warn"
clippy.todo = "warn"
clippy.trivially_copy_pass_by_ref = "warn"
clippy.unseparated_literal_suffix = "warn"
clippy.use_self = "warn"
clippy.wildcard_imports = "warn"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ VELLO_STATIC_LOG="vello=trace" VELLO_STATIC_ARGS="--test-scenes" cargo apk run -

## Minimum supported Rust Version (MSRV)

This version of Vello has been verified to compile with **Rust 1.76** and later.
This version of Vello has been verified to compile with **Rust 1.82** and later.

Future versions of Vello might increase the Rust version requirement.
It will not be treated as a breaking change and as such can even happen with small patch releases.
Expand Down
3 changes: 1 addition & 2 deletions examples/scenes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
clippy::use_self,
clippy::match_same_arms,
clippy::allow_attributes_without_reason,
clippy::allow_attributes,
clippy::fn_to_numeric_cast_any
clippy::allow_attributes
)]

mod images;
Expand Down
4 changes: 0 additions & 4 deletions examples/scenes/src/simple_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ impl SimpleText {
///
/// Note that Vello does support COLR emoji, but does not currently support
/// any other forms of emoji.
#[allow(clippy::too_many_arguments)]
pub fn add_colr_emoji_run<'a>(
&mut self,
scene: &mut Scene,
Expand Down Expand Up @@ -75,7 +74,6 @@ impl SimpleText {
/// not significantly increasing repository size.
///
/// This will use a CBTF font, which Vello supports.
#[allow(clippy::too_many_arguments)]
pub fn add_bitmap_emoji_run<'a>(
&mut self,
scene: &mut Scene,
Expand All @@ -100,7 +98,6 @@ impl SimpleText {
);
}

#[allow(clippy::too_many_arguments)]
pub fn add_run<'a>(
&mut self,
scene: &mut Scene,
Expand All @@ -125,7 +122,6 @@ impl SimpleText {
);
}

#[allow(clippy::too_many_arguments)]
pub fn add_var_run<'a>(
&mut self,
scene: &mut Scene,
Expand Down
1 change: 0 additions & 1 deletion examples/scenes/src/test_scenes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,6 @@ mod impls {
params.resolution = Some((1200.0, 1200.0).into());
}

#[allow(clippy::too_many_arguments)]
pub(super) fn two_point_radial(scene: &mut Scene, _params: &mut SceneParams) {
pub(super) fn make(
scene: &mut Scene,
Expand Down
1 change: 0 additions & 1 deletion examples/with_winit/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub struct Snapshot {
}

impl Snapshot {
#[allow(clippy::too_many_arguments)]
pub fn draw_layer<'a, T>(
&self,
scene: &mut Scene,
Expand Down
2 changes: 1 addition & 1 deletion vello/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ VELLO_STATIC_LOG="vello=trace" VELLO_STATIC_ARGS="--test-scenes" cargo apk run -

## Minimum supported Rust Version (MSRV)

This version of Vello has been verified to compile with **Rust 1.76** and later.
This version of Vello has been verified to compile with **Rust 1.82** and later.

Future versions of Vello might increase the Rust version requirement.
It will not be treated as a breaking change and as such can even happen with small patch releases.
Expand Down
10 changes: 5 additions & 5 deletions vello/src/debug/renderer.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright 2023 the Vello Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

// size_of is not part of the prelude until Rust 1.80 and our MSRV is below that
#[allow(unused_imports)]
use core::mem::size_of;
#![expect(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "Generated by derive macro"
)]

use super::DebugLayers;
use crate::{
Expand Down Expand Up @@ -211,8 +213,6 @@ impl DebugRenderer {
}
}

#[allow(clippy::too_many_arguments)]
// #[expect(clippy::too_many_arguments, reason="This function is internal, so the argument count doesn't cause issues for consumers.")]
pub fn render(
&self,
recording: &mut Recording,
Expand Down
6 changes: 6 additions & 0 deletions vello/src/debug/validate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// Copyright 2023 the Vello Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

#![expect(
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
reason = "Generated by derive macro"
)]

use {
bytemuck::{Pod, Zeroable},
std::{collections::BTreeSet, fmt},
Expand Down
38 changes: 25 additions & 13 deletions vello/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,41 +81,44 @@
//!
//! See the [`examples/`](https://github.com/linebender/vello/tree/main/examples) folder to see how that code integrates with frameworks like winit.
// LINEBENDER LINT SET - lib.rs - v1
// LINEBENDER LINT SET - lib.rs - v2
// See https://linebender.org/wiki/canonical-lints/
// These lints aren't included in Cargo.toml because they
// shouldn't apply to examples and tests
#![warn(unused_crate_dependencies)]
#![warn(clippy::print_stdout, clippy::print_stderr)]
// Targeting e.g. 32-bit means structs containing usize can give false positives for 64-bit.
#![cfg_attr(target_pointer_width = "64", warn(clippy::trivially_copy_pass_by_ref))]
// END LINEBENDER LINT SET
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// The following lints are part of the Linebender standard set,
// but resolving them has been deferred for now.
// Feel free to send a PR that solves one or more of these.
#![allow(
// Need to allow instead of expect until Rust 1.83 https://github.com/rust-lang/rust/pull/130025
#![allow(missing_docs, reason = "We have many as-yet undocumented items.")]
#![expect(
missing_debug_implementations,
elided_lifetimes_in_paths,
single_use_lifetimes,
unnameable_types,
unreachable_pub,
missing_docs,
clippy::return_self_not_must_use,
clippy::cast_possible_truncation,
clippy::missing_assert_message,
clippy::shadow_unrelated,
clippy::missing_panics_doc,
clippy::missing_errors_doc,
clippy::exhaustive_enums,
clippy::todo,
clippy::print_stderr,
clippy::partial_pub_fields,
clippy::use_self,
clippy::match_same_arms
clippy::match_same_arms,
reason = "Deferred"
)]
#![allow(
clippy::missing_errors_doc,
clippy::todo,
clippy::partial_pub_fields,
reason = "Deferred, only apply in some feature sets so not expect"
)]

// size_of is not part of the prelude until Rust 1.80 and our MSRV is below that
#[allow(unused_imports)]
use core::mem::size_of;

mod debug;
mod recording;
Expand Down Expand Up @@ -321,7 +324,10 @@ pub enum Error {
ShaderCompilation(#[from] vello_shaders::compile::ErrorVec),
}

#[allow(dead_code)] // this can be unused when wgpu feature is not used
#[cfg_attr(
not(feature = "wgpu"),
expect(dead_code, reason = "this can be unused when wgpu feature is not used")
)]
pub(crate) type Result<T, E = Error> = std::result::Result<T, E>;

/// Renders a scene into a texture or surface.
Expand All @@ -331,7 +337,13 @@ pub(crate) type Result<T, E = Error> = std::result::Result<T, E>;
/// This is an assumption which is known to be limiting, and is planned to change.
#[cfg(feature = "wgpu")]
pub struct Renderer {
#[cfg_attr(not(feature = "hot_reload"), allow(dead_code))]
#[cfg_attr(
not(feature = "hot_reload"),
expect(
dead_code,
reason = "Options are only used to reinitialise on a hot reload"
)
)]
options: RendererOptions,
engine: WgpuEngine,
resolver: Resolver,
Expand Down
1 change: 0 additions & 1 deletion vello/src/recording.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ impl Recording {
/// Dispatch a compute shader where the size is determined dynamically.
/// The `buf` argument contains the dispatch size, 3 `u32` values beginning
/// at the given byte `offset`.
#[allow(unused)]
pub fn dispatch_indirect<R>(
&mut self,
shader: ShaderId,
Expand Down
4 changes: 0 additions & 4 deletions vello/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

//! Take an encoded scene and create a graph to render it
// size_of is not part of the prelude until Rust 1.80 and our MSRV is below that
#[allow(unused_imports)]
use core::mem::size_of;

use crate::recording::{BufferProxy, ImageFormat, ImageProxy, Recording, ResourceProxy};
use crate::shaders::FullShaders;
use crate::{AaConfig, RenderParams};
Expand Down
13 changes: 7 additions & 6 deletions vello/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ pub struct DeviceHandle {
}

impl RenderContext {
#[allow(clippy::new_without_default)]
#[expect(
clippy::new_without_default,
reason = "Creating a wgpu Instance is something which should only be done rarely"
)]
pub fn new() -> Self {
let instance = Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::util::backend_bits_from_env().unwrap_or(wgpu::Backends::PRIMARY),
Expand Down Expand Up @@ -137,12 +140,10 @@ impl RenderContext {
.await?;
let features = adapter.features();
let limits = Limits::default();
#[allow(unused_mut)]
let mut maybe_features = wgpu::Features::CLEAR_TEXTURE;
let maybe_features = wgpu::Features::CLEAR_TEXTURE;
#[cfg(feature = "wgpu-profiler")]
{
maybe_features |= wgpu_profiler::GpuProfiler::ALL_WGPU_TIMER_FEATURES;
};
let maybe_features = maybe_features | wgpu_profiler::GpuProfiler::ALL_WGPU_TIMER_FEATURES;

let (device, queue) = adapter
.request_device(
&wgpu::DeviceDescriptor {
Expand Down
22 changes: 16 additions & 6 deletions vello/src/wgpu_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ enum ShaderKind<'a> {
}

struct Shader {
#[allow(dead_code)]
label: &'static str,
wgpu: Option<WgpuShader>,
cpu: Option<CpuShader>,
Expand All @@ -89,7 +88,7 @@ impl Shader {
}

pub(crate) enum ExternalResource<'a> {
#[allow(unused)]
#[expect(unused, reason = "No buffers are accepted as arguments currently")]
Buffer(BufferProxy, &'a Buffer),
Image(ImageProxy, &'a TextureView),
}
Expand All @@ -102,7 +101,13 @@ enum MaterializedBuffer {

struct BindMapBuffer {
buffer: MaterializedBuffer,
#[cfg_attr(not(feature = "buffer_labels"), allow(unused))]
#[cfg_attr(
not(feature = "buffer_labels"),
expect(
unused,
reason = "Useful for debugging; simplifies upstream to always provide this"
)
)]
label: &'static str,
}

Expand Down Expand Up @@ -303,7 +308,6 @@ impl WgpuEngine {
})
}

#[allow(clippy::too_many_arguments)]
pub fn add_render_shader(
&mut self,
device: &Device,
Expand Down Expand Up @@ -936,7 +940,14 @@ impl ResourcePool {
fn get_buf(
&mut self,
size: u64,
#[allow(unused)] name: &'static str,
#[cfg_attr(
not(feature = "buffer_labels"),
expect(
unused,
reason = "Debugging argument always present but only consumed when debugging feature enabled"
)
)]
name: &'static str,
usage: BufferUsages,
device: &Device,
) -> Buffer {
Expand Down Expand Up @@ -1041,7 +1052,6 @@ impl<'a> TransientBindMap<'a> {
.expect("texture not materialized")
}

#[allow(clippy::too_many_arguments)]
fn create_bind_group(
&mut self,
bind_map: &mut BindMap,
Expand Down
3 changes: 2 additions & 1 deletion vello_encoding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Significant changes are documented in [the changelog].

## Minimum supported Rust Version (MSRV)

This version of Vello Encoding has been verified to compile with **Rust 1.76** and later.
This version of Vello Encoding has been verified to compile with **Rust 1.82** and later.

Future versions of Vello Encoding might increase the Rust version requirement.
It will not be treated as a breaking change and as such can even happen with small patch releases.
Expand All @@ -35,6 +35,7 @@ If you encounter a compilation issue due to a dependency and don't want to upgra
# Use the problematic dependency's name and version
cargo update -p package_name --precise 0.1.1
```

</details>

## Community
Expand Down
Loading

0 comments on commit e6ead09

Please sign in to comment.