Bump REPO_MSRV to 1.88 (#7960)

This commit is contained in:
Connor Fitzgerald 2025-07-17 13:00:40 -04:00 committed by GitHub
parent 33b9f86cc4
commit ff0de91ad7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
115 changed files with 314 additions and 397 deletions

View File

@ -25,7 +25,7 @@ env:
MESA_VERSION: "24.3.4"
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
REPO_MSRV: "1.84"
REPO_MSRV: "1.88"
# This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates,
# to ensure that they can be used with firefox.
CORE_MSRV: "1.82.0"

View File

@ -11,7 +11,7 @@ env:
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
MSRV: "1.84"
MSRV: "1.88"
jobs:
cts:

View File

@ -10,7 +10,7 @@ on:
env:
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
REPO_MSRV: "1.84"
REPO_MSRV: "1.88"
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always

View File

@ -13,7 +13,7 @@ env:
#
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
REPO_MSRV: "1.84"
REPO_MSRV: "1.88"
RUSTFLAGS: -D warnings
jobs:

View File

@ -54,7 +54,7 @@ ref_as_ptr = "warn"
[workspace.package]
edition = "2021"
rust-version = "1.84"
rust-version = "1.88"
keywords = ["graphics"]
license = "MIT OR Apache-2.0"
homepage = "https://wgpu.rs/"
@ -178,7 +178,7 @@ rustc-hash = { version = "1.1", default-features = false }
serde_json = "1.0.118"
serde = { version = "1.0.219", default-features = false }
shell-words = "1"
smallvec = "1.9"
smallvec = "1.13.1"
spirv = "0.3"
static_assertions = "1.1"
strum = { version = "0.27", default-features = false, features = ["derive"] }

View File

@ -149,8 +149,8 @@ On Linux, you can point to them using `LD_LIBRARY_PATH` environment.
Due to complex dependants, we have two MSRV policies:
- `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.76**.
- The rest of the workspace has an MSRV of **1.84**.
- `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.82**.
- The rest of the workspace has an MSRV of **1.88**.
It is enforced on CI (in "/.github/workflows/ci.yml") with the `CORE_MSRV` and `REPO_MSRV` variables.
This version can only be upgraded in breaking releases, though we release a breaking version every three months.

View File

@ -87,7 +87,7 @@ fn run_bench(ctx: &mut Criterion) {
for &count in count_list {
group.throughput(Throughput::Elements(count as u64));
group.bench_with_input(
format!("{} Element Bind Group", count),
format!("{count} Element Bind Group"),
&count,
|b, &count| {
b.iter_custom(|iters| {

View File

@ -3,6 +3,4 @@
disallowed-types = [
{ path = "std::collections::HashMap", reason = "use hashbrown::HashMap instead" },
{ path = "std::collections::HashSet", reason = "use hashbrown::HashSet instead" },
{ path = "rustc_hash::FxHashMap", reason = "use hashbrown::HashMap instead" },
{ path = "rustc_hash::FxHashSet", reason = "use hashbrown::HashSet instead" },
]

View File

@ -68,7 +68,7 @@ webgpu:api,operation,rendering,color_target_state:blend_constant,setting:*
webgpu:api,operation,rendering,depth:*
webgpu:api,operation,rendering,draw:*
webgpu:api,operation,shader_module,compilation_info:*
webgpu:api,operation,uncapturederror:iff_uncaptured:*
fails-if(metal) webgpu:api,operation,uncapturederror:iff_uncaptured:*
//FAIL: webgpu:shader,execution,expression,call,builtin,select:*
// - Fails with `const`/abstract int cases on all platforms because of <https://github.com/gfx-rs/wgpu/issues/4507>.
// - Fails with `vec3` & `f16` cases on macOS because of <https://github.com/gfx-rs/wgpu/issues/5262>.

View File

@ -193,7 +193,7 @@ fn create_storage_buffers(device: &wgpu::Device, numbers: &[f32]) -> Vec<wgpu::B
.enumerate()
.map(|(e, seg)| {
device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some(&format!("Storage Buffer-{}", e)),
label: Some(&format!("Storage Buffer-{e}")),
contents: bytemuck::cast_slice(seg),
usage: wgpu::BufferUsages::STORAGE
| wgpu::BufferUsages::COPY_DST
@ -211,7 +211,7 @@ fn create_staging_buffers(device: &wgpu::Device, numbers: &[f32]) -> Vec<wgpu::B
let size = std::mem::size_of_val(chunks[e]) as u64;
device.create_buffer(&wgpu::BufferDescriptor {
label: Some(&format!("staging buffer-{}", e)),
label: Some(&format!("staging buffer-{e}")),
size,
usage: wgpu::BufferUsages::MAP_READ | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,

View File

@ -328,7 +328,7 @@ impl FrameCounter {
let elapsed_ms = elapsed_secs * 1000.0;
let frame_time = elapsed_ms / self.frame_count as f32;
let fps = self.frame_count as f32 / elapsed_secs;
log::info!("Frame time {:.2}ms ({:.1} FPS)", frame_time, fps);
log::info!("Frame time {frame_time:.2}ms ({fps:.1} FPS)");
self.last_printed_instant = new_instant;
self.frame_count = 0;

View File

@ -28,13 +28,13 @@ async fn run() {
} = execute(&device, &queue, ARR_SIZE).await;
// Print data
log::info!("Patient results: {:?}", patient_workgroup_results);
log::info!("Patient results: {patient_workgroup_results:?}");
if !patient_workgroup_results.iter().any(|e| *e != 16) {
log::info!("patient_main was patient.");
} else {
log::error!("patient_main was not patient!");
}
log::info!("Hasty results: {:?}", hasty_workgroup_results);
log::info!("Hasty results: {hasty_workgroup_results:?}");
if hasty_workgroup_results.iter().any(|e| *e != 16) {
log::info!("hasty_main was not patient.");
} else {

View File

@ -47,7 +47,7 @@ impl Example {
vertex_buffer: &wgpu::Buffer,
vertex_count: u32,
) -> wgpu::RenderBundle {
log::info!("sample_count: {}", sample_count);
log::info!("sample_count: {sample_count}");
let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: None,
layout: Some(pipeline_layout),

View File

@ -114,7 +114,7 @@ impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
inner.poll(cx).map(|error| {
if let Some(e) = error {
panic!("Rendering {}", e);
panic!("Rendering {e}");
}
})
}

View File

@ -89,7 +89,7 @@ impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
inner.poll(cx).map(|error| {
if let Some(e) = error {
panic!("Rendering {}", e);
panic!("Rendering {e}");
}
})
}

View File

@ -113,7 +113,7 @@ impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
inner.poll(cx).map(|error| {
if let Some(e) = error {
panic!("Rendering {}", e);
panic!("Rendering {e}");
}
})
}

View File

@ -41,7 +41,7 @@ impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
inner.poll(cx).map(|error| {
if let Some(e) = error {
panic!("Rendering {}", e);
panic!("Rendering {e}");
}
})
}
@ -93,7 +93,7 @@ struct Material {
fn load_model(scene: &mut RawSceneComponents, path: &str) {
let path = env!("CARGO_MANIFEST_DIR").to_string() + "/src" + path;
println!("{}", path);
println!("{path}");
let mut object = obj::Obj::load(path).unwrap();
object.load_mtls().unwrap();

View File

@ -68,7 +68,7 @@ impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
inner.poll(cx).map(|error| {
if let Some(e) = error {
panic!("Rendering {}", e);
panic!("Rendering {e}");
}
})
}

View File

@ -299,11 +299,7 @@ impl crate::framework::Example for Example {
let max_mips = layer_size.max_mips(wgpu::TextureDimension::D2);
log::debug!(
"Copying {:?} skybox images of size {}, {}, 6 with {} mips to gpu",
skybox_format,
IMAGE_SIZE,
IMAGE_SIZE,
max_mips,
"Copying {skybox_format:?} skybox images of size {IMAGE_SIZE}, {IMAGE_SIZE}, 6 with {max_mips} mips to gpu",
);
let bytes = match skybox_format {

View File

@ -37,7 +37,7 @@ pub fn output_image_native(image_data: Vec<u8>, texture_dims: (usize, usize), pa
let mut file = std::fs::File::create(&path).unwrap();
file.write_all(&png_data[..]).unwrap();
log::info!("PNG file written to disc as \"{}\".", path);
log::info!("PNG file written to disc as \"{path}\".");
}
/// Effectively a version of `output_image_native` but meant for web browser contexts.
@ -58,9 +58,8 @@ pub fn output_image_wasm(image_data: Vec<u8>, texture_dims: (usize, usize)) {
Err(e) => {
log::error!(
"In searching for a staging canvas for outputting an image \
(element with id \"staging-canvas\"), found non-canvas element: {:?}.
Replacing with standard staging canvas.",
e
(element with id \"staging-canvas\"), found non-canvas element: {e:?}.
Replacing with standard staging canvas."
);
e.remove();
create_staging_canvas(&document)
@ -101,9 +100,8 @@ pub fn output_image_wasm(image_data: Vec<u8>, texture_dims: (usize, usize)) {
Ok(e) => e,
Err(e) => {
log::error!(
"Found an element with the id \"output-image-target\" but it was not an image: {:?}.
"Found an element with the id \"output-image-target\" but it was not an image: {e:?}.
Replacing with default image output element.",
e
);
e.remove();
create_output_image_element(&document)

View File

@ -1,7 +1,7 @@
[package]
name = "wgpu-example-01-hello-compute"
edition = "2021"
rust-version = "1.84"
rust-version = "1.88"
publish = false
[dependencies]

View File

@ -249,5 +249,5 @@ fn main() {
let result: &[f32] = bytemuck::cast_slice(&data);
// Print out the result.
println!("Result: {:?}", result);
println!("Result: {result:?}");
}

View File

@ -1,7 +1,7 @@
[package]
name = "wgpu-example-02-hello-window"
edition = "2021"
rust-version = "1.84"
rust-version = "1.88"
publish = false
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "wgpu-example-custom-backend"
edition = "2021"
rust-version = "1.84"
rust-version = "1.88"
publish = false
[features]

View File

@ -740,7 +740,7 @@ fn write_function_expressions(
E::RayQueryVertexPositions { query, committed } => {
edges.insert("", query);
let ty = if committed { "Committed" } else { "Candidate" };
(format!("get{}HitVertexPositions", ty).into(), 4)
(format!("get{ty}HitVertexPositions").into(), 4)
}
};

View File

@ -1238,7 +1238,7 @@ impl<'a, W: Write> Writer<'a, W> {
write!(self.out, "layout(")?;
if let Some(layout) = layout {
write!(self.out, "{}, ", layout)?;
write!(self.out, "{layout}, ")?;
}
write!(self.out, "binding = {binding}) ")?;
@ -1255,7 +1255,7 @@ impl<'a, W: Write> Writer<'a, W> {
// Either no explicit bindings are supported or we didn't have any.
// Write just the memory layout.
if let Some(layout) = layout {
write!(self.out, "layout({}) ", layout)?;
write!(self.out, "layout({layout}) ")?;
}
Ok(())
@ -3698,11 +3698,11 @@ impl<'a, W: Write> Writer<'a, W> {
// `Dot4U8Packed`, the code below only introduces parenthesis around
// each factor, which aren't strictly needed because both operands are
// baked, but which don't hurt either.
write!(self.out, "bitfieldExtract({}(", conversion)?;
write!(self.out, "bitfieldExtract({conversion}(")?;
self.write_expr(arg, ctx)?;
write!(self.out, "), {}, 8)", i * 8)?;
write!(self.out, " * bitfieldExtract({}(", conversion)?;
write!(self.out, " * bitfieldExtract({conversion}(")?;
self.write_expr(arg1, ctx)?;
write!(self.out, "), {}, 8)", i * 8)?;

View File

@ -317,7 +317,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
}
for (group, bt) in self.options.dynamic_storage_buffer_offsets_targets.iter() {
writeln!(self.out, "struct __dynamic_buffer_offsetsTy{} {{", group)?;
writeln!(self.out, "struct __dynamic_buffer_offsetsTy{group} {{")?;
for i in 0..bt.size {
writeln!(self.out, "{}uint _{};", back::INDENT, i)?;
}
@ -706,7 +706,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
let members = match module.types[result.ty].inner {
TypeInner::Struct { ref members, .. } => members,
ref other => {
log::error!("Unexpected {:?} output type without a binding", other);
log::error!("Unexpected {other:?} output type without a binding");
&empty[..]
}
};
@ -1433,7 +1433,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
let array_return_type = self.namer.call(&format!("ret_{name}"));
write!(self.out, "typedef ")?;
self.write_type(module, result.ty)?;
write!(self.out, " {}", array_return_type)?;
write!(self.out, " {array_return_type}")?;
self.write_array_size(module, base, size)?;
writeln!(self.out, ";")?;
Some(array_return_type)

View File

@ -1150,7 +1150,7 @@ impl<W: Write> Writer<W> {
//TODO: do we support Zero on `Sampled` image classes?
}
_ if !has_levels => {
log::warn!("1D image can't be sampled with level {:?}", level);
log::warn!("1D image can't be sampled with level {level:?}");
}
crate::SampleLevel::Exact(h) => {
write!(self.out, ", {NAMESPACE}::level(")?;
@ -1397,7 +1397,7 @@ impl<W: Write> Writer<W> {
} else {
fun.to_msl()
};
write!(self.out, ".atomic_{}(", op)?;
write!(self.out, ".atomic_{op}(")?;
// coordinates in IR are int, but Metal expects uint
self.put_cast_to_uint_scalar_or_vector(address.coordinate, &context.expression)?;
write!(self.out, ", ")?;
@ -2352,7 +2352,7 @@ impl<W: Write> Writer<W> {
arg1.unwrap(),
4,
|writer, arg, index| {
write!(writer.out, "({}(", conversion)?;
write!(writer.out, "({conversion}(")?;
writer.put_expression(arg, context, true)?;
if index == 3 {
write!(writer.out, ") >> 24)")?;
@ -3420,7 +3420,7 @@ impl<W: Write> Writer<W> {
put_numeric_type(&mut self.out, scalar, &[rows, columns])?;
}
TypeResolution::Value(ref other) => {
log::warn!("Type {:?} isn't a known local", other); //TEMP!
log::warn!("Type {other:?} isn't a known local"); //TEMP!
return Err(Error::FeatureNotImplemented("weird local type".to_string()));
}
}

View File

@ -675,7 +675,7 @@ impl BlockContext<'_> {
load_id
}
ref other => {
log::error!("Unable to access index of {:?}", other);
log::error!("Unable to access index of {other:?}");
return Err(Error::FeatureNotImplemented("access index for type"));
}
}
@ -1893,7 +1893,7 @@ impl BlockContext<'_> {
crate::TypeInner::Scalar(scalar) => (scalar, None),
crate::TypeInner::Vector { scalar, size } => (scalar, Some(size)),
ref other => {
log::error!("As source {:?}", other);
log::error!("As source {other:?}");
return Err(Error::Validation("Unexpected Expression::As source"));
}
};

View File

@ -35,6 +35,9 @@ pub(super) fn string_to_byte_chunks(input: &str, limit: usize) -> Vec<&[u8]> {
let mut words = vec![];
while offset < input.len() {
offset = input.floor_char_boundary(offset + limit);
// Clippy wants us to call as_bytes() first to avoid the UTF-8 check,
// but we want to assert the output is valid UTF-8.
#[allow(clippy::sliced_string_as_bytes)]
words.push(input[start..offset].as_bytes());
start = offset;
}

View File

@ -303,7 +303,7 @@ impl BlockContext<'_> {
return Err(Error::Validation("extending vec4 coordinate"));
}
ref other => {
log::error!("wrong coordinate type {:?}", other);
log::error!("wrong coordinate type {other:?}");
return Err(Error::Validation("coordinate type"));
}
};

View File

@ -277,7 +277,7 @@ impl BlockContext<'_> {
Ok(MaybeKnown::Computed(length_id))
}
Err(err) => {
log::error!("Sequence length for {:?} failed: {}", sequence, err);
log::error!("Sequence length for {sequence:?} failed: {err}");
Err(Error::Validation("indexable length"))
}
}

View File

@ -337,7 +337,7 @@ where
} => {
let (address, maybe_access) = address_space_str(space);
if let Some(space) = address {
write!(out, "ptr<{}, ", space)?;
write!(out, "ptr<{space}, ")?;
ctx.write_scalar(scalar, out)?;
if let Some(access) = maybe_access {
write!(out, ", {access}")?;
@ -368,14 +368,14 @@ where
}
TypeInner::AccelerationStructure { vertex_return } => {
let caps = if vertex_return { "<vertex_return>" } else { "" };
write!(out, "acceleration_structure{}", caps)?
write!(out, "acceleration_structure{caps}")?
}
TypeInner::Struct { .. } => {
ctx.write_unnamed_struct(inner, out)?;
}
TypeInner::RayQuery { vertex_return } => {
let caps = if vertex_return { "<vertex_return>" } else { "" };
write!(out, "ray_query{}", caps)?
write!(out, "ray_query{caps}")?
}
}

View File

@ -68,7 +68,7 @@ impl ExpressionTracer<'_> {
continue;
}
log::trace!("tracing new expression {:?}", expr);
log::trace!("tracing new expression {expr:?}");
self.trace_expression(expr);
}
}

View File

@ -37,7 +37,7 @@ impl<T, U> HandleMap<T, U> {
if self.new_index.len() <= handle.index() {
self.new_index.resize_with(handle.index() + 1, || None);
}
core::mem::replace(&mut self.new_index[handle.index()], Some(value))
self.new_index[handle.index()].replace(value)
}
}

View File

@ -164,7 +164,7 @@ pub fn compact(module: &mut crate::Module, keep_unused: KeepUnused) {
}
while let Some(handle) = module_tracer.functions_pending.pop() {
let function = &module.functions[handle];
log::trace!("tracing function {:?}", function);
log::trace!("tracing function {function:?}");
let mut function_tracer = module_tracer.as_function(function);
function_tracer.trace();
function_maps.insert(handle, FunctionMap::from(function_tracer));
@ -680,7 +680,7 @@ fn type_expression_interdependence() {
};
let mut type_name_counter = 0;
let mut type_needed = |module: &mut crate::Module, handle| {
let name = Some(format!("type{}", type_name_counter));
let name = Some(format!("type{type_name_counter}"));
type_name_counter += 1;
module.types.insert(
crate::Type {
@ -696,7 +696,7 @@ fn type_expression_interdependence() {
};
let mut override_name_counter = 0;
let mut expression_needed = |module: &mut crate::Module, handle| {
let name = Some(format!("override{}", override_name_counter));
let name = Some(format!("override{override_name_counter}"));
override_name_counter += 1;
module.overrides.append(
crate::Override {

View File

@ -56,7 +56,7 @@ impl fmt::Display for ShaderError<crate::WithSpan<crate::valid::ValidationError>
writer.into_string()
};
write!(f, "\nShader validation {}", writer)
write!(f, "\nShader validation {writer}")
}
}

View File

@ -541,7 +541,7 @@ impl<'a> Context<'a> {
) -> Result<(Option<Handle<Expression>>, Span)> {
let HirExpr { ref kind, meta } = stmt.hir_exprs[expr];
log::debug!("Lowering {:?} (kind {:?}, pos {:?})", expr, kind, pos);
log::debug!("Lowering {expr:?} (kind {kind:?}, pos {pos:?})");
let handle = match *kind {
HirExprKind::Access { base, index } => {
@ -636,8 +636,7 @@ impl<'a> Context<'a> {
frontend.errors.push(Error {
kind: ErrorKind::SemanticError(
format!(
"Cannot apply operation to {:?} and {:?}",
left_inner, right_inner
"Cannot apply operation to {left_inner:?} and {right_inner:?}"
)
.into(),
),
@ -835,8 +834,7 @@ impl<'a> Context<'a> {
frontend.errors.push(Error {
kind: ErrorKind::SemanticError(
format!(
"Cannot apply operation to {:?} and {:?}",
left_inner, right_inner
"Cannot apply operation to {left_inner:?} and {right_inner:?}"
)
.into(),
),
@ -916,8 +914,7 @@ impl<'a> Context<'a> {
frontend.errors.push(Error {
kind: ErrorKind::SemanticError(
format!(
"Cannot apply operation to {:?} and {:?}",
left_inner, right_inner
"Cannot apply operation to {left_inner:?} and {right_inner:?}"
)
.into(),
),
@ -1339,13 +1336,7 @@ impl<'a> Context<'a> {
}
};
log::trace!(
"Lowered {:?}\n\tKind = {:?}\n\tPos = {:?}\n\tResult = {:?}",
expr,
kind,
pos,
handle
);
log::trace!("Lowered {expr:?}\n\tKind = {kind:?}\n\tPos = {pos:?}\n\tResult = {handle:?}");
Ok((Some(handle), meta))
}

View File

@ -560,7 +560,7 @@ impl Frontend {
continue;
}
log::trace!("Testing overload {}", overload_idx);
log::trace!("Testing overload {overload_idx}");
// Stores whether the current overload matches exactly the function call
let mut exact = true;
@ -592,10 +592,7 @@ impl Frontend {
let call_arg_ty = ctx.get_type(call_argument.0);
log::trace!(
"Testing parameter {}\n\tOverload = {:?}\n\tCall = {:?}",
i,
overload_param_ty,
call_arg_ty
"Testing parameter {i}\n\tOverload = {overload_param_ty:?}\n\tCall = {call_arg_ty:?}"
);
// Storage images cannot be directly compared since while the access is part of the
@ -641,8 +638,7 @@ impl Frontend {
self.errors.push(Error {
kind: ErrorKind::SemanticError(
format!(
"'{}': image needs {:?} access but only {:?} was provided",
name, overload_access, call_access
"'{name}': image needs {overload_access:?} access but only {call_access:?} was provided"
)
.into(),
),

View File

@ -114,7 +114,7 @@ impl Typifier {
for (eh, expr) in expressions.iter().skip(self.resolutions.len()) {
//Note: the closure can't `Err` by construction
let resolution = ctx.resolve(expr, |h| Ok(&self.resolutions[h]))?;
log::debug!("Resolving {:?} = {:?} : {:?}", eh, expr, resolution);
log::debug!("Resolving {eh:?} = {expr:?} : {resolution:?}");
self.resolutions.insert(eh, resolution);
}
}

View File

@ -167,7 +167,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
if let Some(ref prefix) = self.options.block_ctx_dump_prefix {
let dump_suffix = match self.lookup_entry_point.get(&fun_id) {
Some(ep) => format!("block_ctx.{:?}-{}.txt", ep.stage, ep.name),
None => format!("block_ctx.Fun-{}.txt", function_index),
None => format!("block_ctx.Fun-{function_index}.txt"),
};
cfg_if::cfg_if! {
@ -176,10 +176,10 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
let dest = prefix.join(dump_suffix);
let dump = format!("{block_ctx:#?}");
if let Err(e) = std::fs::write(&dest, dump) {
log::error!("Unable to dump the block context into {:?}: {}", dest, e);
log::error!("Unable to dump the block context into {dest:?}: {e}");
}
} else {
log::error!("Unable to dump the block context into {:?}/{}: file system integration was not enabled with the `fs` feature", prefix, dump_suffix);
log::error!("Unable to dump the block context into {prefix:?}/{dump_suffix}: file system integration was not enabled with the `fs` feature");
}
}
}
@ -191,7 +191,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
// to get the spill.
for phi in block_ctx.phis.iter() {
// Get a pointer to the local variable for the phi's value.
let phi_pointer = block_ctx.expressions.append(
let phi_pointer: Handle<crate::Expression> = block_ctx.expressions.append(
crate::Expression::LocalVariable(phi.local),
crate::Span::default(),
);

View File

@ -202,7 +202,7 @@ pub(super) fn patch_comparison_type(
return false;
}
log::debug!("Flipping comparison for {:?}", var);
log::debug!("Flipping comparison for {var:?}");
let original_ty = &arena[var.ty];
let original_ty_span = arena.get_span(var.ty);
let ty_inner = match original_ty.inner {
@ -279,7 +279,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
if image_ops != 0 {
let other = spirv::ImageOperands::from_bits_truncate(image_ops);
log::warn!("Unknown image write ops {:?}", other);
log::warn!("Unknown image write ops {other:?}");
for _ in 1..words_left {
self.next()?;
}
@ -403,7 +403,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
words_left -= 1;
}
other => {
log::warn!("Unknown image load op {:?}", other);
log::warn!("Unknown image load op {other:?}");
for _ in 0..words_left {
self.next()?;
}
@ -546,12 +546,11 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
};
level = if options.compare {
log::debug!("Assuming {:?} is zero", lod_handle);
log::debug!("Assuming {lod_handle:?} is zero");
crate::SampleLevel::Zero
} else if is_depth_image {
log::debug!(
"Assuming level {:?} converts losslessly to an integer",
lod_handle
"Assuming level {lod_handle:?} converts losslessly to an integer"
);
let expr = crate::Expression::As {
expr: lod_handle,
@ -588,9 +587,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
);
level = if options.compare {
log::debug!(
"Assuming gradients {:?} and {:?} are not greater than 1",
grad_x_handle,
grad_y_handle
"Assuming gradients {grad_x_handle:?} and {grad_y_handle:?} are not greater than 1"
);
crate::SampleLevel::Zero
} else {
@ -616,7 +613,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
words_left -= 1;
}
other => {
log::warn!("Unknown image sample operand {:?}", other);
log::warn!("Unknown image sample operand {other:?}");
for _ in 0..words_left {
self.next()?;
}

View File

@ -515,7 +515,6 @@ enum MergeBlockInformation {
/// [`blocks`]: BlockContext::blocks
/// [`bodies`]: BlockContext::bodies
/// [`phis`]: BlockContext::phis
/// [`lower`]: function::lower
#[derive(Debug)]
struct BlockContext<'function> {
/// Phi nodes encountered when parsing the function, used to generate spills
@ -796,7 +795,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
dec.specialization_constant_id = Some(self.next()?);
}
other => {
log::warn!("Unknown decoration {:?}", other);
log::warn!("Unknown decoration {other:?}");
for _ in base_words + 1..inst.wc {
let _var = self.next()?;
}
@ -1387,7 +1386,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
block: &mut crate::Block,
body_idx: usize,
) -> Result<(Handle<crate::Expression>, Handle<crate::Type>), Error> {
log::trace!("\t\t\tlooking up pointer expr {:?}", pointer_id);
log::trace!("\t\t\tlooking up pointer expr {pointer_id:?}");
let p_lexp_handle;
let p_lexp_ty_id;
{
@ -1600,7 +1599,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
.remove(&result_id)
.and_then(|decor| decor.name);
if let Some(ref name) = name {
log::debug!("\t\t\tid={} name={}", result_id, name);
log::debug!("\t\t\tid={result_id} name={name}");
}
let lookup_ty = self.lookup_type.lookup(result_type_id)?;
let var_handle = ctx.local_arena.append(
@ -1686,7 +1685,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
let result_type_id = self.next()?;
let result_id = self.next()?;
let base_id = self.next()?;
log::trace!("\t\t\tlooking up expr {:?}", base_id);
log::trace!("\t\t\tlooking up expr {base_id:?}");
let mut acex = {
let lexp = self.lookup_expression.lookup(base_id)?;
@ -1721,7 +1720,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
for _ in 4..inst.wc {
let access_id = self.next()?;
log::trace!("\t\t\tlooking up index expr {:?}", access_id);
log::trace!("\t\t\tlooking up index expr {access_id:?}");
let index_expr = self.lookup_expression.lookup(access_id)?.clone();
let index_expr_handle = get_expr_handle!(access_id, &index_expr);
let index_expr_data = &ctx.expressions[index_expr.handle];
@ -2064,7 +2063,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
let result_type_id = self.next()?;
let result_id = self.next()?;
let base_id = self.next()?;
log::trace!("\t\t\tlooking up expr {:?}", base_id);
log::trace!("\t\t\tlooking up expr {base_id:?}");
let mut lexp = self.lookup_expression.lookup(base_id)?.clone();
lexp.handle = get_expr_handle!(base_id, &lexp);
for _ in 4..inst.wc {
@ -2084,7 +2083,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
.base_id
.ok_or(Error::InvalidAccessType(lexp.type_id))?,
ref other => {
log::warn!("composite type {:?}", other);
log::warn!("composite type {other:?}");
return Err(Error::UnsupportedType(type_lookup.handle));
}
};
@ -2153,7 +2152,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
let mut components = Vec::with_capacity(inst.wc as usize - 2);
for _ in 3..inst.wc {
let comp_id = self.next()?;
log::trace!("\t\t\tlooking up expr {:?}", comp_id);
log::trace!("\t\t\tlooking up expr {comp_id:?}");
let lexp = self.lookup_expression.lookup(comp_id)?;
let handle = get_expr_handle!(comp_id, lexp);
components.push(handle);
@ -3872,7 +3871,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
);
block.push(crate::Statement::ControlBarrier(flags), span);
} else {
log::warn!("Unsupported barrier execution scope: {}", exec_scope);
log::warn!("Unsupported barrier execution scope: {exec_scope}");
}
}
Op::MemoryBarrier => {
@ -4244,7 +4243,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
let _memory_semantics_id = self.next()?;
let span = self.span_from_with_op(start);
log::trace!("\t\t\tlooking up expr {:?}", pointer_id);
log::trace!("\t\t\tlooking up expr {pointer_id:?}");
let p_lexp_handle =
get_expr_handle!(pointer_id, self.lookup_expression.lookup(pointer_id)?);
@ -4274,11 +4273,11 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
let value_id = self.next()?;
let span = self.span_from_with_op(start);
log::trace!("\t\t\tlooking up pointer expr {:?}", pointer_id);
log::trace!("\t\t\tlooking up pointer expr {pointer_id:?}");
let p_lexp_handle =
get_expr_handle!(pointer_id, self.lookup_expression.lookup(pointer_id)?);
log::trace!("\t\t\tlooking up value expr {:?}", pointer_id);
log::trace!("\t\t\tlooking up value expr {pointer_id:?}");
let v_lexp_handle =
get_expr_handle!(value_id, self.lookup_expression.lookup(value_id)?);
@ -4380,11 +4379,11 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
body_idx,
)?;
log::trace!("\t\t\tlooking up value expr {:?}", value_id);
log::trace!("\t\t\tlooking up value expr {value_id:?}");
let v_lexp_handle =
get_expr_handle!(value_id, self.lookup_expression.lookup(value_id)?);
log::trace!("\t\t\tlooking up comparator expr {:?}", value_id);
log::trace!("\t\t\tlooking up comparator expr {value_id:?}");
let c_lexp_handle = get_expr_handle!(
comparator_id,
self.lookup_expression.lookup(comparator_id)?
@ -4699,7 +4698,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
let generator = self.next()?;
let _bound = self.next()?;
let _schema = self.next()?;
log::info!("Generated by {} version {:x}", generator, version_raw);
log::info!("Generated by {generator} version {version_raw:x}");
crate::Module::default()
};
@ -4840,7 +4839,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
if self.options.strict_capabilities {
return Err(Error::UnsupportedCapability(cap));
} else {
log::warn!("Unknown capability {:?}", cap);
log::warn!("Unknown capability {cap:?}");
}
}
Ok(())
@ -6030,7 +6029,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
) {
Ok(handle) => Some(handle),
Err(e) => {
log::warn!("Failed to initialize output built-in: {}", e);
log::warn!("Failed to initialize output built-in: {e}");
None
}
}
@ -6077,7 +6076,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
let handle = module.global_variables.append(var, span);
if module.types[ty].inner.can_comparison_sample(module) {
log::debug!("\t\ttracking {:?} for sampling properties", handle);
log::debug!("\t\ttracking {handle:?} for sampling properties");
self.handle_sampling
.insert(handle, image::SamplingFlags::empty());

View File

@ -690,7 +690,7 @@ impl<'a> Error<'a> {
notes: vec![],
},
Error::UnknownEnableExtension(span, word) => ParseError {
message: format!("unknown enable-extension `{}`", word),
message: format!("unknown enable-extension `{word}`"),
labels: vec![(span, "".into())],
notes: vec![
"See available extensions at <https://www.w3.org/TR/WGSL/#enable-extension>."
@ -1078,8 +1078,7 @@ impl<'a> Error<'a> {
} = **error;
ParseError {
message: format!(
"automatic conversions cannot convert `{}` to `{}`",
source_type, dest_type
"automatic conversions cannot convert `{source_type}` to `{dest_type}`"
),
labels: vec![
(
@ -1103,15 +1102,13 @@ impl<'a> Error<'a> {
} = **error;
ParseError {
message: format!(
"automatic conversions cannot convert elements of `{}` to `{}`",
source_type, dest_scalar
"automatic conversions cannot convert elements of `{source_type}` to `{dest_scalar}`"
),
labels: vec![
(
dest_span,
format!(
"a value with elements of type {} is required here",
dest_scalar
"a value with elements of type {dest_scalar} is required here"
)
.into(),
),

View File

@ -3400,12 +3400,12 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
ir::TypeInner::Pointer { base, .. } => match ctx.module.types[base].inner {
ir::TypeInner::Atomic(scalar) => Ok((pointer, scalar)),
ref other => {
log::error!("Pointer type to {:?} passed to atomic op", other);
log::error!("Pointer type to {other:?} passed to atomic op");
Err(Box::new(Error::InvalidAtomicPointer(span)))
}
},
ref other => {
log::error!("Type {:?} passed to atomic op", other);
log::error!("Type {other:?} passed to atomic op");
Err(Box::new(Error::InvalidAtomicPointer(span)))
}
}
@ -4034,12 +4034,12 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
ir::TypeInner::Pointer { base, .. } => match ctx.module.types[base].inner {
ir::TypeInner::RayQuery { .. } => Ok(pointer),
ref other => {
log::error!("Pointer type to {:?} passed to ray query op", other);
log::error!("Pointer type to {other:?} passed to ray query op");
Err(Box::new(Error::InvalidRayQueryPointer(span)))
}
},
ref other => {
log::error!("Type {:?} passed to ray query op", other);
log::error!("Type {other:?} passed to ray query op");
Err(Box::new(Error::InvalidRayQueryPointer(span)))
}
}

View File

@ -75,7 +75,8 @@ void main() {
clippy::derive_partial_eq_without_eq,
clippy::needless_borrowed_reference,
clippy::single_match,
clippy::enum_variant_names
clippy::enum_variant_names,
clippy::result_large_err
)]
#![warn(
trivial_casts,

View File

@ -844,7 +844,7 @@ impl<'a> ConstantEvaluator<'a> {
expr: &Expression,
span: Span,
) -> Result<Handle<Expression>, ConstantEvaluatorError> {
log::trace!("try_eval_and_append: {:?}", expr);
log::trace!("try_eval_and_append: {expr:?}");
match *expr {
Expression::Constant(c) if self.is_global_arena() => {
// "See through" the constant and use its initializer.
@ -2816,11 +2816,11 @@ fn first_leading_bit_smoke() {
trait TryFromAbstract<T>: Sized {
/// Convert an abstract literal `value` to `Self`.
///
/// Since Naga's `AbstractInt` and `AbstractFloat` exist to support
/// Since Naga's [`AbstractInt`] and [`AbstractFloat`] exist to support
/// WGSL, we follow WGSL's conversion rules here:
///
/// - WGSL §6.1.2. Conversion Rank says that automatic conversions
/// from `AbstractInt` to an integer type are either lossless or an
/// from [`AbstractInt`] to an integer type are either lossless or an
/// error.
///
/// - WGSL §15.7.6 Floating Point Conversion says that conversions
@ -2834,7 +2834,7 @@ trait TryFromAbstract<T>: Sized {
/// conversion from AbstractFloat to integer types.
///
/// [`AbstractInt`]: crate::Literal::AbstractInt
/// [`Float`]: crate::Literal::Float
/// [`AbstractFloat`]: crate::Literal::AbstractFloat
fn try_from_abstract(value: T) -> Result<Self, ConstantEvaluatorError>;
}

View File

@ -99,8 +99,8 @@ pub struct BoundsCheckPolicies {
///
/// [`GlobalVariable`]: crate::GlobalVariable
/// [`space`]: crate::GlobalVariable::space
/// [`Restrict`]: crate::back::BoundsCheckPolicy::Restrict
/// [`ReadZeroSkipWrite`]: crate::back::BoundsCheckPolicy::ReadZeroSkipWrite
/// [`Restrict`]: crate::proc::BoundsCheckPolicy::Restrict
/// [`ReadZeroSkipWrite`]: crate::proc::BoundsCheckPolicy::ReadZeroSkipWrite
/// [`Access`]: crate::Expression::Access
/// [`AccessIndex`]: crate::Expression::AccessIndex
/// [`Storage`]: crate::AddressSpace::Storage

View File

@ -195,7 +195,7 @@ fn make_rule(
let inner = size.to_inner(scalar);
let arg = TypeResolution::Value(inner.clone());
Rule {
arguments: core::iter::repeat(arg.clone()).take(arity).collect(),
arguments: core::iter::repeat_n(arg.clone(), arity).collect(),
conclusion: conclusion_rule.conclude(size, scalar),
}
}

View File

@ -296,7 +296,7 @@ impl<'a> ResolveContext<'a> {
},
Ti::BindingArray { base, .. } => Ti::Pointer { base, space },
ref other => {
log::error!("Access sub-type {:?}", other);
log::error!("Access sub-type {other:?}");
return Err(ResolveError::InvalidSubAccess {
ty: base,
indexed: false,
@ -306,7 +306,7 @@ impl<'a> ResolveContext<'a> {
}
Ti::BindingArray { base, .. } => TypeResolution::Handle(base),
ref other => {
log::error!("Access type {:?}", other);
log::error!("Access type {other:?}");
return Err(ResolveError::InvalidAccess {
expr: base,
indexed: false,
@ -392,7 +392,7 @@ impl<'a> ResolveContext<'a> {
}
Ti::BindingArray { base, .. } => Ti::Pointer { base, space },
ref other => {
log::error!("Access index sub-type {:?}", other);
log::error!("Access index sub-type {other:?}");
return Err(ResolveError::InvalidSubAccess {
ty: ty_base,
indexed: true,
@ -401,7 +401,7 @@ impl<'a> ResolveContext<'a> {
}),
Ti::BindingArray { base, .. } => TypeResolution::Handle(base),
ref other => {
log::error!("Access index type {:?}", other);
log::error!("Access index type {other:?}");
return Err(ResolveError::InvalidAccess {
expr: base,
indexed: true,
@ -412,7 +412,7 @@ impl<'a> ResolveContext<'a> {
crate::Expression::Splat { size, value } => match *past(value)?.inner_with(types) {
Ti::Scalar(scalar) => TypeResolution::Value(Ti::Vector { size, scalar }),
ref other => {
log::error!("Scalar type {:?}", other);
log::error!("Scalar type {other:?}");
return Err(ResolveError::InvalidScalar(value));
}
},
@ -425,7 +425,7 @@ impl<'a> ResolveContext<'a> {
TypeResolution::Value(Ti::Vector { size, scalar })
}
ref other => {
log::error!("Vector type {:?}", other);
log::error!("Vector type {other:?}");
return Err(ResolveError::InvalidVector(vector));
}
},
@ -476,7 +476,7 @@ impl<'a> ResolveContext<'a> {
None => Ti::Scalar(scalar),
}),
ref other => {
log::error!("Pointer type {:?}", other);
log::error!("Pointer type {other:?}");
return Err(ResolveError::InvalidPointer(pointer));
}
},
@ -496,7 +496,7 @@ impl<'a> ResolveContext<'a> {
size: crate::VectorSize::Quad,
}),
ref other => {
log::error!("Image type {:?}", other);
log::error!("Image type {other:?}");
return Err(ResolveError::InvalidImage(image));
}
},
@ -514,7 +514,7 @@ impl<'a> ResolveContext<'a> {
},
}),
ref other => {
log::error!("Image type {:?}", other);
log::error!("Image type {other:?}");
return Err(ResolveError::InvalidImage(image));
}
},
@ -532,7 +532,7 @@ impl<'a> ResolveContext<'a> {
},
},
ref other => {
log::error!("Image type {:?}", other);
log::error!("Image type {other:?}");
return Err(ResolveError::InvalidImage(image));
}
},

View File

@ -32,10 +32,7 @@ pub fn validate_compose(
} if comp_scalar == scalar => comp_size as u32,
ref other => {
log::error!(
"Vector component[{}] type {:?}, building {:?}",
index,
other,
scalar
"Vector component[{index}] type {other:?}, building {scalar:?}"
);
return Err(ComposeError::ComponentType {
index: index as u32,
@ -65,7 +62,7 @@ pub fn validate_compose(
}
for (index, comp_res) in component_resolutions.enumerate() {
if comp_res.inner_with(gctx.types) != &inner {
log::error!("Matrix component[{}] type {:?}", index, comp_res);
log::error!("Matrix component[{index}] type {comp_res:?}");
return Err(ComposeError::ComponentType {
index: index as u32,
});
@ -85,7 +82,7 @@ pub fn validate_compose(
}
for (index, comp_res) in component_resolutions.enumerate() {
if !gctx.compare_types(&TypeResolution::Handle(base), &comp_res) {
log::error!("Array component[{}] type {:?}", index, comp_res);
log::error!("Array component[{index}] type {comp_res:?}");
return Err(ComposeError::ComponentType {
index: index as u32,
});
@ -102,7 +99,7 @@ pub fn validate_compose(
for (index, (member, comp_res)) in members.iter().zip(component_resolutions).enumerate()
{
if !gctx.compare_types(&TypeResolution::Handle(member.ty), &comp_res) {
log::error!("Struct component[{}] type {:?}", index, comp_res);
log::error!("Struct component[{index}] type {comp_res:?}");
return Err(ComposeError::ComponentType {
index: index as u32,
});
@ -110,7 +107,7 @@ pub fn validate_compose(
}
}
ref other => {
log::error!("Composing of {:?}", other);
log::error!("Composing of {other:?}");
return Err(ComposeError::Type(self_ty_handle));
}
}

View File

@ -266,7 +266,7 @@ impl super::Validator {
| Ti::ValuePointer { size: Some(_), .. }
| Ti::BindingArray { .. } => {}
ref other => {
log::error!("Indexing of {:?}", other);
log::error!("Indexing of {other:?}");
return Err(ExpressionError::InvalidBaseType(base));
}
};
@ -277,7 +277,7 @@ impl super::Validator {
..
}) => {}
ref other => {
log::error!("Indexing by {:?}", other);
log::error!("Indexing by {other:?}");
return Err(ExpressionError::InvalidIndexType(index));
}
}
@ -332,7 +332,7 @@ impl super::Validator {
}
Ti::Struct { ref members, .. } => members.len() as u32,
ref other => {
log::error!("Indexing of {:?}", other);
log::error!("Indexing of {other:?}");
return Err(ExpressionError::InvalidBaseType(top));
}
};
@ -348,7 +348,7 @@ impl super::Validator {
E::Splat { size: _, value } => match resolver[value] {
Ti::Scalar { .. } => ShaderStages::all(),
ref other => {
log::error!("Splat scalar type {:?}", other);
log::error!("Splat scalar type {other:?}");
return Err(ExpressionError::InvalidSplatType(value));
}
},
@ -360,7 +360,7 @@ impl super::Validator {
let vec_size = match resolver[vector] {
Ti::Vector { size: vec_size, .. } => vec_size,
ref other => {
log::error!("Swizzle vector type {:?}", other);
log::error!("Swizzle vector type {other:?}");
return Err(ExpressionError::InvalidVectorType(vector));
}
};
@ -400,7 +400,7 @@ impl super::Validator {
.contains(TypeFlags::SIZED | TypeFlags::DATA) => {}
Ti::ValuePointer { .. } => {}
ref other => {
log::error!("Loading {:?}", other);
log::error!("Loading {other:?}");
return Err(ExpressionError::InvalidPointerType(pointer));
}
}
@ -766,7 +766,7 @@ impl super::Validator {
| (Uo::LogicalNot, Some(Sk::Bool))
| (Uo::BitwiseNot, Some(Sk::Sint | Sk::Uint)) => {}
other => {
log::error!("Op {:?} kind {:?}", op, other);
log::error!("Op {op:?} kind {other:?}");
return Err(ExpressionError::InvalidUnaryOperandType(op, expr));
}
}
@ -875,7 +875,7 @@ impl super::Validator {
Sk::Bool | Sk::AbstractInt | Sk::AbstractFloat => false,
},
ref other => {
log::error!("Op {:?} left type {:?}", op, other);
log::error!("Op {op:?} left type {other:?}");
false
}
}
@ -887,7 +887,7 @@ impl super::Validator {
..
} => left_inner == right_inner,
ref other => {
log::error!("Op {:?} left type {:?}", op, other);
log::error!("Op {op:?} left type {other:?}");
false
}
},
@ -897,7 +897,7 @@ impl super::Validator {
Sk::Float | Sk::AbstractInt | Sk::AbstractFloat => false,
},
ref other => {
log::error!("Op {:?} left type {:?}", op, other);
log::error!("Op {op:?} left type {other:?}");
false
}
},
@ -907,7 +907,7 @@ impl super::Validator {
Sk::Bool | Sk::Float | Sk::AbstractInt | Sk::AbstractFloat => false,
},
ref other => {
log::error!("Op {:?} left type {:?}", op, other);
log::error!("Op {op:?} left type {other:?}");
false
}
},
@ -916,7 +916,7 @@ impl super::Validator {
Ti::Scalar(scalar) => (Ok(None), scalar),
Ti::Vector { size, scalar } => (Ok(Some(size)), scalar),
ref other => {
log::error!("Op {:?} base type {:?}", op, other);
log::error!("Op {op:?} base type {other:?}");
(Err(()), Sc::BOOL)
}
};
@ -927,7 +927,7 @@ impl super::Validator {
scalar: Sc { kind: Sk::Uint, .. },
} => Ok(Some(size)),
ref other => {
log::error!("Op {:?} shift type {:?}", op, other);
log::error!("Op {op:?} shift type {other:?}");
Err(())
}
};
@ -1032,7 +1032,7 @@ impl super::Validator {
..
} => {}
ref other => {
log::error!("All/Any of type {:?}", other);
log::error!("All/Any of type {other:?}");
return Err(ExpressionError::InvalidBooleanVector(argument));
}
},
@ -1040,7 +1040,7 @@ impl super::Validator {
Ti::Scalar(scalar) | Ti::Vector { scalar, .. }
if scalar.kind == Sk::Float => {}
ref other => {
log::error!("Float test of type {:?}", other);
log::error!("Float test of type {other:?}");
return Err(ExpressionError::InvalidFloatArgument(argument));
}
},
@ -1164,7 +1164,7 @@ impl super::Validator {
}
}
ref other => {
log::error!("Array length of {:?}", other);
log::error!("Array length of {other:?}");
return Err(ExpressionError::InvalidArrayType(expr));
}
},
@ -1179,12 +1179,12 @@ impl super::Validator {
} => match resolver.types[base].inner {
Ti::RayQuery { .. } => ShaderStages::all(),
ref other => {
log::error!("Intersection result of a pointer to {:?}", other);
log::error!("Intersection result of a pointer to {other:?}");
return Err(ExpressionError::InvalidRayQueryType(query));
}
},
ref other => {
log::error!("Intersection result of {:?}", other);
log::error!("Intersection result of {other:?}");
return Err(ExpressionError::InvalidRayQueryType(query));
}
},
@ -1200,12 +1200,12 @@ impl super::Validator {
vertex_return: true,
} => ShaderStages::all(),
ref other => {
log::error!("Intersection result of a pointer to {:?}", other);
log::error!("Intersection result of a pointer to {other:?}");
return Err(ExpressionError::InvalidRayQueryType(query));
}
},
ref other => {
log::error!("Intersection result of {:?}", other);
log::error!("Intersection result of {other:?}");
return Err(ExpressionError::InvalidRayQueryType(query));
}
},

View File

@ -509,7 +509,7 @@ impl super::Validator {
| crate::AtomicFunction::Subtract
| crate::AtomicFunction::Exchange { compare: None }
) {
log::error!("Float32 atomic operation {:?} is not supported", fun);
log::error!("Float32 atomic operation {fun:?} is not supported");
return Err(AtomicError::InvalidOperator(*fun)
.with_span_handle(value, context.expressions)
.into_other());
@ -639,7 +639,7 @@ impl super::Validator {
crate::TypeInner::Scalar(scalar) => (true, scalar),
crate::TypeInner::Vector { scalar, .. } => (false, scalar),
_ => {
log::error!("Subgroup operand type {:?}", argument_inner);
log::error!("Subgroup operand type {argument_inner:?}");
return Err(SubgroupError::InvalidOperand(argument)
.with_span_handle(argument, context.expressions)
.into_other());
@ -654,7 +654,7 @@ impl super::Validator {
(sk::Sint | sk::Uint, sg::And | sg::Or | sg::Xor) => {}
(_, _) => {
log::error!("Subgroup operand type {:?}", argument_inner);
log::error!("Subgroup operand type {argument_inner:?}");
return Err(SubgroupError::InvalidOperand(argument)
.with_span_handle(argument, context.expressions)
.into_other());
@ -714,8 +714,7 @@ impl super::Validator {
crate::TypeInner::Scalar(crate::Scalar::U32) => {}
_ => {
log::error!(
"Subgroup gather index type {:?}, expected unsigned int",
index_ty
"Subgroup gather index type {index_ty:?}, expected unsigned int"
);
return Err(SubgroupError::InvalidOperand(argument)
.with_span_handle(index, context.expressions)
@ -740,7 +739,7 @@ impl super::Validator {
crate::TypeInner::Scalar ( scalar, .. ) | crate::TypeInner::Vector { scalar, .. }
if matches!(scalar.kind, crate::ScalarKind::Uint | crate::ScalarKind::Sint | crate::ScalarKind::Float)
) {
log::error!("Subgroup gather operand type {:?}", argument_inner);
log::error!("Subgroup gather operand type {argument_inner:?}");
return Err(SubgroupError::InvalidOperand(argument)
.with_span_handle(argument, context.expressions)
.into_other());
@ -1567,8 +1566,7 @@ impl super::Validator {
crate::TypeInner::Scalar(crate::Scalar::BOOL,)
) {
log::error!(
"Subgroup ballot predicate type {:?} expected bool",
predicate_inner
"Subgroup ballot predicate type {predicate_inner:?} expected bool"
);
return Err(SubgroupError::InvalidOperand(predicate)
.with_span_handle(predicate, context.expressions)
@ -1645,7 +1643,7 @@ impl super::Validator {
fun_info: &FunctionInfo,
local_expr_kind: &crate::proc::ExpressionKindTracker,
) -> Result<(), LocalVariableError> {
log::debug!("var {:?}", var);
log::debug!("var {var:?}");
let type_info = self
.types
.get(var.ty.index())

View File

@ -309,7 +309,7 @@ impl VaryingContext<'_> {
return Err(VaryingError::InvalidBuiltInStage(built_in));
}
if !type_good {
log::warn!("Wrong builtin type: {:?}", ty_inner);
log::warn!("Wrong builtin type: {ty_inner:?}");
return Err(VaryingError::InvalidBuiltInType(built_in));
}
}
@ -501,7 +501,7 @@ impl super::Validator {
) -> Result<(), GlobalVariableError> {
use super::TypeFlags;
log::debug!("var {:?}", var);
log::debug!("var {var:?}");
let inner_ty = match gctx.types[var.ty].inner {
// A binding array is (mostly) supposed to behave the same as a
// series of individually bound resources, so we can (mostly)
@ -795,12 +795,8 @@ impl super::Validator {
crate::AddressSpace::PushConstant => GlobalUse::READ,
};
if !allowed_usage.contains(usage) {
log::warn!("\tUsage error for: {:?}", var);
log::warn!(
"\tAllowed usage: {:?}, requested: {:?}",
allowed_usage,
usage
);
log::warn!("\tUsage error for: {var:?}");
log::warn!("\tAllowed usage: {allowed_usage:?}, requested: {usage:?}");
return Err(EntryPointError::InvalidGlobalUsage(var_handle, usage)
.with_span_handle(var_handle, &module.global_variables));
}

View File

@ -357,7 +357,7 @@ impl Input {
"spvasm" => params.targets = Some(Targets::non_wgsl_default()),
"vert" | "frag" | "comp" => params.targets = Some(Targets::non_wgsl_default()),
e => {
panic!("Unknown extension: {}", e);
panic!("Unknown extension: {e}");
}
}
}

View File

@ -1,3 +1,8 @@
#![allow(
// We need to investiagate these.
clippy::result_large_err
)]
use naga::{
ir,
valid::{self, ModuleInfo},

View File

@ -2,6 +2,10 @@
Tests for the WGSL front end.
*/
#![cfg(feature = "wgsl-in")]
#![allow(
// We need to investiagate these.
clippy::result_large_err
)]
use naga::{compact::KeepUnused, valid::Capabilities};

View File

@ -3,7 +3,7 @@ name = "naga-xtask"
version = "0.1.0"
edition = "2021"
publish = false
rust-version = "1.84"
rust-version.workspace = true
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
anyhow.workspace = true

View File

@ -46,7 +46,7 @@ pub(crate) fn validate(cmd: ValidateSubcommand) -> anyhow::Result<()> {
if let Err(error) = result {
all_good = false;
progress_bar.suspend(|| {
log::error!("{:#}", error);
log::error!("{error:#}");
});
}
progress_bar.inc(1);

View File

@ -33,7 +33,7 @@ fn main() {
_ => panic!("Provide the dir path as the parameter"),
};
log::info!("Loading trace '{:?}'", dir);
log::info!("Loading trace '{dir:?}'");
let file = fs::File::open(dir.join(trace::FILE_NAME)).unwrap();
let mut actions: Vec<trace::Action> = ron::de::from_reader(file).unwrap();
actions.reverse(); // allows us to pop from the top
@ -66,7 +66,7 @@ fn main() {
let (device, queue) = match actions.pop() {
Some(trace::Action::Init { desc, backend }) => {
log::info!("Initializing the device for backend: {:?}", backend);
log::info!("Initializing the device for backend: {backend:?}");
let adapter = global
.request_adapter(
&wgc::instance::RequestAdapterOptions {
@ -143,18 +143,18 @@ fn main() {
let error =
global.surface_configure(surface, device, &config);
if let Some(e) = error {
panic!("{:?}", e);
panic!("{e:?}");
}
}
}
Some(trace::Action::Present(id)) => {
frame_count += 1;
log::debug!("Presenting frame {}", frame_count);
log::debug!("Presenting frame {frame_count}");
global.surface_present(id).unwrap();
target.exit();
}
Some(trace::Action::DiscardSurfaceTexture(id)) => {
log::debug!("Discarding frame {}", frame_count);
log::debug!("Discarding frame {frame_count}");
global.surface_texture_discard(id).unwrap();
target.exit();
}
@ -169,7 +169,7 @@ fn main() {
}
None => {
if !done {
println!("Finished the end at frame {}", frame_count);
println!("Finished the end at frame {frame_count}");
done = true;
}
target.exit();
@ -180,7 +180,7 @@ fn main() {
if let Some(config) = resize_config.take() {
let error = global.surface_configure(surface, device, &config);
if let Some(e) = error {
panic!("{:?}", e);
panic!("{e:?}");
}
}
}

View File

@ -189,7 +189,7 @@ impl GlobalPlay for wgc::global::Global {
comb_manager: &mut wgc::identity::IdentityManager<wgc::id::markers::CommandBuffer>,
) {
use wgc::device::trace::Action;
log::debug!("action {:?}", action);
log::debug!("action {action:?}");
//TODO: find a way to force ID perishing without excessive `maintain()` calls.
match action {
Action::Init { .. } => {
@ -280,7 +280,7 @@ impl GlobalPlay for wgc::global::Global {
self.bind_group_drop(id);
}
Action::CreateShaderModule { id, desc, data } => {
log::debug!("Creating shader from {}", data);
log::debug!("Creating shader from {data}");
let code = fs::read_to_string(dir.join(&data)).unwrap();
let source = if data.ends_with(".wgsl") {
wgc::pipeline::ShaderModuleSource::Wgsl(Cow::Owned(code.clone()))

View File

@ -1,4 +1,4 @@
[toolchain]
channel = "1.84"
channel = "1.88"
components = ["rustfmt", "clippy"]
targets = ["wasm32-unknown-unknown"]

View File

@ -31,7 +31,7 @@ impl OneTestPerProcessGuard {
// We never abort if we're on wasm. Wasm tests are inherently single threaded, and panics cannot
// unwind the stack and trigger all the guards, so we don't actually need to check.
if other_tests_in_flight && !cfg!(target_arch = "wasm32") {
log::error!("{}", OTHER_TEST_IN_PROGRESS_ERROR);
log::error!("{OTHER_TEST_IN_PROGRESS_ERROR}");
// Hard exit to call attention to the error
std::process::abort();
}

View File

@ -83,7 +83,7 @@ async fn map_test(
after_unmap: bool,
after_destroy: bool,
) {
log::info!("map_test usage_type:{usage_type} map_mode_type:{:?} before_unmap:{before_unmap} before_destroy:{before_destroy} after_unmap:{after_unmap} after_destroy:{after_destroy}", map_mode_type);
log::info!("map_test usage_type:{usage_type} map_mode_type:{map_mode_type:?} before_unmap:{before_unmap} before_destroy:{before_destroy} after_unmap:{after_unmap} after_destroy:{after_destroy}");
let size = 8;
let usage = match usage_type {

View File

@ -209,12 +209,7 @@ async fn single_texture_clear_test(
size: wgpu::Extent3d,
dimension: wgpu::TextureDimension,
) {
log::info!(
"clearing texture with {:?}, dimension {:?}, size {:?}",
format,
dimension,
size
);
log::info!("clearing texture with {format:?}, dimension {dimension:?}, size {size:?}");
let extra_usages = match format {
wgpu::TextureFormat::Depth24Plus | wgpu::TextureFormat::Depth24PlusStencil8 => {

View File

@ -114,7 +114,7 @@ fn sampler_creation_failure(ctx: TestingContext) {
for i in 0..failed_count {
valid(&ctx.device, || {
eprintln!("Trying to create sampler {}", i);
eprintln!("Trying to create sampler {i}");
let sampler = ctx.device.create_sampler(&wgpu::SamplerDescriptor {
lod_min_clamp: i as f32 * 0.01,
// Change the max clamp to ensure the sampler is using different cache slots from
@ -188,7 +188,7 @@ fn sampler_bind_group(ctx: TestingContext, group_type: GroupType) {
GroupType::Multi => MULTI_GROUP_BINDINGS,
};
let full_shader = format!("{}\n{}", bindings, SAMPLER_CODE);
let full_shader = format!("{bindings}\n{SAMPLER_CODE}");
let module = ctx
.device

View File

@ -51,8 +51,7 @@ fn assert_u64_mul_u32(left: u64, right: u32, computed: Uint96) {
assert_eq!(
computed, real,
"{left} * {right} should be {real} but is {}",
computed
"{left} * {right} should be {real} but is {computed}"
);
}

View File

@ -1833,7 +1833,7 @@ impl Global {
Ok(())
}
log::debug!("configuring surface with {:?}", config);
log::debug!("configuring surface with {config:?}");
let error = 'error: {
// User callbacks must not be called while we are holding locks.
@ -1968,7 +1968,7 @@ impl Global {
E::Device(device.handle_hal_error(error))
}
hal::SurfaceError::Other(message) => {
log::error!("surface configuration failed: {}", message);
log::error!("surface configuration failed: {message}");
E::InvalidSurface
}
}

View File

@ -22,7 +22,6 @@ use crate::{
/// resources it uses must remain alive until it has finished executing.
///
/// [`wgpu_hal`]: hal
/// [`ResourceInfo::submission_index`]: crate::resource::ResourceInfo
struct ActiveSubmission {
/// The index of the submission we track.
///

View File

@ -553,9 +553,7 @@ impl Device {
// This is defensive, as this should never be hit.
assert!(
current_finished_submission >= wait_submission_index,
"If the queue is empty, the current submission index ({}) should be at least the wait submission index ({})",
current_finished_submission,
wait_submission_index
"If the queue is empty, the current submission index ({current_finished_submission}) should be at least the wait submission index ({wait_submission_index})"
);
}
@ -1772,7 +1770,7 @@ impl Device {
pipeline::CreateShaderModuleError::Device(self.handle_hal_error(error))
}
hal::ShaderError::Compilation(ref msg) => {
log::error!("Shader error: {}", msg);
log::error!("Shader error: {msg}");
pipeline::CreateShaderModuleError::Generation
}
})
@ -1841,7 +1839,7 @@ impl Device {
pipeline::CreateShaderModuleError::Device(self.handle_hal_error(error))
}
hal::ShaderError::Compilation(ref msg) => {
log::error!("Shader error: {}", msg);
log::error!("Shader error: {msg}");
pipeline::CreateShaderModuleError::Generation
}
})

View File

@ -220,7 +220,7 @@ pub struct Trace {
#[cfg(feature = "trace")]
impl Trace {
pub fn new(path: std::path::PathBuf) -> Result<Self, std::io::Error> {
log::info!("Tracing into '{:?}'", path);
log::info!("Tracing into '{path:?}'");
let mut file = std::fs::File::create(path.join(FILE_NAME))?;
file.write_all(b"[\n")?;
Ok(Self {
@ -241,10 +241,10 @@ impl Trace {
pub(crate) fn add(&mut self, action: Action) {
match ron::ser::to_string_pretty(&action, self.config.clone()) {
Ok(string) => {
let _ = writeln!(self.file, "{},", string);
let _ = writeln!(self.file, "{string},");
}
Err(e) => {
log::warn!("RON serialization failure: {:?}", e);
log::warn!("RON serialization failure: {e:?}");
}
}
}

View File

@ -75,7 +75,7 @@ impl RawId {
/// [`Hub`]: crate::hub::Hub
/// [`Hub<A>`]: crate::hub::Hub
/// [`Texture<A>`]: crate::resource::Texture
/// [`Registry`]: crate::hub::Registry
/// [`Registry`]: crate::registry::Registry
/// [`Noop`]: hal::api::Noop
#[repr(transparent)]
#[cfg_attr(any(feature = "serde", feature = "trace"), derive(serde::Serialize))]

View File

@ -33,7 +33,6 @@ enum IdSource {
/// ids with new index values. Freed vector entries get reused.
///
/// [`Id`]: crate::id::Id
/// [`Backend`]: wgt::Backend;
/// [`alloc`]: IdentityValues::alloc
/// [`release`]: IdentityValues::release
#[derive(Debug)]

View File

@ -124,7 +124,7 @@ impl Dispatch {
CreateShaderModuleError::Device(DeviceError::from_hal(error))
}
hal::ShaderError::Compilation(ref msg) => {
log::error!("Shader error: {}", msg);
log::error!("Shader error: {msg}");
CreateShaderModuleError::Generation
}
}

View File

@ -509,7 +509,7 @@ fn create_validation_module(
CreateShaderModuleError::Device(DeviceError::from_hal(error))
}
hal::ShaderError::Compilation(ref msg) => {
log::error!("Shader error: {}", msg);
log::error!("Shader error: {msg}");
CreateShaderModuleError::Generation
}
},

View File

@ -220,9 +220,7 @@ impl Instance {
}
Err(err) => {
log::debug!(
"Instance::create_surface: failed to create surface for {:?}: {:?}",
backend,
err
"Instance::create_surface: failed to create surface for {backend:?}: {err:?}"
);
errors.insert(*backend, err);
}
@ -415,7 +413,7 @@ impl Instance {
{
// NOTE: We might be using `profiling` without any features. The empty backend of this
// macro emits no code, so unused code linting changes depending on the backend.
profiling::scope!("enumerating", &*alloc::format!("{:?}", _backend));
profiling::scope!("enumerating", &*alloc::format!("{_backend:?}"));
let hal_adapters = unsafe { instance.enumerate_adapters(None) };
for raw in hal_adapters {
@ -452,7 +450,7 @@ impl Instance {
let mut backend_adapters =
unsafe { instance.enumerate_adapters(compatible_hal_surface) };
if backend_adapters.is_empty() {
log::debug!("enabled backend `{:?}` has no adapters", backend);
log::debug!("enabled backend `{backend:?}` has no adapters");
no_adapter_backends |= Backends::from(backend);
// by continuing, we avoid setting the further error bits below
continue;
@ -468,7 +466,7 @@ impl Instance {
keep
});
if backend_adapters.is_empty() {
log::debug!("* Backend `{:?}` has no fallback adapters", backend);
log::debug!("* Backend `{backend:?}` has no fallback adapters");
no_fallback_backends |= Backends::from(backend);
continue;
}
@ -804,11 +802,7 @@ impl Adapter {
&& !caps.downlevel.is_webgpu_compliant()
{
let missing_flags = wgt::DownlevelFlags::compliant() - caps.downlevel.flags;
log::warn!(
"Missing downlevel flags: {:?}\n{}",
missing_flags,
DOWNLEVEL_WARNING_MESSAGE
);
log::warn!("Missing downlevel flags: {missing_flags:?}\n{DOWNLEVEL_WARNING_MESSAGE}");
log::warn!("{:#?}", caps.downlevel);
}

View File

@ -36,7 +36,9 @@
// It gets in the way a lot and does not prevent bugs in practice.
clippy::pattern_type_mismatch,
// `wgpu-core` isn't entirely user-facing, so it's useful to document internal items.
rustdoc::private_intra_doc_links
rustdoc::private_intra_doc_links,
// We should investigate these.
clippy::result_large_err
)]
#![warn(
clippy::alloc_instead_of_core,

View File

@ -294,13 +294,10 @@ fn acquire(new_rank: LockRank, location: &'static Location<'static>) -> Option<H
log.write_acquisition(held_lock, new_rank, location);
}
core::mem::replace(
held_lock,
Some(HeldLock {
rank: new_rank,
location,
}),
)
held_lock.replace(HeldLock {
rank: new_rank,
location,
})
}
})
}

View File

@ -261,7 +261,7 @@ impl Surface {
}
hal::SurfaceError::Outdated => Status::Outdated,
hal::SurfaceError::Other(msg) => {
log::error!("acquire error: {}", msg);
log::error!("acquire error: {msg}");
Status::Lost
}
},
@ -309,7 +309,7 @@ impl Surface {
}
hal::SurfaceError::Outdated => Ok(Status::Outdated),
hal::SurfaceError::Other(msg) => {
log::error!("acquire error: {}", msg);
log::error!("acquire error: {msg}");
Err(SurfaceError::Invalid)
}
},

View File

@ -177,7 +177,7 @@ impl TimestampNormalizer {
CreateShaderModuleError::Device(device.handle_hal_error(error))
}
hal::ShaderError::Compilation(ref msg) => {
log::error!("Shader error: {}", msg);
log::error!("Shader error: {msg}");
CreateShaderModuleError::Generation
}
})?;
@ -274,8 +274,7 @@ impl TimestampNormalizer {
let bg_label_alloc;
let label = match buffer_label {
Some(label) => {
bg_label_alloc =
alloc::format!("Timestamp normalization bind group ({})", label);
bg_label_alloc = alloc::format!("Timestamp normalization bind group ({label})");
&*bg_label_alloc
}
None => "Timestamp normalization bind group",

View File

@ -937,7 +937,7 @@ impl Interface {
// the reality is - every shader coming from `glslc` outputs an array
// of clip distances and hits this path :(
// So we lower it to `log::warn` to be less annoying.
log::warn!("Unexpected varying type: {:?}", other);
log::warn!("Unexpected varying type: {other:?}");
return;
}
};

View File

@ -123,7 +123,7 @@ impl<A: hal::Api> Example<A> {
let surface_caps = unsafe { adapter.surface_capabilities(&surface) }
.ok_or("failed to get surface capabilities")?;
log::info!("Surface caps: {:#?}", surface_caps);
log::info!("Surface caps: {surface_caps:#?}");
let hal::OpenDevice { device, queue } = unsafe {
adapter

View File

@ -269,7 +269,7 @@ impl<A: hal::Api> Example<A> {
};
let surface_caps = unsafe { adapter.surface_capabilities(&surface) }
.expect("Surface doesn't support presentation");
log::info!("Surface caps: {:#?}", surface_caps);
log::info!("Surface caps: {surface_caps:#?}");
let hal::OpenDevice { device, queue } = unsafe {
adapter

View File

@ -80,7 +80,7 @@ unsafe extern "system" fn output_debug_string_handler(
}
let _ = std::panic::catch_unwind(|| {
log::log!(level, "{}", message);
log::log!(level, "{message}");
});
#[cfg(feature = "validation_canary")]

View File

@ -89,7 +89,7 @@ pub fn enumerate_adapters(factory: DxgiFactory) -> Vec<DxgiAdapter> {
Ok(a) => a,
Err(e) if e.code() == Dxgi::DXGI_ERROR_NOT_FOUND => break,
Err(e) => {
log::error!("Failed enumerating adapters: {}", e);
log::error!("Failed enumerating adapters: {e}");
break;
}
};

View File

@ -8,7 +8,7 @@ impl<T> HResult<T> for windows::core::Result<T> {
#![allow(unreachable_code)]
self.map_err(|err| {
log::error!("{} failed: {}", description, err);
log::error!("{description} failed: {err}");
match err.code() {
Foundation::E_OUTOFMEMORY => crate::DeviceError::OutOfMemory,

View File

@ -77,8 +77,7 @@ impl RenderDoc {
Err(e) => {
return RenderDoc::NotAvailable {
reason: format!(
"Unable to get RENDERDOC_GetAPI from renderdoc library '{}': {e:?}",
renderdoc_filename
"Unable to get RENDERDOC_GetAPI from renderdoc library '{renderdoc_filename}': {e:?}"
),
}
}
@ -93,8 +92,7 @@ impl RenderDoc {
},
return_value => RenderDoc::NotAvailable {
reason: format!(
"Unable to get API from renderdoc library '{}': {}",
renderdoc_filename, return_value
"Unable to get API from renderdoc library '{renderdoc_filename}': {return_value}"
),
},
}
@ -123,7 +121,7 @@ impl RenderDoc {
true
}
Self::NotAvailable { ref reason } => {
log::warn!("Could not start RenderDoc frame capture: {}", reason);
log::warn!("Could not start RenderDoc frame capture: {reason}");
false
}
}
@ -136,7 +134,7 @@ impl RenderDoc {
unsafe { entry.api.EndFrameCapture.unwrap()(device_handle, window_handle) };
}
Self::NotAvailable { ref reason } => {
log::warn!("Could not end RenderDoc frame capture: {}", reason)
log::warn!("Could not end RenderDoc frame capture: {reason}")
}
};
}

View File

@ -328,7 +328,7 @@ impl super::Adapter {
tier3_practical_descriptor_limit,
),
other => {
log::warn!("Unknown resource binding tier {:?}", other);
log::warn!("Unknown resource binding tier {other:?}");
(
Direct3D12::D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1,
8,

View File

@ -198,7 +198,7 @@ impl super::CommandEncoder {
self.pass.dirty_root_elements ^= 1 << index;
match self.pass.root_elements[index as usize] {
super::RootElement::Empty => log::error!("Root index {} is not bound", index),
super::RootElement::Empty => log::error!("Root index {index} is not bound"),
super::RootElement::Constant => {
let info = self.pass.layout.root_constant_info.as_ref().unwrap();

View File

@ -96,7 +96,7 @@ impl GeneralHeap {
pub(super) fn allocate_slice(&self, count: u64) -> Result<DescriptorIndex, crate::DeviceError> {
let range = self.ranges.lock().allocate_range(count).map_err(|err| {
log::error!("Unable to allocate descriptors: {:?}", err);
log::error!("Unable to allocate descriptors: {err:?}");
crate::DeviceError::OutOfMemory
})?;
Ok(range.start)

View File

@ -342,10 +342,7 @@ impl super::Device {
(source, entry_point)
};
log::info!(
"Naga generated shader for {:?} at {:?}:\n{}",
entry_point,
naga_stage,
source
"Naga generated shader for {entry_point:?} at {naga_stage:?}:\n{source}"
);
ShaderCacheKey {
@ -1584,7 +1581,7 @@ impl crate::Device for super::Device {
let buffer_size = (sampler_indexes.len() * size_of::<u32>()) as u64;
let label = if let Some(label) = desc.label {
Cow::Owned(format!("{} (Internal Sampler Index Buffer)", label))
Cow::Owned(format!("{label} (Internal Sampler Index Buffer)"))
} else {
Cow::Borrowed("Internal Sampler Index Buffer")
};
@ -2123,11 +2120,7 @@ impl crate::Device for super::Device {
}
};
log::trace!(
"Waiting for fence value {} for {:?}",
value,
remaining_wait_duration
);
log::trace!("Waiting for fence value {value} for {remaining_wait_duration:?}");
match unsafe {
Threading::WaitForSingleObject(
@ -2145,13 +2138,13 @@ impl crate::Device for super::Device {
break Ok(false);
}
other => {
log::error!("Unexpected wait status: 0x{:?}", other);
log::error!("Unexpected wait status: 0x{other:?}");
break Err(crate::DeviceError::Lost);
}
};
fence_value = unsafe { fence.raw.GetCompletedValue() };
log::trace!("Wait complete! Fence actual value: {}", fence_value);
log::trace!("Wait complete! Fence actual value: {fence_value}");
if fence_value >= value {
break Ok(true);

View File

@ -1195,7 +1195,7 @@ impl SwapChain {
Foundation::WAIT_OBJECT_0 => Ok(true),
Foundation::WAIT_TIMEOUT => Ok(false),
other => {
log::error!("Unexpected wait status: 0x{:x?}", other);
log::error!("Unexpected wait status: 0x{other:x?}");
Err(crate::SurfaceError::Lost)
}
}
@ -1316,7 +1316,7 @@ impl crate::Surface for Surface {
};
let swap_chain1 = swap_chain1.map_err(|err| {
log::error!("SwapChain creation error: {}", err);
log::error!("SwapChain creation error: {err}");
crate::SurfaceError::Other("swapchain creation")
})?;

View File

@ -226,8 +226,7 @@ impl SamplerHeap {
let Entry::Occupied(mut hash_map_entry) = state.mapping.entry(HashableSamplerDesc(desc))
else {
log::error!(
"Tried to destroy a sampler that doesn't exist. Sampler description: {:#?}",
desc
"Tried to destroy a sampler that doesn't exist. Sampler description: {desc:#?}"
);
return;
};

View File

@ -106,7 +106,7 @@ impl Allocator {
};
let allocator = gpu_allocator::d3d12::Allocator::new(&allocator_desc).inspect_err(|e| {
log::error!("Failed to create d3d12 allocator, error: {}", e);
log::error!("Failed to create d3d12 allocator, error: {e}");
})?;
Ok(Self {
@ -627,7 +627,7 @@ impl From<gpu_allocator::AllocationError> for crate::DeviceError {
match result {
gpu_allocator::AllocationError::OutOfMemory => Self::OutOfMemory,
gpu_allocator::AllocationError::FailedToMap(e) => {
log::error!("DX12 gpu-allocator: Failed to map: {}", e);
log::error!("DX12 gpu-allocator: Failed to map: {e}");
Self::Lost
}
gpu_allocator::AllocationError::NoCompatibleMemoryTypeFound => {
@ -639,15 +639,12 @@ impl From<gpu_allocator::AllocationError> for crate::DeviceError {
Self::Lost
}
gpu_allocator::AllocationError::InvalidAllocatorCreateDesc(e) => {
log::error!(
"DX12 gpu-allocator: Invalid Allocator Creation Description: {}",
e
);
log::error!("DX12 gpu-allocator: Invalid Allocator Creation Description: {e}");
Self::Lost
}
gpu_allocator::AllocationError::Internal(e) => {
log::error!("DX12 gpu-allocator: Internal Error: {}", e);
log::error!("DX12 gpu-allocator: Internal Error: {e}");
Self::Lost
}
gpu_allocator::AllocationError::BarrierLayoutNeedsDevice10

View File

@ -220,9 +220,9 @@ impl super::Adapter {
let vendor = unsafe { gl.get_parameter_string(vendor_const) };
let renderer = unsafe { gl.get_parameter_string(renderer_const) };
let version = unsafe { gl.get_parameter_string(glow::VERSION) };
log::debug!("Vendor: {}", vendor);
log::debug!("Renderer: {}", renderer);
log::debug!("Version: {}", version);
log::debug!("Vendor: {vendor}");
log::debug!("Renderer: {renderer}");
log::debug!("Version: {version}");
let full_ver = Self::parse_full_version(&version).ok();
let es_ver = full_ver.map_or_else(|| Self::parse_version(&version).ok(), |_| None);
@ -293,7 +293,7 @@ impl super::Adapter {
}
};
log::debug!("Supported GL Extensions: {:#?}", extensions);
log::debug!("Supported GL Extensions: {extensions:#?}");
let supported = |(req_es_major, req_es_minor), (req_full_major, req_full_minor)| {
let es_supported = es_ver
@ -909,7 +909,7 @@ impl super::Adapter {
if !unsafe { gl.get_shader_compile_status(shader) } {
let msg = unsafe { gl.get_shader_info_log(shader) };
if !msg.is_empty() {
log::error!("\tShader compile error: {}", msg);
log::error!("\tShader compile error: {msg}");
}
unsafe { gl.delete_shader(shader) };
None
@ -946,7 +946,7 @@ impl super::Adapter {
let linked_ok = unsafe { gl.get_program_link_status(program) };
let msg = unsafe { gl.get_program_info_log(program) };
if !msg.is_empty() {
log::warn!("Shader link error: {}", msg);
log::warn!("Shader link error: {msg}");
}
if !linked_ok {
return None;

View File

@ -188,17 +188,17 @@ impl super::Device {
unsafe { gl.shader_source(raw, shader) };
unsafe { gl.compile_shader(raw) };
log::debug!("\tCompiled shader {:?}", raw);
log::debug!("\tCompiled shader {raw:?}");
let compiled_ok = unsafe { gl.get_shader_compile_status(raw) };
let msg = unsafe { gl.get_shader_info_log(raw) };
if compiled_ok {
if !msg.is_empty() {
log::warn!("\tCompile: {}", msg);
log::warn!("\tCompile: {msg}");
}
Ok(raw)
} else {
log::error!("\tShader compilation failed: {}", msg);
log::error!("\tShader compilation failed: {msg}");
unsafe { gl.delete_shader(raw) };
Err(crate::PipelineError::Linkage(
map_naga_stage(naga_stage),
@ -286,7 +286,7 @@ impl super::Device {
crate::PipelineError::Linkage(map_naga_stage(naga_stage), msg)
})?;
log::debug!("Naga generated shader:\n{}", output);
log::debug!("Naga generated shader:\n{output}");
context.consume_reflection(
gl,
@ -422,7 +422,7 @@ impl super::Device {
unsafe { gl.delete_shader(shader) };
}
log::debug!("\tLinked program {:?}", program);
log::debug!("\tLinked program {program:?}");
let linked_ok = unsafe { gl.get_program_link_status(program) };
let msg = unsafe { gl.get_program_info_log(program) };
@ -430,7 +430,7 @@ impl super::Device {
return Err(crate::PipelineError::Linkage(has_stages, msg));
}
if !msg.is_empty() {
log::warn!("\tLink: {}", msg);
log::warn!("\tLink: {msg}");
}
if !private_caps.contains(PrivateCapabilities::SHADER_BINDING_LAYOUT) {
@ -438,7 +438,7 @@ impl super::Device {
// in the shader. We can't remap storage buffers this way.
unsafe { gl.use_program(Some(program)) };
for (ref name, (register, slot)) in name_binding_map {
log::trace!("Get binding {:?} from program {:?}", name, program);
log::trace!("Get binding {name:?} from program {program:?}");
match register {
super::BindingRegister::UniformBuffers => {
let index = unsafe { gl.get_uniform_block_index(program, name) }.unwrap();
@ -448,11 +448,7 @@ impl super::Device {
super::BindingRegister::StorageBuffers => {
let index =
unsafe { gl.get_shader_storage_block_index(program, name) }.unwrap();
log::error!(
"Unable to re-map shader storage block {} to {}",
name,
index
);
log::error!("Unable to re-map shader storage block {name} to {index}");
return Err(crate::DeviceError::Lost.into());
}
super::BindingRegister::Textures | super::BindingRegister::Images => {

View File

@ -98,13 +98,7 @@ unsafe extern "system" fn egl_debug_proc(
unsafe { ffi::CStr::from_ptr(message_raw) }.to_string_lossy()
};
log::log!(
log_severity,
"EGL '{}' code 0x{:x}: {}",
command,
error,
message,
);
log::log!(log_severity, "EGL '{command}' code 0x{error:x}: {message}",);
}
/// A simple wrapper around an X11 or Wayland display handle.
@ -239,7 +233,7 @@ fn choose_config(
let mut attributes = Vec::with_capacity(9);
for tier_max in (0..tiers.len()).rev() {
let name = tiers[tier_max].0;
log::debug!("\tTrying {}", name);
log::debug!("\tTrying {name}");
attributes.clear();
for &(_, tier_attr) in tiers[..=tier_max].iter() {
@ -275,7 +269,7 @@ fn choose_config(
log::warn!("No config found!");
}
Err(e) => {
log::error!("error in choose_first_config: {:?}", e);
log::error!("error in choose_first_config: {e:?}");
}
}
}
@ -527,7 +521,7 @@ impl Inner {
.query_string(Some(display), khronos_egl::EXTENSIONS)
.unwrap()
.to_string_lossy();
log::debug!("Display vendor {:?}, version {:?}", vendor, version,);
log::debug!("Display vendor {vendor:?}, version {version:?}",);
log::debug!(
"Display extensions: {:#?}",
display_extensions.split_whitespace().collect::<Vec<_>>()
@ -717,11 +711,11 @@ impl Drop for Inner {
.instance
.destroy_context(self.egl.display, self.egl.raw)
{
log::warn!("Error in destroy_context: {:?}", e);
log::warn!("Error in destroy_context: {e:?}");
}
if let Err(e) = terminate_display(&self.egl.instance, self.egl.display) {
log::warn!("Error in terminate: {:?}", e);
log::warn!("Error in terminate: {e:?}");
}
}
}
@ -1200,7 +1194,7 @@ impl Surface {
Some(self.egl.raw),
)
.map_err(|e| {
log::error!("make_current(surface) failed: {}", e);
log::error!("make_current(surface) failed: {e}");
crate::SurfaceError::Lost
})?;
@ -1244,7 +1238,7 @@ impl Surface {
.instance
.swap_buffers(self.egl.display, sc.surface)
.map_err(|e| {
log::error!("swap_buffers failed: {}", e);
log::error!("swap_buffers failed: {e}");
crate::SurfaceError::Lost
// TODO: should we unset the current context here?
})?;
@ -1252,7 +1246,7 @@ impl Surface {
.instance
.make_current(self.egl.display, None, None, None)
.map_err(|e| {
log::error!("make_current(null) failed: {}", e);
log::error!("make_current(null) failed: {e}");
crate::SurfaceError::Lost
})?;
@ -1419,7 +1413,7 @@ impl crate::Surface for Surface {
match raw_result {
Ok(raw) => (raw, wl_window),
Err(e) => {
log::warn!("Error in create_window_surface: {:?}", e);
log::warn!("Error in create_window_surface: {e:?}");
return Err(crate::SurfaceError::Lost);
}
}

View File

@ -1100,11 +1100,7 @@ fn gl_debug_message_callback(source: u32, gltype: u32, id: u32, severity: u32, m
let _ = std::panic::catch_unwind(|| {
log::log!(
log_severity,
"GLES: [{}/{}] ID {} : {}",
source_str,
type_str,
id,
message
"GLES: [{source_str}/{type_str}] ID {id} : {message}"
);
});

View File

@ -225,6 +225,8 @@
clippy::missing_safety_doc,
// It gets in the way a lot and does not prevent bugs in practice.
clippy::pattern_type_mismatch,
// We should investigate these.
clippy::large_enum_variant
)]
#![warn(
clippy::alloc_instead_of_core,

View File

@ -140,7 +140,7 @@ impl super::Device {
Some((naga_stage, stage.entry_point)),
stage.constants,
)
.map_err(|e| crate::PipelineError::PipelineConstants(stage_bit, format!("MSL: {:?}", e)))?;
.map_err(|e| crate::PipelineError::PipelineConstants(stage_bit, format!("MSL: {e:?}")))?;
let ep_resources = &layout.per_stage_map[naga_stage];
@ -193,7 +193,7 @@ impl super::Device {
let (source, info) =
naga::back::msl::write_string(&module, &module_info, &options, &pipeline_options)
.map_err(|e| crate::PipelineError::Linkage(stage_bit, format!("MSL: {:?}", e)))?;
.map_err(|e| crate::PipelineError::Linkage(stage_bit, format!("MSL: {e:?}")))?;
log::debug!(
"Naga generated shader for entry point '{}' and stage {:?}\n{}",
@ -215,8 +215,8 @@ impl super::Device {
.lock()
.new_library_with_source(source.as_ref(), &options)
.map_err(|err| {
log::warn!("Naga generated shader:\n{}", source);
crate::PipelineError::Linkage(stage_bit, format!("Metal: {}", err))
log::warn!("Naga generated shader:\n{source}");
crate::PipelineError::Linkage(stage_bit, format!("Metal: {err}"))
})?;
let ep_index = module
@ -227,7 +227,7 @@ impl super::Device {
let ep = &module.entry_points[ep_index];
let translated_ep_name = info.entry_point_names[0]
.as_ref()
.map_err(|e| crate::PipelineError::Linkage(stage_bit, format!("{}", e)))?;
.map_err(|e| crate::PipelineError::Linkage(stage_bit, format!("{e}")))?;
let wg_size = MTLSize {
width: ep.workgroup_size[0] as _,
@ -238,7 +238,7 @@ impl super::Device {
let function = library
.get_function(translated_ep_name, None)
.map_err(|e| {
log::error!("get_function: {:?}", e);
log::error!("get_function: {e:?}");
crate::PipelineError::EntryPoint(naga_stage)
})?;
@ -777,7 +777,7 @@ impl crate::Device for super::Device {
|| info.counters.textures > self.shared.private_caps.max_textures_per_stage
|| info.counters.samplers > self.shared.private_caps.max_samplers_per_stage
{
log::error!("Resource limit exceeded: {:?}", info);
log::error!("Resource limit exceeded: {info:?}");
return Err(crate::DeviceError::OutOfMemory);
}
}
@ -1018,11 +1018,10 @@ impl crate::Device for super::Device {
let device = self.shared.device.lock();
let library = device
.new_library_with_source(&source, &options)
.map_err(|e| crate::ShaderError::Compilation(format!("MSL: {:?}", e)))?;
.map_err(|e| crate::ShaderError::Compilation(format!("MSL: {e:?}")))?;
let function = library.get_function(&entry_point, None).map_err(|_| {
crate::ShaderError::Compilation(format!(
"Entry point '{}' not found",
entry_point
"Entry point '{entry_point}' not found"
))
})?;
@ -1289,7 +1288,7 @@ impl crate::Device for super::Device {
.map_err(|e| {
crate::PipelineError::Linkage(
wgt::ShaderStages::VERTEX | wgt::ShaderStages::FRAGMENT,
format!("new_render_pipeline_state: {:?}", e),
format!("new_render_pipeline_state: {e:?}"),
)
})?;
@ -1397,7 +1396,7 @@ impl crate::Device for super::Device {
.map_err(|e| {
crate::PipelineError::Linkage(
wgt::ShaderStages::COMPUTE,
format!("new_compute_pipeline_state: {:?}", e),
format!("new_compute_pipeline_state: {e:?}"),
)
})?;
@ -1472,7 +1471,7 @@ impl crate::Device for super::Device {
match device.new_counter_sample_buffer_with_descriptor(&csb_desc) {
Ok(buffer) => buffer,
Err(err) => {
log::error!("Failed to create counter sample buffer: {:?}", err);
log::error!("Failed to create counter sample buffer: {err:?}");
return Err(crate::DeviceError::Unexpected);
}
};
@ -1540,7 +1539,7 @@ impl crate::Device for super::Device {
{
Some((_, cmd_buf)) => cmd_buf,
None => {
log::error!("No active command buffers for fence value {}", wait_value);
log::error!("No active command buffers for fence value {wait_value}");
return Err(crate::DeviceError::Lost);
}
};

Some files were not shown because too many files have changed in this diff Show More