Skip to content

Commit 943e6a4

Browse files
committed
Update Repo MSRV to 1.91
1 parent 90db081 commit 943e6a4

File tree

17 files changed

+43
-182
lines changed

17 files changed

+43
-182
lines changed

examples/features/src/ray_cube_compute/mod.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{borrow::Cow, future::Future, iter, mem, pin::Pin, task};
1+
use std::{borrow::Cow, iter, mem};
22

33
use bytemuck::{Pod, Zeroable};
44
use glam::{Affine3A, Mat4, Quat, Vec3};
@@ -98,28 +98,6 @@ fn affine_to_rows(mat: &Affine3A) -> [f32; 12] {
9898
]
9999
}
100100

101-
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
102-
///
103-
/// Given a future `inner` of an `Option<E>` for some error type `E`,
104-
/// wait for the future to be ready, and panic if its value is `Some`.
105-
///
106-
/// This can be done simpler with `FutureExt`, but we don't want to add
107-
/// a dependency just for this small case.
108-
struct ErrorFuture<F> {
109-
inner: F,
110-
}
111-
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
112-
type Output = ();
113-
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
114-
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
115-
inner.poll(cx).map(|error| {
116-
if let Some(e) = error {
117-
panic!("Rendering {e}");
118-
}
119-
})
120-
}
121-
}
122-
123101
struct Example {
124102
rt_target: wgpu::Texture,
125103
#[expect(dead_code)]

examples/features/src/ray_cube_fragment/mod.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::utils;
22
use bytemuck::{Pod, Zeroable};
33
use glam::{Mat4, Quat, Vec3};
44
use std::ops::IndexMut;
5-
use std::{borrow::Cow, future::Future, iter, mem, pin::Pin, task};
5+
use std::{borrow::Cow, iter, mem};
66
use wgpu::util::DeviceExt;
77

88
// from cube
@@ -73,28 +73,6 @@ struct Uniforms {
7373
proj_inverse: Mat4,
7474
}
7575

76-
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
77-
///
78-
/// Given a future `inner` of an `Option<E>` for some error type `E`,
79-
/// wait for the future to be ready, and panic if its value is `Some`.
80-
///
81-
/// This can be done simpler with `FutureExt`, but we don't want to add
82-
/// a dependency just for this small case.
83-
struct ErrorFuture<F> {
84-
inner: F,
85-
}
86-
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
87-
type Output = ();
88-
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
89-
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
90-
inner.poll(cx).map(|error| {
91-
if let Some(e) = error {
92-
panic!("Rendering {e}");
93-
}
94-
})
95-
}
96-
}
97-
9876
struct Example {
9977
uniforms: Uniforms,
10078
uniform_buf: wgpu::Buffer,

examples/features/src/ray_cube_normals/mod.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{borrow::Cow, future::Future, iter, mem, pin::Pin, task};
1+
use std::{borrow::Cow, iter, mem};
22

33
use bytemuck::{Pod, Zeroable};
44
use glam::{Affine3A, Mat4, Quat, Vec3};
@@ -97,28 +97,6 @@ fn affine_to_rows(mat: &Affine3A) -> [f32; 12] {
9797
]
9898
}
9999

100-
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
101-
///
102-
/// Given a future `inner` of an `Option<E>` for some error type `E`,
103-
/// wait for the future to be ready, and panic if its value is `Some`.
104-
///
105-
/// This can be done simpler with `FutureExt`, but we don't want to add
106-
/// a dependency just for this small case.
107-
struct ErrorFuture<F> {
108-
inner: F,
109-
}
110-
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
111-
type Output = ();
112-
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
113-
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
114-
inner.poll(cx).map(|error| {
115-
if let Some(e) = error {
116-
panic!("Rendering {e}");
117-
}
118-
})
119-
}
120-
}
121-
122100
struct Example {
123101
rt_target: wgpu::Texture,
124102
tlas: wgpu::Tlas,

examples/features/src/ray_scene/mod.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use bytemuck::{Pod, Zeroable};
33
use glam::{Mat4, Quat, Vec3};
44
use std::f32::consts::PI;
55
use std::ops::IndexMut;
6-
use std::{borrow::Cow, future::Future, iter, mem, ops::Range, pin::Pin, task};
6+
use std::{borrow::Cow, iter, mem, ops::Range};
77
use wgpu::util::DeviceExt;
88

99
// from cube
@@ -25,28 +25,6 @@ struct Uniforms {
2525
proj_inverse: Mat4,
2626
}
2727

28-
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
29-
///
30-
/// Given a future `inner` of an `Option<E>` for some error type `E`,
31-
/// wait for the future to be ready, and panic if its value is `Some`.
32-
///
33-
/// This can be done simpler with `FutureExt`, but we don't want to add
34-
/// a dependency just for this small case.
35-
struct ErrorFuture<F> {
36-
inner: F,
37-
}
38-
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
39-
type Output = ();
40-
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
41-
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
42-
inner.poll(cx).map(|error| {
43-
if let Some(e) = error {
44-
panic!("Rendering {e}");
45-
}
46-
})
47-
}
48-
}
49-
5028
#[derive(Debug, Clone, Default)]
5129
struct RawSceneComponents {
5230
vertices: Vec<Vertex>,

examples/features/src/ray_shadows/mod.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{borrow::Cow, future::Future, iter, mem, pin::Pin, task};
1+
use std::{borrow::Cow, iter, mem};
22

33
use bytemuck::{Pod, Zeroable};
44
use glam::{Mat4, Vec3};
@@ -52,28 +52,6 @@ struct Uniforms {
5252
vertex: Mat4,
5353
}
5454

55-
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
56-
///
57-
/// Given a future `inner` of an `Option<E>` for some error type `E`,
58-
/// wait for the future to be ready, and panic if its value is `Some`.
59-
///
60-
/// This can be done simpler with `FutureExt`, but we don't want to add
61-
/// a dependency just for this small case.
62-
struct ErrorFuture<F> {
63-
inner: F,
64-
}
65-
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
66-
type Output = ();
67-
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
68-
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
69-
inner.poll(cx).map(|error| {
70-
if let Some(e) = error {
71-
panic!("Rendering {e}");
72-
}
73-
})
74-
}
75-
}
76-
7755
struct Example {
7856
uniforms: Uniforms,
7957
uniform_buf: wgpu::Buffer,

examples/features/src/shadow/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl crate::framework::Example for Example {
494494
module: &shader,
495495
entry_point: Some("vs_bake"),
496496
compilation_options: Default::default(),
497-
buffers: &[vb_desc.clone()],
497+
buffers: std::slice::from_ref(&vb_desc),
498498
},
499499
fragment: None,
500500
primitive: wgpu::PrimitiveState {

naga/src/back/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ impl FunctionCtx<'_> {
215215
external_texture_key,
216216
)
217217
}
218+
// This is a const function, which _sometimes_ gets called,
219+
// so this lint is _sometimes_ triggered, depending on feature set.
220+
#[expect(clippy::allow_attributes)]
221+
#[allow(clippy::panic)]
218222
FunctionType::EntryPoint(_) => {
219223
panic!("External textures cannot be used as arguments to entry points")
220224
}

naga/src/back/msl/sampler.rs

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,15 @@ use serde::Deserialize;
55
#[cfg(feature = "serialize")]
66
use serde::Serialize;
77

8-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
8+
#[derive(Clone, Copy, Default, Debug, PartialEq, Eq, Hash)]
99
#[cfg_attr(feature = "serialize", derive(Serialize))]
1010
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
1111
pub enum Coord {
12+
#[default]
1213
Normalized,
1314
Pixel,
1415
}
1516

16-
impl Default for Coord {
17-
fn default() -> Self {
18-
Self::Normalized
19-
}
20-
}
21-
2217
impl Coord {
2318
pub const fn as_str(&self) -> &'static str {
2419
match *self {
@@ -28,23 +23,18 @@ impl Coord {
2823
}
2924
}
3025

31-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
26+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
3227
#[cfg_attr(feature = "serialize", derive(Serialize))]
3328
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
3429
pub enum Address {
3530
Repeat,
3631
MirroredRepeat,
32+
#[default]
3733
ClampToEdge,
3834
ClampToZero,
3935
ClampToBorder,
4036
}
4137

42-
impl Default for Address {
43-
fn default() -> Self {
44-
Self::ClampToEdge
45-
}
46-
}
47-
4838
impl Address {
4939
pub const fn as_str(&self) -> &'static str {
5040
match *self {
@@ -57,21 +47,16 @@ impl Address {
5747
}
5848
}
5949

60-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
50+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
6151
#[cfg_attr(feature = "serialize", derive(Serialize))]
6252
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
6353
pub enum BorderColor {
54+
#[default]
6455
TransparentBlack,
6556
OpaqueBlack,
6657
OpaqueWhite,
6758
}
6859

69-
impl Default for BorderColor {
70-
fn default() -> Self {
71-
Self::TransparentBlack
72-
}
73-
}
74-
7560
impl BorderColor {
7661
pub const fn as_str(&self) -> &'static str {
7762
match *self {
@@ -82,10 +67,11 @@ impl BorderColor {
8267
}
8368
}
8469

85-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
70+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
8671
#[cfg_attr(feature = "serialize", derive(Serialize))]
8772
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
8873
pub enum Filter {
74+
#[default]
8975
Nearest,
9076
Linear,
9177
}
@@ -99,16 +85,11 @@ impl Filter {
9985
}
10086
}
10187

102-
impl Default for Filter {
103-
fn default() -> Self {
104-
Self::Nearest
105-
}
106-
}
107-
108-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
88+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
10989
#[cfg_attr(feature = "serialize", derive(Serialize))]
11090
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
11191
pub enum CompareFunc {
92+
#[default]
11293
Never,
11394
Less,
11495
LessEqual,
@@ -119,12 +100,6 @@ pub enum CompareFunc {
119100
Always,
120101
}
121102

122-
impl Default for CompareFunc {
123-
fn default() -> Self {
124-
Self::Never
125-
}
126-
}
127-
128103
impl CompareFunc {
129104
pub const fn as_str(&self) -> &'static str {
130105
match *self {

naga/src/back/spv/helpers.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub(super) fn string_to_byte_chunks(input: &str, limit: usize) -> Vec<&[u8]> {
3434
let mut start: usize = 0;
3535
let mut words = vec![];
3636
while offset < input.len() {
37-
offset = input.floor_char_boundary(offset + limit);
37+
offset = input.floor_char_boundary_polyfill(offset + limit);
3838
// Clippy wants us to call as_bytes() first to avoid the UTF-8 check,
3939
// but we want to assert the output is valid UTF-8.
4040
#[allow(clippy::sliced_string_as_bytes)]
@@ -123,30 +123,31 @@ pub fn global_needs_wrapper(ir_module: &crate::Module, var: &crate::GlobalVariab
123123
}
124124

125125
///HACK: this is taken from std unstable, remove it when std's floor_char_boundary is stable
126+
/// and available in our msrv.
126127
trait U8Internal {
127-
fn is_utf8_char_boundary(&self) -> bool;
128+
fn is_utf8_char_boundary_polyfill(&self) -> bool;
128129
}
129130

130131
impl U8Internal for u8 {
131-
fn is_utf8_char_boundary(&self) -> bool {
132+
fn is_utf8_char_boundary_polyfill(&self) -> bool {
132133
// This is bit magic equivalent to: b < 128 || b >= 192
133134
(*self as i8) >= -0x40
134135
}
135136
}
136137

137138
trait StrUnstable {
138-
fn floor_char_boundary(&self, index: usize) -> usize;
139+
fn floor_char_boundary_polyfill(&self, index: usize) -> usize;
139140
}
140141

141142
impl StrUnstable for str {
142-
fn floor_char_boundary(&self, index: usize) -> usize {
143+
fn floor_char_boundary_polyfill(&self, index: usize) -> usize {
143144
if index >= self.len() {
144145
self.len()
145146
} else {
146147
let lower_bound = index.saturating_sub(3);
147148
let new_index = self.as_bytes()[lower_bound..=index]
148149
.iter()
149-
.rposition(|b| b.is_utf8_char_boundary());
150+
.rposition(|b| b.is_utf8_char_boundary_polyfill());
150151

151152
// SAFETY: we know that the character boundary will be within four bytes
152153
unsafe { lower_bound + new_index.unwrap_unchecked() }

naga/src/proc/overloads/list.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ impl crate::proc::overloads::OverloadSet for List {
162162
}
163163

164164
const fn len_to_full_mask(n: usize) -> u64 {
165+
// This is a const function, which _sometimes_ gets called,
166+
// so this lint is _sometimes_ triggered, depending on feature set.
167+
#[expect(clippy::allow_attributes)]
168+
#[allow(clippy::panic)]
165169
if n >= 64 {
166170
panic!("List::rules can only hold up to 63 rules");
167171
}

0 commit comments

Comments
 (0)