Skip to content

Commit

Permalink
Update to MSRV 1.82 in preparation for color
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed Nov 27, 2024
1 parent 64be9d9 commit 68466a9
Show file tree
Hide file tree
Showing 31 changed files with 130 additions and 93 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
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ 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"

Expand Down Expand Up @@ -63,7 +63,9 @@ 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.
# Break from the lint set due to https://github.com/rust-lang/rust/issues/133346#issuecomment-2503567552
# and our use of clap.
clippy.fn_to_numeric_cast_any = "deny"
clippy.infinite_loop = "warn"
clippy.large_include_file = "warn"
clippy.large_stack_arrays = "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
5 changes: 4 additions & 1 deletion examples/scenes/src/test_scenes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,10 @@ mod impls {
params.resolution = Some((1200.0, 1200.0).into());
}

#[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(super) fn two_point_radial(scene: &mut Scene, _params: &mut SceneParams) {
pub(super) fn make(
scene: &mut Scene,
Expand Down
5 changes: 4 additions & 1 deletion examples/with_winit/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ pub struct Snapshot {
}

impl Snapshot {
#[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 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
14 changes: 9 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,10 @@ 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.")]
#[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
25 changes: 16 additions & 9 deletions vello/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@
// 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(
// Allow because of: 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,
Expand All @@ -110,13 +111,10 @@
clippy::print_stderr,
clippy::partial_pub_fields,
clippy::use_self,
clippy::match_same_arms
clippy::match_same_arms,
reason = "Deferred"
)]

// 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;
mod render;
Expand Down Expand Up @@ -321,7 +319,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 +332,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
5 changes: 4 additions & 1 deletion vello/src/recording.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ 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)]
#[cfg_attr(
not(feature = "debug_layers"),
expect(unused, reason = "Currently only used by the debug layers")
)]
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: 11 additions & 2 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,7 +140,13 @@ impl RenderContext {
.await?;
let features = adapter.features();
let limits = Limits::default();
#[allow(unused_mut)]
#[cfg_attr(
not(feature = "wgpu-profiler"),
expect(
unused_mut,
reason = "Mutation is only expected with the wgpu-profiler feature"
)
)]
let mut maybe_features = wgpu::Features::CLEAR_TEXTURE;
#[cfg(feature = "wgpu-profiler")]
{
Expand Down
22 changes: 17 additions & 5 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 Down Expand Up @@ -303,7 +302,10 @@ impl WgpuEngine {
})
}

#[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 add_render_shader(
&mut self,
device: &Device,
Expand Down Expand Up @@ -936,7 +938,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 +1050,10 @@ impl<'a> TransientBindMap<'a> {
.expect("texture not materialized")
}

#[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."
)]
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
5 changes: 4 additions & 1 deletion vello_encoding/src/clip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ pub struct ClipBic {
/// Clip element.
#[derive(Copy, Clone, Pod, Zeroable, Debug, Default)]
#[repr(C)]
#[allow(clippy::partial_pub_fields)]
#[expect(
clippy::partial_pub_fields,
reason = "Padding is meaningless to manipulate directly"
)]
pub struct ClipElement {
pub parent_ix: u32,
_padding: [u8; 12],
Expand Down
6 changes: 1 addition & 5 deletions vello_encoding/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// 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;

use crate::SegmentCount;

use super::{
Expand Down Expand Up @@ -304,7 +300,7 @@ impl<T: Sized> BufferSize<T> {
}

/// Returns the number of elements.
#[allow(clippy::len_without_is_empty)]
#[expect(clippy::len_without_is_empty, reason = "The buffer can never be empty")]
pub const fn len(self) -> u32 {
self.len
}
Expand Down
9 changes: 5 additions & 4 deletions vello_encoding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@
// 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(
// Allow because of: 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,
missing_docs,
variant_size_differences,
clippy::return_self_not_must_use,
clippy::unseparated_literal_suffix,
clippy::cast_possible_truncation,
clippy::missing_assert_message,
clippy::shadow_unrelated,
clippy::missing_panics_doc,
clippy::exhaustive_enums
clippy::exhaustive_enums,
reason = "Deferred"
)]

mod binning;
Expand Down
1 change: 0 additions & 1 deletion vello_encoding/src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ impl Mul for Transform {
}
}

#[allow(dead_code)]
pub fn point_to_f32(point: kurbo::Point) -> [f32; 2] {
[point.x as f32, point.y as f32]
}
Expand Down
Loading

0 comments on commit 68466a9

Please sign in to comment.