Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to MSRV 1.82 in preparation for color #745

Merged
merged 10 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 4 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 Down Expand Up @@ -63,7 +64,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 +81,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
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."
)]
xStrom marked this conversation as resolved.
Show resolved Hide resolved
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
52 changes: 39 additions & 13 deletions vello/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,41 +81,58 @@
//!
//! 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(
// Allow because of: https://github.com/rust-lang/rust/pull/130025
DJMcNab marked this conversation as resolved.
Show resolved Hide resolved
#![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(
// missing_debug_implementations,
// elided_lifetimes_in_paths,
// single_use_lifetimes,
// unnameable_types,
// unreachable_pub,
// 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,
reason = "Deferred, only apply in some feature sets so not expect"
DJMcNab marked this conversation as resolved.
Show resolved Hide resolved
)]

// 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 +338,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 +351,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: 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"
)
)]
xStrom marked this conversation as resolved.
Show resolved Hide resolved
let mut maybe_features = wgpu::Features::CLEAR_TEXTURE;
#[cfg(feature = "wgpu-profiler")]
{
Expand Down
30 changes: 24 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,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 +944,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 +1056,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
Loading