Repository: gfx-rs/wgpu
Pull request #6126 (2024-08-18 12:56:45)

Reduce code size of error handling
**Description**
Moves error handling to cold out-of-line functions, which prevents this code from being inlined and duplicated in a lot of callers.

**Testing**
`cargo-show-asm`, e.g. `ContextWgpuCore::device_create_pipeline_cache` that just forwards the call got a lot smaller:

```diff
--- before	2024-08-18 13:55:08
+++ after	2024-08-18 13:55:08
@@ -11,9 +11,6 @@
 	stp x0, x0, [sp, #0]
 	stp x0, x0, [sp, #0]
 	stp x0, x0, [sp, #0]
-	stp x0, x0, [sp, #0]
-	stp x0, x0, [sp, #0]
-	stp x0, x0, [sp, #0]
 	add x0, sp, #0
 	.cfi_def_cfa w0, 0
 	.cfi_offset w0, -0
@@ -22,12 +19,6 @@
 	.cfi_offset w0, -0
 	.cfi_offset w0, -0
 	.cfi_offset w0, -0
-	.cfi_offset w0, -0
-	.cfi_offset w0, -0
-	.cfi_offset w0, -0
-	.cfi_offset w0, -0
-	.cfi_offset w0, -0
-	.cfi_offset w0, -0
 	.cfi_remember_state
 	mov x0, x0
 	ldp x0, x0, [x0]
@@ -47,20 +38,22 @@
 	add x0, sp, #0
 	mov x0, #0
 	bl wgpu_core::device::global::<impl wgpu_core::global::Global>::device_create_pipeline_cache
-	add x0, sp, #0
+	ldp x0, x0, [x0, #-0]
+	ldur q0, [x0, #-0]
+	ldur q0, [x0, #-0]
+	stp q0, q0, [sp, #0]
+	ldur x0, [x0, #-0]
+	str x0, [sp, #0]
 	mov x0, #0
 	movk x0, #0, lsl #0
-	ldur x0, [x0, #-0]
-	ldur q0, [x0, #0]
-	ldur q0, [x0, #0]
-	stp q0, q0, [sp, #0]
-	ldur q0, [x0, #0]
-	str q0, [sp, #0]
-	ldr x0, [sp, #0]
 	cmp x0, x0
 	b.eq LBB0_0
-	str x0, [sp, #0]
+	ldp q0, q0, [sp, #0]
+	stp q0, q0, [x0, #-0]
+	ldr x0, [sp, #0]
+	stur x0, [x0, #-0]
 	ldr x0, [x0, #0]
+	stur x0, [x0, #-0]
 Lloh0:
 	adrp x0, ___rust_no_alloc_shim_is_unstable@GOTPAGE
 Lloh0:
@@ -70,260 +63,30 @@
 	mov w0, #0
 	bl ___rust_alloc
 	cbz x0, LBB0_0
-	mov x0, x0
-	ldp q0, q0, [sp, #0]
+	ldur q0, [x0, #-0]
+	ldur q0, [x0, #-0]
 	stp q0, q0, [x0]
-	ldr q0, [sp, #0]
+	ldur q0, [x0, #-0]
 	str q0, [x0, #0]
-Lloh0:
-	adrp x0, l_anon@PAGE
-Lloh0:
-	add x0, x0, l_anon@PAGEOFF
-	stp x0, x0, [x0, #-0]
-	cmp x0, #0
-	csel x0, xzr, x0, eq
-Lloh0:
-	adrp x0, l_anon@PAGE
-Lloh0:
-	add x0, x0, l_anon@PAGEOFF
-	csel x0, x0, x0, eq
-	mov w0, #0
-	cbz x0, LBB0_0
-	tbnz x0, #0, LBB0_0
-	ldrb wzr, [x0]
-	mov x0, x0
-	mov w0, #0
-	bl ___rust_alloc
-	mov x0, x0
-	cbnz x0, LBB0_0
-	mov w0, #0
-	mov x0, x0
-	bl alloc::alloc::handle_alloc_error
-	b LBB0_0
-	mov w0, #0
 	add x0, x0, #0
-	mov x0, x0
-	mov x0, x0
-	mov x0, x0
-	mov x0, x0
-	bl _memcpy
-	mov w0, #0
 Lloh0:
 	adrp x0, l_anon@PAGE
 Lloh0:
 	add x0, x0, l_anon@PAGEOFF
-	mov w0, #0
-	stp x0, x0, [sp, #0]
-	str x0, [sp, #0]
-	stp x0, x0, [sp, #0]
-	stp x0, x0, [sp, #0]
-	casab w0, w0, [x0]
-	cmp w0, #0
-	b.eq LBB0_0
-	mov x0, x0
-	mov w0, #0
-	movk w0, #0, lsl #0
-	bl parking_lot::raw_mutex::RawMutex::lock_slow
-LBB0_0:
-	str x0, [sp, #0]
 Lloh0:
 	adrp x0, l_anon@PAGE
 Lloh0:
 	add x0, x0, l_anon@PAGEOFF
-	add x0, sp, #0
-	mov x0, #0
-	movk x0, #0, lsl #0
-	movk x0, #0, lsl #0
-	movk x0, #0, lsl #0
-	mov x0, #0
-	movk x0, #0, lsl #0
-	movk x0, #0, lsl #0
-	movk x0, #0, lsl #0
-	mov x0, #-0
 	mov x0, x0
-	ldr x0, [x0, #0]
 	mov x0, x0
-	blr x0
-	cmp x0, x0
-	ccmp x0, x0, #0, eq
-	b.ne LBB0_0
-	ldr x0, [x0]
-	cmp x0, x0
-	b.eq LBB0_0
-LBB0_0:
-	ldr x0, [x0, #0]
 	mov x0, x0
-	blr x0
-	mov x0, x0
-	mov x0, x0
-	cbnz x0, LBB0_0
 	mov w0, #0
-	sub x0, x0, #0
-	add x0, sp, #0
-	bl wgpu::backend::wgpu_core::ContextWgpuCore::format_error
-	ldp q0, q0, [sp, #0]
-	stp q0, q0, [x0, #0]
-	ldr q0, [x0, #0]
-	str q0, [x0, #0]
-	ldr x0, [sp, #0]
-	stur x0, [x0, #-0]
-	ldrb wzr, [x0]
-	mov w0, #0
-	mov w0, #0
-	bl ___rust_alloc
-	cbz x0, LBB0_0
-	ldp q0, q0, [x0, #0]
-	stp q0, q0, [x0]
-	ldr q0, [x0, #0]
-	str q0, [x0, #0]
-	ldur x0, [x0, #-0]
-	str x0, [x0, #0]
-	ldur q0, [x0, #-0]
-	stur q0, [x0, #0]
-	ldur x0, [x0, #-0]
-	stp x0, x0, [sp, #0]
-	str x0, [sp, #0]
-	mov w0, #0
-	str x0, [sp, #0]
-	ldp x0, x0, [x0, #0]
-	lsl x0, x0, #0
-	sub x0, x0, x0, lsl #0
-	add x0, x0, x0
+	bl wgpu::backend::wgpu_core::ContextWgpuCore::handle_error_inner
 LBB0_0:
-	cbz x0, LBB0_0
-	ldurb w0, [x0, #-0]
-	sub x0, x0, #0
-	sub x0, x0, #0
-	cmp w0, #0
-	b.ne LBB0_0
-	add x0, x0, x0
-	ldr x0, [x0]
-	cmp x0, #0
-	b.ne LBB0_0
-	ldur q0, [sp, #0]
-	ldur q0, [sp, #0]
-	stp q0, q0, [x0]
-	ldur q0, [sp, #0]
-	str q0, [x0, #0]
-	b LBB0_0
-LBB0_0:
-	ldp q0, q0, [sp, #0]
-	stp q0, q0, [x0, #0]
-	ldr q0, [x0, #0]
-	str q0, [x0, #0]
 	ldr x0, [sp, #0]
-	stur x0, [x0, #-0]
-	ldrb wzr, [x0]
-	mov w0, #0
-	mov w0, #0
-	bl ___rust_alloc
-	cbz x0, LBB0_0
-	ldp q0, q0, [x0, #0]
-	stp q0, q0, [x0]
-	ldr q0, [x0, #0]
-	str q0, [x0, #0]
-	ldur x0, [x0, #-0]
-	str x0, [x0, #0]
-	stp x0, x0, [sp, #0]
-	str xzr, [sp, #0]
-	ldp x0, x0, [x0, #0]
-	lsl x0, x0, #0
-	sub x0, x0, x0, lsl #0
-	add x0, x0, x0
-	cbz x0, LBB0_0
-	ldurb w0, [x0, #-0]
-	sub x0, x0, #0
-	sub x0, x0, #0
-	cbnz w0, LBB0_0
-	add x0, x0, x0
-	ldr x0, [x0]
-	cmp x0, #0
-	b.ne LBB0_0
-	ldur q0, [sp, #0]
-	ldur q0, [sp, #0]
-	stp q0, q0, [x0]
-	ldur q0, [sp, #0]
-	str q0, [x0, #0]
-	b LBB0_0
-	ldur q0, [sp, #0]
-	ldur q0, [sp, #0]
-	stp q0, q0, [x0, #0]
-	ldur q0, [sp, #0]
-	str q0, [x0, #0]
-	ldp x0, x0, [x0, #0]
-	ldr x0, [x0, #0]
-	mov w0, #0
-	sub x0, x0, #0
-	blr x0
-	b LBB0_0
-	ldur q0, [sp, #0]
-	ldur q0, [sp, #0]
-	stp q0, q0, [x0, #0]
-	ldur q0, [sp, #0]
-	str q0, [x0, #0]
-	ldp x0, x0, [x0, #0]
-	ldr x0, [x0, #0]
-	mov w0, #0
-	sub x0, x0, #0
-	blr x0
-	b LBB0_0
-LBB0_0:
-	mov w0, #0
-	add x0, sp, #0
-	bl core::ptr::drop_in_place<wgpu::api::device::Error>
-LBB0_0:
-	mov w0, #0
-	ldr x0, [sp, #0]
-	caslb w0, wzr, [x0]
-	cmp w0, #0
-	b.eq LBB0_0
-	mov w0, #0
-	bl parking_lot::raw_mutex::RawMutex::unlock_slow
-	b LBB0_0
-LBB0_0:
-	mov w0, #0
-	add x0, sp, #0
-	bl core::ptr::drop_in_place<wgpu::api::device::Error>
-LBB0_0:
-	mov w0, #0
-	ldr x0, [sp, #0]
-	caslb w0, wzr, [x0]
-	cmp w0, #0
-	b.eq LBB0_0
-	mov w0, #0
-	bl parking_lot::raw_mutex::RawMutex::unlock_slow
-LBB0_0:
-	ldr x0, [sp, #0]
 	mov x0, #0
 	movk x0, #0, lsl #0
 	cmp x0, x0
-	b.ne LBB0_0
-	ldr x0, [sp, #0]
-	cmp x0, x0
-	b.eq LBB0_0
-	add x0, x0, x0
-	sub x0, x0, #0
-	mov x0, #0
-	add x0, x0, x0
-	cmp x0, #0
-	csel x0, x0, xzr, lo
-	sub x0, x0, #0
-	cmp x0, #0
-	b.lo LBB0_0
-	cbnz x0, LBB0_0
-	add x0, sp, #0
-	bl core::ptr::drop_in_place<wgpu_core::device::DeviceError>
-	b LBB0_0
-	ldr x0, [sp, #0]
-	cbz x0, LBB0_0
-	ldr x0, [sp, #0]
-	mov w0, #0
-	bl ___rust_dealloc
-LBB0_0:
-	ldr x0, [sp, #0]
-	mov x0, #0
-	movk x0, #0, lsl #0
-	cmp x0, x0
 	b.lt LBB0_0
 	cbz x0, LBB0_0
 	ldr x0, [sp, #0]
@@ -343,9 +106,6 @@
 	ldp x0, x0, [sp, #0]
 	ldp x0, x0, [sp, #0]
 	ldp x0, x0, [sp, #0]
-	ldp x0, x0, [sp, #0]
-	ldp x0, x0, [sp, #0]
-	ldp x0, x0, [sp, #0]
 	add sp, sp, #0
 	.cfi_def_cfa_offset 0
 	.cfi_restore w0
@@ -354,97 +114,29 @@
 	.cfi_restore w0
 	.cfi_restore w0
 	.cfi_restore w0
-	.cfi_restore w0
-	.cfi_restore w0
-	.cfi_restore w0
-	.cfi_restore w0
-	.cfi_restore w0
-	.cfi_restore w0
 	ret
 	.cfi_restore_state
 	mov w0, #0
 	mov w0, #0
 	bl alloc::alloc::handle_alloc_error
-	b LBB0_0
-	mov w0, #0
-	mov w0, #0
-	bl alloc::alloc::handle_alloc_error
-	b LBB0_0
-	bl alloc::raw_vec::capacity_overflow
-	b LBB0_0
-	mov w0, #0
-	mov w0, #0
-	bl alloc::alloc::handle_alloc_error
-LBB0_0:
 	brk #0x0
 	mov x0, x0
-	sub x0, x0, #0
-	bl core::ptr::drop_in_place<wgpu_core::error::ContextError>
-	b LBB0_0
-	bl core::panicking::panic_in_cleanup
-	mov x0, x0
 	add x0, sp, #0
 	bl core::ptr::drop_in_place<wgpu_core::pipeline::PipelineCacheDescriptor>
 	mov x0, x0
 	bl __Unwind_Resume
 	mov x0, x0
-	b LBB0_0
-	mov x0, x0
 	sub x0, x0, #0
-	bl core::ptr::drop_in_place<wgpu_core::error::ContextError>
-	ldur x0, [x0, #-0]
-	cbnz x0, LBB0_0
-LBB0_0:
-	mov w0, #0
-	b LBB0_0
-	ldur x0, [x0, #-0]
-	mov w0, #0
-	bl ___rust_dealloc
-	mov w0, #0
-	b LBB0_0
-	bl core::panicking::panic_in_cleanup
-	mov x0, x0
-	add x0, sp, #0
 	bl core::ptr::drop_in_place<wgpu_core::pipeline::CreatePipelineCacheError>
 	add x0, sp, #0
 	bl core::ptr::drop_in_place<wgpu_core::pipeline::PipelineCacheDescriptor>
 	mov x0, x0
 	bl __Unwind_Resume
 	mov x0, x0
-	sub x0, x0, #0
-	bl core::ptr::drop_in_place<alloc::boxed::Box<dyn core::error::Error+core::marker::Sync+core::marker::Send>>
-	b LBB0_0
-	mov x0, x0
-	b LBB0_0
-	mov x0, x0
 	add x0, sp, #0
 	bl core::ptr::drop_in_place<wgpu_core::pipeline::PipelineCacheDescriptor>
 	mov x0, x0
 	bl __Unwind_Resume
-	mov x0, x0
-	mov w0, #0
-LBB0_0:
-	mov w0, #0
-	ldr x0, [sp, #0]
-	caslb w0, wzr, [x0]
-	cmp w0, #0
-	b.eq LBB0_0
-	ldr x0, [sp, #0]
-	mov w0, #0
-	bl parking_lot::raw_mutex::RawMutex::unlock_slow
-LBB0_0:
-	cbz w0, LBB0_0
-LBB0_0:
-	add x0, sp, #0
-	bl core::ptr::drop_in_place<wgpu_core::error::ContextError>
-LBB0_0:
-	add x0, sp, #0
-	bl core::ptr::drop_in_place<wgpu_core::pipeline::PipelineCacheDescriptor>
-	mov x0, x0
-	bl __Unwind_Resume
-	bl core::panicking::panic_in_cleanup
 	.loh AdrpLdrGot	Lloh0, Lloh0
-	.loh AdrpAdd	Lloh0, Lloh0
-	.loh AdrpAdd	Lloh0, Lloh0
 	.loh AdrpAdd	Lloh0, Lloh0
 	.loh AdrpAdd	Lloh0, Lloh0
```

**Checklist**

- [x] Run `cargo fmt`.
- [x] Run `cargo clippy`. If applicable, add:
- [x] Run `cargo xtask test` to run tests.



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb1bc4a0c..324ebd9f9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -63,6 +63,8 @@ By @wumpf in [#6069](https://github.com/gfx-rs/wgpu/pull/6069), [#6099](https://
 
 ### Bug Fixes
 
+- Fix incorrect hlsl image output type conversion. By @atlv24 in [#6123](https://github.com/gfx-rs/wgpu/pull/6123)
+
 #### General
 
 - If GL context creation fails retry with GLES. By @Rapdorian in [#5996](https://github.com/gfx-rs/wgpu/pull/5996)
diff --git a/deno_webgpu/error.rs b/deno_webgpu/error.rs
index feafbe3d7..caea7d9d8 100644
--- a/deno_webgpu/error.rs
+++ b/deno_webgpu/error.rs
@@ -68,6 +68,7 @@ pub struct WebGpuResult {
 }
 
 impl WebGpuResult {
+    #[must_use]
     pub fn rid(rid: ResourceId) -> Self {
         Self {
             rid: Some(rid),
@@ -75,6 +76,7 @@ impl WebGpuResult {
         }
     }
 
+    #[must_use]
     pub fn rid_err<T: Into<WebGpuError>>(rid: ResourceId, err: Option<T>) -> Self {
         Self {
             rid: Some(rid),
@@ -82,6 +84,7 @@ impl WebGpuResult {
         }
     }
 
+    #[must_use]
     pub fn maybe_err<T: Into<WebGpuError>>(err: Option<T>) -> Self {
         Self {
             rid: None,
@@ -89,6 +92,7 @@ impl WebGpuResult {
         }
     }
 
+    #[must_use]
     pub fn empty() -> Self {
         Self {
             rid: None,
@@ -307,6 +311,7 @@ pub struct DomExceptionOperationError {
 }
 
 impl DomExceptionOperationError {
+    #[must_use]
     pub fn new(msg: &str) -> Self {
         DomExceptionOperationError {
             msg: msg.to_string(),
@@ -322,6 +327,7 @@ impl fmt::Display for DomExceptionOperationError {
 
 impl std::error::Error for DomExceptionOperationError {}
 
+#[must_use]
 pub fn get_error_class_name(e: &AnyError) -> Option<&'static str> {
     e.downcast_ref::<DomExceptionOperationError>()
         .map(|_| "DOMExceptionOperationError")
diff --git a/naga-cli/src/bin/naga.rs b/naga-cli/src/bin/naga.rs
index 002c6dd66..d97d96de7 100644
--- a/naga-cli/src/bin/naga.rs
+++ b/naga-cli/src/bin/naga.rs
@@ -326,6 +326,8 @@ trait PrettyResult {
     fn unwrap_pretty(self) -> Self::Target;
 }
 
+#[cold]
+#[inline(never)]
 fn print_err(error: &dyn Error) {
     eprint!("{error}");
 
diff --git a/naga/hlsl-snapshots/src/lib.rs b/naga/hlsl-snapshots/src/lib.rs
index 616aa73f0..ee4554327 100644
--- a/naga/hlsl-snapshots/src/lib.rs
+++ b/naga/hlsl-snapshots/src/lib.rs
@@ -53,6 +53,7 @@ pub struct Config {
 }
 
 impl Config {
+    #[must_use]
     pub fn empty() -> Self {
         Self {
             vertex: Default::default(),
@@ -78,6 +79,7 @@ impl Config {
         fs::write(path, &s).map_err(|e| anyhow!("failed to write to {}: {e}", path.display()))
     }
 
+    #[must_use]
     pub fn is_empty(&self) -> bool {
         let Self {
             vertex,
diff --git a/naga/src/back/hlsl/conv.rs b/naga/src/back/hlsl/conv.rs
index 6c0daf476..9df73b279 100644
--- a/naga/src/back/hlsl/conv.rs
+++ b/naga/src/back/hlsl/conv.rs
@@ -119,38 +119,29 @@ impl crate::TypeInner {
 impl crate::StorageFormat {
     pub(super) const fn to_hlsl_str(self) -> &'static str {
         match self {
-            Self::R16Float => "float",
+            Self::R16Float | Self::R32Float => "float",
             Self::R8Unorm | Self::R16Unorm => "unorm float",
             Self::R8Snorm | Self::R16Snorm => "snorm float",
-            Self::R8Uint | Self::R16Uint => "uint",
-            Self::R8Sint | Self::R16Sint => "int",
+            Self::R8Uint | Self::R16Uint | Self::R32Uint => "uint",
+            Self::R8Sint | Self::R16Sint | Self::R32Sint => "int",
 
-            Self::Rg16Float => "float2",
+            Self::Rg16Float | Self::Rg32Float => "float2",
             Self::Rg8Unorm | Self::Rg16Unorm => "unorm float2",
             Self::Rg8Snorm | Self::Rg16Snorm => "snorm float2",
 
-            Self::Rg8Sint | Self::Rg16Sint => "int2",
-            Self::Rg8Uint | Self::Rg16Uint => "uint2",
+            Self::Rg8Sint | Self::Rg16Sint | Self::Rg32Uint => "int2",
+            Self::Rg8Uint | Self::Rg16Uint | Self::Rg32Sint => "uint2",
 
             Self::Rg11b10UFloat => "float3",
 
-            Self::Rgba16Float | Self::R32Float | Self::Rg32Float | Self::Rgba32Float => "float4",
+            Self::Rgba16Float | Self::Rgba32Float => "float4",
             Self::Rgba8Unorm | Self::Bgra8Unorm | Self::Rgba16Unorm | Self::Rgb10a2Unorm => {
                 "unorm float4"
             }
             Self::Rgba8Snorm | Self::Rgba16Snorm => "snorm float4",
 
-            Self::Rgba8Uint
-            | Self::Rgba16Uint
-            | Self::R32Uint
-            | Self::Rg32Uint
-            | Self::Rgba32Uint
-            | Self::Rgb10a2Uint => "uint4",
-            Self::Rgba8Sint
-            | Self::Rgba16Sint
-            | Self::R32Sint
-            | Self::Rg32Sint
-            | Self::Rgba32Sint => "int4",
+            Self::Rgba8Uint | Self::Rgba16Uint | Self::Rgba32Uint | Self::Rgb10a2Uint => "uint4",
+            Self::Rgba8Sint | Self::Rgba16Sint | Self::Rgba32Sint => "int4",
         }
     }
 }
diff --git a/naga/src/front/wgsl/error.rs b/naga/src/front/wgsl/error.rs
index febcd9a4e..bfaba4894 100644
--- a/naga/src/front/wgsl/error.rs
+++ b/naga/src/front/wgsl/error.rs
@@ -278,6 +278,8 @@ pub enum Error<'a> {
 }
 
 impl<'a> Error<'a> {
+    #[cold]
+    #[inline(never)]
     pub(crate) fn as_parse_error(&self, source: &'a str) -> ParseError {
         match *self {
             Error::Unexpected(unexpected_span, expected) => {
diff --git a/wgpu-core/src/error.rs b/wgpu-core/src/error.rs
index aa1f11df0..519a5f930 100644
--- a/wgpu-core/src/error.rs
+++ b/wgpu-core/src/error.rs
@@ -3,6 +3,11 @@ use std::{error::Error, sync::Arc};
 
 use thiserror::Error;
 
+#[cfg(send_sync)]
+pub type ContextErrorSource = Box<dyn Error + Send + Sync + 'static>;
+#[cfg(not(send_sync))]
+pub type ContextErrorSource = Box<dyn Error + 'static>;
+
 #[derive(Debug, Error)]
 #[error(
     "In {fn_ident}{}{}{}",
@@ -13,10 +18,7 @@ use thiserror::Error;
 pub struct ContextError {
     pub fn_ident: &'static str,
     #[source]
-    #[cfg(send_sync)]
-    pub source: Box<dyn Error + Send + Sync + 'static>,
-    #[cfg(not(send_sync))]
-    pub source: Box<dyn Error + 'static>,
+    pub source: ContextErrorSource,
     pub label: String,
 }
 
diff --git a/wgpu-hal/src/vulkan/mod.rs b/wgpu-hal/src/vulkan/mod.rs
index 3f3bd557e..26186d5fa 100644
--- a/wgpu-hal/src/vulkan/mod.rs
+++ b/wgpu-hal/src/vulkan/mod.rs
@@ -1296,6 +1296,7 @@ fn get_lost_err() -> crate::DeviceError {
     crate::DeviceError::Lost
 }
 
+#[cold]
 fn hal_usage_error<T: fmt::Display>(txt: T) -> ! {
     panic!("wgpu-hal invariant was violated (usage error): {txt}")
 }
diff --git a/wgpu-types/src/counters.rs b/wgpu-types/src/counters.rs
index d0f9a5ea1..6b5b87dfb 100644
--- a/wgpu-types/src/counters.rs
+++ b/wgpu-types/src/counters.rs
@@ -14,6 +14,7 @@ pub struct InternalCounter {
 impl InternalCounter {
     /// Creates a counter with value 0.
     #[inline]
+    #[must_use]
     pub const fn new() -> Self {
         InternalCounter {
             #[cfg(feature = "counters")]
@@ -33,6 +34,7 @@ impl InternalCounter {
     /// Always returns 0 if the `counters` feature is not enabled.
     #[cfg(not(feature = "counters"))]
     #[inline]
+    #[must_use]
     pub fn read(&self) -> isize {
         0
     }
@@ -51,6 +53,7 @@ impl InternalCounter {
     /// Always returns 0 if the `counters` feature is not enabled.
     #[cfg(not(feature = "counters"))]
     #[inline]
+    #[must_use]
     pub fn take(&self) -> isize {
         0
     }
diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs
index de64dfa12..9bcb00342 100644
--- a/wgpu-types/src/lib.rs
+++ b/wgpu-types/src/lib.rs
@@ -54,6 +54,7 @@ macro_rules! impl_bitflags {
         impl $name {
             /// Returns true if the bitflags contains bits that are not part of
             /// the bitflags definition.
+            #[must_use]
             pub fn contains_invalid_bits(&self) -> bool {
                 let all = Self::all().bits();
                 (self.bits() | all) != all
@@ -114,6 +115,7 @@ pub enum Backend {
 
 impl Backend {
     /// Returns the string name of the backend.
+    #[must_use]
     pub const fn to_str(self) -> &'static str {
         match self {
             Backend::Empty => "empty",
@@ -957,11 +959,13 @@ impl_bitflags!(Features);
 
 impl Features {
     /// Mask of all features which are part of the upstream WebGPU standard.
+    #[must_use]
     pub const fn all_webgpu_mask() -> Self {
         Self::from_bits_truncate(0xFFFFF)
     }
 
     /// Mask of all features that are only available when targeting native (not web).
+    #[must_use]
     pub const fn all_native_mask() -> Self {
         Self::from_bits_truncate(!Self::all_webgpu_mask().bits())
     }
@@ -1013,11 +1017,13 @@ impl Default for InstanceFlags {
 
 impl InstanceFlags {
     /// Enable recommended debugging and validation flags.
+    #[must_use]
     pub fn debugging() -> Self {
         InstanceFlags::DEBUG | InstanceFlags::VALIDATION
     }
 
     /// Enable advanced debugging and validation flags (potentially very slow).
+    #[must_use]
     pub fn advanced_debugging() -> Self {
         Self::debugging() | InstanceFlags::GPU_BASED_VALIDATION
     }
@@ -1025,6 +1031,7 @@ impl InstanceFlags {
     /// Infer good defaults from the build type
     ///
     /// Returns the default flags and add debugging flags if the build configuration has `debug_assertions`.
+    #[must_use]
     pub fn from_build_config() -> Self {
         if cfg!(debug_assertions) {
             return InstanceFlags::debugging();
@@ -1045,6 +1052,7 @@ impl InstanceFlags {
     /// The environment variables are named after the flags prefixed with "WGPU_". For example:
     /// - WGPU_DEBUG
     /// - WGPU_VALIDATION
+    #[must_use]
     pub fn with_env(mut self) -> Self {
         fn env(key: &str) -> Option<bool> {
             std::env::var(key).ok().map(|s| match s.as_str() {
@@ -1308,6 +1316,7 @@ impl Limits {
     ///     max_non_sampler_bindings: 1_000_000,
     /// });
     /// ```
+    #[must_use]
     pub const fn downlevel_defaults() -> Self {
         Self {
             max_texture_dimension_1d: 2048,
@@ -1364,6 +1373,7 @@ impl Limits {
     ///     max_non_sampler_bindings: 1_000_000,
     /// });
     /// ```
+    #[must_use]
     pub const fn downlevel_webgl2_defaults() -> Self {
         Self {
             max_uniform_buffers_per_shader_stage: 11,
@@ -1394,6 +1404,7 @@ impl Limits {
     /// This is useful because the swapchain might need to be larger than any other image in the application.
     ///
     /// If your application only needs 512x512, you might be running on a 4k display and need extremely high resolution limits.
+    #[must_use]
     pub const fn using_resolution(self, other: Self) -> Self {
         Self {
             max_texture_dimension_1d: other.max_texture_dimension_1d,
@@ -1406,6 +1417,7 @@ impl Limits {
     /// Modify the current limits to use the buffer alignment limits of the adapter.
     ///
     /// This is useful for when you'd like to dynamically use the "best" supported buffer alignments.
+    #[must_use]
     pub const fn using_alignment(self, other: Self) -> Self {
         Self {
             min_uniform_buffer_offset_alignment: other.min_uniform_buffer_offset_alignment,
@@ -1417,6 +1429,7 @@ impl Limits {
     /// Compares every limits within self is within the limits given in `allowed`.
     ///
     /// If you need detailed information on failures, look at [`Limits::check_limits_with_fail_fn`].
+    #[must_use]
     pub fn check_limits(&self, allowed: &Self) -> bool {
         let mut within = true;
         self.check_limits_with_fail_fn(allowed, true, |_, _, _| within = false);
@@ -1534,6 +1547,7 @@ impl DownlevelCapabilities {
     ///
     /// If this returns false, some parts of the API will result in validation errors where they would not normally.
     /// These parts can be determined by the values in this structure.
+    #[must_use]
     pub fn is_webgpu_compliant(&self) -> bool {
         self.flags.contains(DownlevelFlags::compliant())
             && self.limits == DownlevelLimits::default()
@@ -1707,6 +1721,7 @@ impl_bitflags!(DownlevelFlags);
 
 impl DownlevelFlags {
     /// All flags that indicate if the backend is WebGPU compliant
+    #[must_use]
     pub const fn compliant() -> Self {
         // We use manual bit twiddling to make this a const fn as `Sub` and `.remove` aren't const
 
@@ -1846,6 +1861,7 @@ pub struct DeviceDescriptor<L> {
 
 impl<L> DeviceDescriptor<L> {
     /// Takes a closure and maps the label of the device descriptor into another.
+    #[must_use]
     pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> DeviceDescriptor<K> {
         DeviceDescriptor {
             label: fun(&self.label),
@@ -1914,6 +1930,7 @@ pub enum TextureViewDimension {
 
 impl TextureViewDimension {
     /// Get the texture dimension required of this texture view dimension.
+    #[must_use]
     pub fn compatible_texture_dimension(self) -> TextureDimension {
         match self {
             Self::D1 => TextureDimension::D1,
@@ -1976,6 +1993,7 @@ impl BlendFactor {
     /// Returns `true` if the blend factor references the second blend source.
     ///
     /// Note that the usage of those blend factors require [`Features::DUAL_SOURCE_BLENDING`].
+    #[must_use]
     pub fn ref_second_blend_source(&self) -> bool {
         match self {
             BlendFactor::Src1
@@ -2046,6 +2064,7 @@ impl BlendComponent {
 
     /// Returns true if the state relies on the constant color, which is
     /// set independently on a render command encoder.
+    #[must_use]
     pub fn uses_constant(&self) -> bool {
         match (self.src_factor, self.dst_factor) {
             (BlendFactor::Constant, _)
@@ -2169,6 +2188,7 @@ pub enum PrimitiveTopology {
 
 impl PrimitiveTopology {
     /// Returns true for strip topologies.
+    #[must_use]
     pub fn is_strip(&self) -> bool {
         match *self {
             Self::PointList | Self::LineList | Self::TriangleList => false,
@@ -2336,6 +2356,7 @@ impl TextureFormatFeatureFlags {
     /// Sample count supported by a given texture format.
     ///
     /// returns `true` if `count` is a supported sample count.
+    #[must_use]
     pub fn sample_count_supported(&self, count: u32) -> bool {
         use TextureFormatFeatureFlags as tfsc;
 
@@ -2350,6 +2371,7 @@ impl TextureFormatFeatureFlags {
     }
 
     /// A `Vec` of supported sample counts.
+    #[must_use]
     pub fn supported_sample_counts(&self) -> Vec<u32> {
         let all_possible_sample_counts: [u32; 5] = [1, 2, 4, 8, 16];
         all_possible_sample_counts
@@ -3009,6 +3031,7 @@ impl Serialize for TextureFormat {
 
 impl TextureAspect {
     /// Returns the texture aspect for a given plane.
+    #[must_use]
     pub fn from_plane(plane: u32) -> Option<Self> {
         Some(match plane {
             0 => Self::Plane0,
@@ -3023,6 +3046,7 @@ impl TextureFormat {
     /// Returns the aspect-specific format of the original format
     ///
     /// see <https://gpuweb.github.io/gpuweb/#abstract-opdef-resolving-gputextureaspect>
+    #[must_use]
     pub fn aspect_specific_format(&self, aspect: TextureAspect) -> Option<Self> {
         match (*self, aspect) {
             (Self::Stencil8, TextureAspect::StencilOnly) => Some(*self),
@@ -3046,6 +3070,7 @@ impl TextureFormat {
 
     /// Returns `true` if `self` is a depth or stencil component of the given
     /// combined depth-stencil format
+    #[must_use]
     pub fn is_depth_stencil_component(&self, combined_format: Self) -> bool {
         match (combined_format, *self) {
             (Self::Depth24PlusStencil8, Self::Depth24Plus | Self::Stencil8)
@@ -3057,6 +3082,7 @@ impl TextureFormat {
     /// Returns `true` if the format is a depth and/or stencil format
     ///
     /// see <https://gpuweb.github.io/gpuweb/#depth-formats>
+    #[must_use]
     pub fn is_depth_stencil_format(&self) -> bool {
         match *self {
             Self::Stencil8
@@ -3072,6 +3098,7 @@ impl TextureFormat {
     /// Returns `true` if the format is a combined depth-stencil format
     ///
     /// see <https://gpuweb.github.io/gpuweb/#combined-depth-stencil-format>
+    #[must_use]
     pub fn is_combined_depth_stencil_format(&self) -> bool {
         match *self {
             Self::Depth24PlusStencil8 | Self::Depth32FloatStencil8 => true,
@@ -3080,11 +3107,13 @@ impl TextureFormat {
     }
 
     /// Returns `true` if the format is a multi-planar format
+    #[must_use]
     pub fn is_multi_planar_format(&self) -> bool {
         self.planes().is_some()
     }
 
     /// Returns the number of planes a multi-planar format has.
+    #[must_use]
     pub fn planes(&self) -> Option<u32> {
         match *self {
             Self::NV12 => Some(2),
@@ -3093,11 +3122,13 @@ impl TextureFormat {
     }
 
     /// Returns `true` if the format has a color aspect
+    #[must_use]
     pub fn has_color_aspect(&self) -> bool {
         !self.is_depth_stencil_format()
     }
 
     /// Returns `true` if the format has a depth aspect
+    #[must_use]
     pub fn has_depth_aspect(&self) -> bool {
         match *self {
             Self::Depth16Unorm
@@ -3110,6 +3141,7 @@ impl TextureFormat {
     }
 
     /// Returns `true` if the format has a stencil aspect
+    #[must_use]
     pub fn has_stencil_aspect(&self) -> bool {
         match *self {
             Self::Stencil8 | Self::Depth24PlusStencil8 | Self::Depth32FloatStencil8 => true,
@@ -3118,6 +3150,7 @@ impl TextureFormat {
     }
 
     /// Returns the size multiple requirement for a texture using this format.
+    #[must_use]
     pub fn size_multiple_requirement(&self) -> (u32, u32) {
         match *self {
             Self::NV12 => (2, 2),
@@ -3128,6 +3161,7 @@ impl TextureFormat {
     /// Returns the dimension of a [block](https://gpuweb.github.io/gpuweb/#texel-block) of texels.
     ///
     /// Uncompressed formats have a block dimension of `(1, 1)`.
+    #[must_use]
     pub fn block_dimensions(&self) -> (u32, u32) {
         match *self {
             Self::R8Unorm
@@ -3227,16 +3261,19 @@ impl TextureFormat {
     }
 
     /// Returns `true` for compressed formats.
+    #[must_use]
     pub fn is_compressed(&self) -> bool {
         self.block_dimensions() != (1, 1)
     }
 
     /// Returns `true` for BCn compressed formats.
+    #[must_use]
     pub fn is_bcn(&self) -> bool {
         self.required_features() == Features::TEXTURE_COMPRESSION_BC
     }
 
     /// Returns the required features (if any) in order to use the texture.
+    #[must_use]
     pub fn required_features(&self) -> Features {
         match *self {
             Self::R8Unorm
@@ -3329,6 +3366,7 @@ impl TextureFormat {
     /// Returns the format features guaranteed by the WebGPU spec.
     ///
     /// Additional features are available if `Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES` is enabled.
+    #[must_use]
     pub fn guaranteed_format_features(&self, device_features: Features) -> TextureFormatFeatures {
         // Multisampling
         let noaa = TextureFormatFeatureFlags::empty();
@@ -3384,7 +3422,7 @@ impl TextureFormat {
             Self::Bgra8UnormSrgb =>       (msaa_resolve, attachment),
             Self::Rgb10a2Uint =>          (        msaa, attachment),
             Self::Rgb10a2Unorm =>         (msaa_resolve, attachment),
-            Self::Rg11b10UFloat =>         (        msaa,   rg11b10f),
+            Self::Rg11b10UFloat =>        (        msaa,   rg11b10f),
             Self::Rg32Uint =>             (        noaa,  all_flags),
             Self::Rg32Sint =>             (        noaa,  all_flags),
             Self::Rg32Float =>            (        noaa,  all_flags),
@@ -3464,6 +3502,7 @@ impl TextureFormat {
     ///
     /// Returns `None` only if this is a combined depth-stencil format or a multi-planar format
     /// and `TextureAspect::All` or no `aspect` was provided.
+    #[must_use]
     pub fn sample_type(
         &self,
         aspect: Option<TextureAspect>,
@@ -3586,6 +3625,7 @@ impl TextureFormat {
     ///  - the format is `Depth24Plus`
     ///  - the format is `Depth24PlusStencil8` and `aspect` is depth.
     #[deprecated(since = "0.19.0", note = "Use `block_copy_size` instead.")]
+    #[must_use]
     pub fn block_size(&self, aspect: Option<TextureAspect>) -> Option<u32> {
         self.block_copy_size(aspect)
     }
@@ -3602,6 +3642,7 @@ impl TextureFormat {
     ///  - the format is a multi-planar format and no `aspect` was provided
     ///  - the format is `Depth24Plus`
     ///  - the format is `Depth24PlusStencil8` and `aspect` is depth.
+    #[must_use]
     pub fn block_copy_size(&self, aspect: Option<TextureAspect>) -> Option<u32> {
         match *self {
             Self::R8Unorm | Self::R8Snorm | Self::R8Uint | Self::R8Sint => Some(1),
@@ -3689,6 +3730,7 @@ impl TextureFormat {
 
     /// The number of bytes occupied per pixel in a color attachment
     /// <https://gpuweb.github.io/gpuweb/#render-target-pixel-byte-cost>
+    #[must_use]
     pub fn target_pixel_byte_cost(&self) -> Option<u32> {
         match *self {
             Self::R8Unorm | Self::R8Snorm | Self::R8Uint | Self::R8Sint => Some(1),
@@ -3765,6 +3807,7 @@ impl TextureFormat {
     }
 
     /// See <https://gpuweb.github.io/gpuweb/#render-target-component-alignment>
+    #[must_use]
     pub fn target_component_alignment(&self) -> Option<u32> {
         match *self {
             Self::R8Unorm
@@ -3846,6 +3889,7 @@ impl TextureFormat {
     }
 
     /// Returns the number of components this format has.
+    #[must_use]
     pub fn components(&self) -> u8 {
         self.components_with_aspect(TextureAspect::All)
     }
@@ -3853,6 +3897,7 @@ impl TextureFormat {
     /// Returns the number of components this format has taking into account the `aspect`.
     ///
     /// The `aspect` is only relevant for combined depth-stencil formats and multi-planar formats.
+    #[must_use]
     pub fn components_with_aspect(&self, aspect: TextureAspect) -> u8 {
         match *self {
             Self::R8Unorm
@@ -3938,6 +3983,7 @@ impl TextureFormat {
     }
 
     /// Strips the `Srgb` suffix from the given texture format.
+    #[must_use]
     pub fn remove_srgb_suffix(&self) -> TextureFormat {
         match *self {
             Self::Rgba8UnormSrgb => Self::Rgba8Unorm,
@@ -3961,6 +4007,7 @@ impl TextureFormat {
     }
 
     /// Adds an `Srgb` suffix to the given texture format, if the format supports it.
+    #[must_use]
     pub fn add_srgb_suffix(&self) -> TextureFormat {
         match *self {
             Self::Rgba8Unorm => Self::Rgba8UnormSrgb,
@@ -3984,6 +4031,7 @@ impl TextureFormat {
     }
 
     /// Returns `true` for srgb formats.
+    #[must_use]
     pub fn is_srgb(&self) -> bool {
         *self != self.remove_srgb_suffix()
     }
@@ -4629,6 +4677,7 @@ pub enum Maintain<T> {
 
 impl<T> Maintain<T> {
     /// Construct a wait variant
+    #[must_use]
     pub fn wait() -> Self {
         // This function seems a little silly, but it is useful to allow
         // <https://github.com/gfx-rs/wgpu/pull/5012> to be split up, as
@@ -4637,6 +4686,7 @@ impl<T> Maintain<T> {
     }
 
     /// Construct a WaitForSubmissionIndex variant
+    #[must_use]
     pub fn wait_for(submission_index: T) -> Self {
         // This function seems a little silly, but it is useful to allow
         // <https://github.com/gfx-rs/wgpu/pull/5012> to be split up, as
@@ -4645,6 +4695,7 @@ impl<T> Maintain<T> {
     }
 
     /// This maintain represents a wait of some kind.
+    #[must_use]
     pub fn is_wait(&self) -> bool {
         match *self {
             Self::WaitForSubmissionIndex(..) | Self::Wait => true,
@@ -4653,6 +4704,7 @@ impl<T> Maintain<T> {
     }
 
     /// Map on the wait index type.
+    #[must_use]
     pub fn map_index<U, F>(self, func: F) -> Maintain<U>
     where
         F: FnOnce(T) -> U,
@@ -4678,6 +4730,7 @@ pub enum MaintainResult {
 
 impl MaintainResult {
     /// Returns true if the result is [`Self::SubmissionQueueEmpty`]`.
+    #[must_use]
     pub fn is_queue_empty(&self) -> bool {
         matches!(self, Self::SubmissionQueueEmpty)
     }
@@ -4710,11 +4763,13 @@ pub struct StencilState {
 
 impl StencilState {
     /// Returns true if the stencil test is enabled.
+    #[must_use]
     pub fn is_enabled(&self) -> bool {
         (self.front != StencilFaceState::IGNORE || self.back != StencilFaceState::IGNORE)
             && (self.read_mask != 0 || self.write_mask != 0)
     }
     /// Returns true if the state doesn't mutate the target values.
+    #[must_use]
     pub fn is_read_only(&self, cull_mode: Option<Face>) -> bool {
         // The rules are defined in step 7 of the "Device timeline initialization steps"
         // subsection of the "Render Pipeline Creation" section of WebGPU
@@ -4730,6 +4785,7 @@ impl StencilState {
         front_ro && back_ro
     }
     /// Returns true if the stencil state uses the reference value for testing.
+    #[must_use]
     pub fn needs_ref_value(&self) -> bool {
         self.front.needs_ref_value() || self.back.needs_ref_value()
     }
@@ -4755,6 +4811,7 @@ pub struct DepthBiasState {
 
 impl DepthBiasState {
     /// Returns true if the depth biasing is enabled.
+    #[must_use]
     pub fn is_enabled(&self) -> bool {
         self.constant != 0 || self.slope_scale != 0.0
     }
@@ -4805,21 +4862,25 @@ pub struct DepthStencilState {
 
 impl DepthStencilState {
     /// Returns true if the depth testing is enabled.
+    #[must_use]
     pub fn is_depth_enabled(&self) -> bool {
         self.depth_compare != CompareFunction::Always || self.depth_write_enabled
     }
 
     /// Returns true if the state doesn't mutate the depth buffer.
+    #[must_use]
     pub fn is_depth_read_only(&self) -> bool {
         !self.depth_write_enabled
     }
 
     /// Returns true if the state doesn't mutate the stencil.
+    #[must_use]
     pub fn is_stencil_read_only(&self, cull_mode: Option<Face>) -> bool {
         self.stencil.is_read_only(cull_mode)
     }
 
     /// Returns true if the state doesn't mutate either depth or stencil of the target.
+    #[must_use]
     pub fn is_read_only(&self, cull_mode: Option<Face>) -> bool {
         self.is_depth_read_only() && self.is_stencil_read_only(cull_mode)
     }
@@ -4903,6 +4964,7 @@ impl StencilFaceState {
     };
 
     /// Returns true if the face state uses the reference value for testing or operation.
+    #[must_use]
     pub fn needs_ref_value(&self) -> bool {
         self.compare.needs_ref_value()
             || self.fail_op == StencilOperation::Replace
@@ -4911,6 +4973,7 @@ impl StencilFaceState {
     }
 
     /// Returns true if the face state doesn't mutate the target values.
+    #[must_use]
     pub fn is_read_only(&self) -> bool {
         self.pass_op == StencilOperation::Keep
             && self.depth_fail_op == StencilOperation::Keep
@@ -4957,6 +5020,7 @@ pub enum CompareFunction {
 
 impl CompareFunction {
     /// Returns true if the comparison depends on the reference value.
+    #[must_use]
     pub fn needs_ref_value(self) -> bool {
         match self {
             Self::Never | Self::Always => false,
@@ -5140,6 +5204,7 @@ pub enum VertexFormat {
 
 impl VertexFormat {
     /// Returns the byte size of the format.
+    #[must_use]
     pub const fn size(&self) -> u64 {
         match self {
             Self::Uint8x2 | Self::Sint8x2 | Self::Unorm8x2 | Self::Snorm8x2 => 2,
@@ -5244,6 +5309,7 @@ pub struct BufferDescriptor<L> {
 
 impl<L> BufferDescriptor<L> {
     /// Takes a closure and maps the label of the buffer descriptor into another.
+    #[must_use]
     pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> BufferDescriptor<K> {
         BufferDescriptor {
             label: fun(&self.label),
@@ -5268,6 +5334,7 @@ pub struct CommandEncoderDescriptor<L> {
 
 impl<L> CommandEncoderDescriptor<L> {
     /// Takes a closure and maps the label of the command encoder descriptor into another.
+    #[must_use]
     pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> CommandEncoderDescriptor<K> {
         CommandEncoderDescriptor {
             label: fun(&self.label),
@@ -5571,6 +5638,7 @@ impl PresentationTimestamp {
     pub const INVALID_TIMESTAMP: Self = Self(u128::MAX);
 
     /// Returns true if this timestamp is the invalid timestamp.
+    #[must_use]
     pub fn is_invalid(self) -> bool {
         self == Self::INVALID_TIMESTAMP
     }
@@ -5673,6 +5741,7 @@ impl Origin2d {
     pub const ZERO: Self = Self { x: 0, y: 0 };
 
     /// Adds the third dimension to this origin
+    #[must_use]
     pub fn to_3d(self, z: u32) -> Origin3d {
         Origin3d {
             x: self.x,
@@ -5710,6 +5779,7 @@ impl Origin3d {
     pub const ZERO: Self = Self { x: 0, y: 0, z: 0 };
 
     /// Removes the third dimension from this origin
+    #[must_use]
     pub fn to_2d(self) -> Origin2d {
         Origin2d {
             x: self.x,
@@ -5777,6 +5847,7 @@ impl Extent3d {
     /// This is the texture extent that you must upload at when uploading to _mipmaps_ of compressed textures.
     ///
     /// [physical size]: https://gpuweb.github.io/gpuweb/#physical-miplevel-specific-texture-extent
+    #[must_use]
     pub fn physical_size(&self, format: TextureFormat) -> Self {
         let (block_width, block_height) = format.block_dimensions();
 
@@ -5794,6 +5865,7 @@ impl Extent3d {
     ///
     /// Treats the depth as part of the mipmaps. If calculating
     /// for a 2DArray texture, which does not mipmap depth, set depth to 1.
+    #[must_use]
     pub fn max_mips(&self, dim: TextureDimension) -> u32 {
         match dim {
             TextureDimension::D1 => 1,
@@ -5812,6 +5884,7 @@ impl Extent3d {
     /// Does *not* account for memory size being a multiple of block size.
     ///
     /// <https://gpuweb.github.io/gpuweb/#logical-miplevel-specific-texture-extent>
+    #[must_use]
     pub fn mip_level_size(&self, level: u32, dim: TextureDimension) -> Self {
         Self {
             width: u32::max(1, self.width >> level),
@@ -5963,6 +6036,7 @@ pub struct TextureDescriptor<L, V> {
 
 impl<L, V> TextureDescriptor<L, V> {
     /// Takes a closure and maps the label of the texture descriptor into another.
+    #[must_use]
     pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> TextureDescriptor<K, V>
     where
         V: Clone,
@@ -5980,6 +6054,7 @@ impl<L, V> TextureDescriptor<L, V> {
     }
 
     /// Maps the label and view_formats of the texture descriptor into another.
+    #[must_use]
     pub fn map_label_and_view_formats<K, M>(
         &self,
         l_fun: impl FnOnce(&L) -> K,
@@ -6030,6 +6105,7 @@ impl<L, V> TextureDescriptor<L, V> {
     /// assert_eq!(desc.mip_level_size(6), Some(wgpu::Extent3d { width: 1, height: 1, depth_or_array_layers: 1 }));
     /// assert_eq!(desc.mip_level_size(7), None);
     /// ```
+    #[must_use]
     pub fn mip_level_size(&self, level: u32) -> Option<Extent3d> {
         if level >= self.mip_level_count {
             return None;
@@ -6041,6 +6117,7 @@ impl<L, V> TextureDescriptor<L, V> {
     /// Computes the render extent of this texture.
     ///
     /// <https://gpuweb.github.io/gpuweb/#abstract-opdef-compute-render-extent>
+    #[must_use]
     pub fn compute_render_extent(&self, mip_level: u32) -> Extent3d {
         Extent3d {
             width: u32::max(1, self.size.width >> mip_level),
@@ -6052,6 +6129,7 @@ impl<L, V> TextureDescriptor<L, V> {
     /// Returns the number of array layers.
     ///
     /// <https://gpuweb.github.io/gpuweb/#abstract-opdef-array-layer-count>
+    #[must_use]
     pub fn array_layer_count(&self) -> u32 {
         match self.dimension {
             TextureDimension::D1 | TextureDimension::D3 => 1,
@@ -6163,6 +6241,7 @@ pub struct CommandBufferDescriptor<L> {
 
 impl<L> CommandBufferDescriptor<L> {
     /// Takes a closure and maps the label of the command buffer descriptor into another.
+    #[must_use]
     pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> CommandBufferDescriptor<K> {
         CommandBufferDescriptor {
             label: fun(&self.label),
@@ -6211,6 +6290,7 @@ pub struct RenderBundleDescriptor<L> {
 
 impl<L> RenderBundleDescriptor<L> {
     /// Takes a closure and maps the label of the render bundle descriptor into another.
+    #[must_use]
     pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> RenderBundleDescriptor<K> {
         RenderBundleDescriptor {
             label: fun(&self.label),
@@ -6642,6 +6722,7 @@ pub enum BindingType {
 
 impl BindingType {
     /// Returns true for buffer bindings with dynamic offset enabled.
+    #[must_use]
     pub fn has_dynamic_offset(&self) -> bool {
         match *self {
             Self::Buffer {
@@ -6929,6 +7010,7 @@ impl ImageSubresourceRange {
     /// };
     /// assert_eq!(range_mixed.is_full_resource(wgpu::TextureFormat::Stencil8, 5, 10), false);
     /// ```
+    #[must_use]
     pub fn is_full_resource(
         &self,
         format: TextureFormat,
@@ -6955,6 +7037,7 @@ impl ImageSubresourceRange {
     }
 
     /// Returns the mip level range of a subresource range describes for a specific texture.
+    #[must_use]
     pub fn mip_range(&self, mip_level_count: u32) -> Range<u32> {
         self.base_mip_level..match self.mip_level_count {
             Some(mip_level_count) => self.base_mip_level + mip_level_count,
@@ -6963,6 +7046,7 @@ impl ImageSubresourceRange {
     }
 
     /// Returns the layer range of a subresource range describes for a specific texture.
+    #[must_use]
     pub fn layer_range(&self, array_layer_count: u32) -> Range<u32> {
         self.base_array_layer..match self.array_layer_count {
             Some(array_layer_count) => self.base_array_layer + array_layer_count,
@@ -7009,6 +7093,7 @@ pub struct QuerySetDescriptor<L> {
 
 impl<L> QuerySetDescriptor<L> {
     /// Takes a closure and maps the label of the query set descriptor into another.
+    #[must_use]
     pub fn map_label<'a, K>(&'a self, fun: impl FnOnce(&'a L) -> K) -> QuerySetDescriptor<K> {
         QuerySetDescriptor {
             label: fun(&self.label),
@@ -7103,6 +7188,7 @@ pub struct DrawIndirectArgs {
 
 impl DrawIndirectArgs {
     /// Returns the bytes representation of the struct, ready to be written in a buffer.
+    #[must_use]
     pub fn as_bytes(&self) -> &[u8] {
         unsafe {
             std::mem::transmute(std::slice::from_raw_parts(
@@ -7133,6 +7219,7 @@ pub struct DrawIndexedIndirectArgs {
 
 impl DrawIndexedIndirectArgs {
     /// Returns the bytes representation of the struct, ready to be written in a buffer.
+    #[must_use]
     pub fn as_bytes(&self) -> &[u8] {
         unsafe {
             std::mem::transmute(std::slice::from_raw_parts(
@@ -7157,6 +7244,7 @@ pub struct DispatchIndirectArgs {
 
 impl DispatchIndirectArgs {
     /// Returns the bytes representation of the struct, ready to be written into a buffer.
+    #[must_use]
     pub fn as_bytes(&self) -> &[u8] {
         unsafe {
             std::mem::transmute(std::slice::from_raw_parts(
@@ -7176,6 +7264,7 @@ pub struct ShaderBoundChecks {
 
 impl ShaderBoundChecks {
     /// Creates a new configuration where the shader is bound checked.
+    #[must_use]
     pub fn new() -> Self {
         ShaderBoundChecks {
             runtime_checks: true,
@@ -7187,6 +7276,7 @@ impl ShaderBoundChecks {
     /// # Safety
     /// The caller MUST ensure that all shaders built with this configuration don't perform any
     /// out of bounds reads or writes.
+    #[must_use]
     pub unsafe fn unchecked() -> Self {
         ShaderBoundChecks {
             runtime_checks: false,
@@ -7194,6 +7284,7 @@ impl ShaderBoundChecks {
     }
 
     /// Query whether runtime bound checks are enabled in this configuration
+    #[must_use]
     pub fn runtime_checks(&self) -> bool {
         self.runtime_checks
     }
diff --git a/wgpu/src/api/device.rs b/wgpu/src/api/device.rs
index fff1cf1bb..a6d447a8f 100644
--- a/wgpu/src/api/device.rs
+++ b/wgpu/src/api/device.rs
@@ -56,6 +56,7 @@ impl Device {
     /// The features which can be used on this device.
     ///
     /// No additional features can be used, even if the underlying adapter can support them.
+    #[must_use]
     pub fn features(&self) -> Features {
         DynContext::device_features(&*self.context, &self.id, self.data.as_ref())
     }
@@ -63,6 +64,7 @@ impl Device {
     /// The limits which can be used on this device.
     ///
     /// No better limits can be used, even if the underlying adapter can support them.
+    #[must_use]
     pub fn limits(&self) -> Limits {
         DynContext::device_limits(&*self.context, &self.id, self.data.as_ref())
     }
@@ -81,6 +83,7 @@ impl Device {
     /// input.
     ///
     /// </div>
+    #[must_use]
     pub fn create_shader_module(&self, desc: ShaderModuleDescriptor<'_>) -> ShaderModule {
         let (id, data) = DynContext::device_create_shader_module(
             &*self.context,
@@ -106,6 +109,7 @@ impl Device {
     /// operations.
     ///
     /// This has no effect on web.
+    #[must_use]
     pub unsafe fn create_shader_module_unchecked(
         &self,
         desc: ShaderModuleDescriptor<'_>,
@@ -132,6 +136,7 @@ impl Device {
     /// driver crash or bogus behaviour. No attempt is made to ensure that data is valid SPIR-V.
     ///
     /// See also [`include_spirv_raw!`] and [`util::make_spirv_raw`].
+    #[must_use]
     pub unsafe fn create_shader_module_spirv(
         &self,
         desc: &ShaderModuleDescriptorSpirV<'_>,
@@ -152,6 +157,7 @@ impl Device {
     }
 
     /// Creates an empty [`CommandEncoder`].
+    #[must_use]
     pub fn create_command_encoder(&self, desc: &CommandEncoderDescriptor<'_>) -> CommandEncoder {
         let (id, data) = DynContext::device_create_command_encoder(
             &*self.context,
@@ -167,6 +173,7 @@ impl Device {
     }
 
     /// Creates an empty [`RenderBundleEncoder`].
+    #[must_use]
     pub fn create_render_bundle_encoder(
         &self,
         desc: &RenderBundleEncoderDescriptor<'_>,
@@ -187,6 +194,7 @@ impl Device {
     }
 
     /// Creates a new [`BindGroup`].
+    #[must_use]
     pub fn create_bind_group(&self, desc: &BindGroupDescriptor<'_>) -> BindGroup {
         let (id, data) = DynContext::device_create_bind_group(
             &*self.context,
@@ -202,6 +210,7 @@ impl Device {
     }
 
     /// Creates a [`BindGroupLayout`].
+    #[must_use]
     pub fn create_bind_group_layout(
         &self,
         desc: &BindGroupLayoutDescriptor<'_>,
@@ -220,6 +229,7 @@ impl Device {
     }
 
     /// Creates a [`PipelineLayout`].
+    #[must_use]
     pub fn create_pipeline_layout(&self, desc: &PipelineLayoutDescriptor<'_>) -> PipelineLayout {
         let (id, data) = DynContext::device_create_pipeline_layout(
             &*self.context,
@@ -235,6 +245,7 @@ impl Device {
     }
 
     /// Creates a [`RenderPipeline`].
+    #[must_use]
     pub fn create_render_pipeline(&self, desc: &RenderPipelineDescriptor<'_>) -> RenderPipeline {
         let (id, data) = DynContext::device_create_render_pipeline(
             &*self.context,
@@ -250,6 +261,7 @@ impl Device {
     }
 
     /// Creates a [`ComputePipeline`].
+    #[must_use]
     pub fn create_compute_pipeline(&self, desc: &ComputePipelineDescriptor<'_>) -> ComputePipeline {
         let (id, data) = DynContext::device_create_compute_pipeline(
             &*self.context,
@@ -265,6 +277,7 @@ impl Device {
     }
 
     /// Creates a [`Buffer`].
+    #[must_use]
     pub fn create_buffer(&self, desc: &BufferDescriptor<'_>) -> Buffer {
         let mut map_context = MapContext::new(desc.size);
         if desc.mapped_at_creation {
@@ -287,6 +300,7 @@ impl Device {
     /// Creates a new [`Texture`].
     ///
     /// `desc` specifies the general format of the texture.
+    #[must_use]
     pub fn create_texture(&self, desc: &TextureDescriptor<'_>) -> Texture {
         let (id, data) =
             DynContext::device_create_texture(&*self.context, &self.id, self.data.as_ref(), desc);
@@ -311,6 +325,7 @@ impl Device {
     /// - `hal_texture` must be created respecting `desc`
     /// - `hal_texture` must be initialized
     #[cfg(wgpu_core)]
+    #[must_use]
     pub unsafe fn create_texture_from_hal<A: wgc::hal_api::HalApi>(
         &self,
         hal_texture: A::Texture,
@@ -350,6 +365,7 @@ impl Device {
     /// - `hal_buffer` must be created respecting `desc`
     /// - `hal_buffer` must be initialized
     #[cfg(wgpu_core)]
+    #[must_use]
     pub unsafe fn create_buffer_from_hal<A: wgc::hal_api::HalApi>(
         &self,
         hal_buffer: A::Buffer,
@@ -387,6 +403,7 @@ impl Device {
     /// Creates a new [`Sampler`].
     ///
     /// `desc` specifies the behavior of the sampler.
+    #[must_use]
     pub fn create_sampler(&self, desc: &SamplerDescriptor<'_>) -> Sampler {
         let (id, data) =
             DynContext::device_create_sampler(&*self.context, &self.id, self.data.as_ref(), desc);
@@ -398,6 +415,7 @@ impl Device {
     }
 
     /// Creates a new [`QuerySet`].
+    #[must_use]
     pub fn create_query_set(&self, desc: &QuerySetDescriptor<'_>) -> QuerySet {
         let (id, data) =
             DynContext::device_create_query_set(&*self.context, &self.id, self.data.as_ref(), desc);
@@ -442,6 +460,7 @@ impl Device {
     /// The `counters` cargo feature must be enabled for any counter to be set.
     ///
     /// If a counter is not set, its contains its default value (zero).
+    #[must_use]
     pub fn get_internal_counters(&self) -> wgt::InternalCounters {
         DynContext::device_get_internal_counters(&*self.context, &self.id, self.data.as_ref())
     }
@@ -451,6 +470,7 @@ impl Device {
     /// Backends that do not support producing these reports return `None`. A backend may
     /// Support it and still return `None` if it is not using performing sub-allocation,
     /// for example as a workaround for driver issues.
+    #[must_use]
     pub fn generate_allocator_report(&self) -> Option<wgt::AllocatorReport> {
         DynContext::generate_allocator_report(&*self.context, &self.id, self.data.as_ref())
     }
@@ -551,6 +571,7 @@ impl Device {
     /// version of wgpu; or was created for an incompatible adapter, or there was a GPU driver
     /// update. In some cases, the data might not be used and a real value is returned,
     /// this is left to the discretion of GPU drivers.
+    #[must_use]
     pub unsafe fn create_pipeline_cache(
         &self,
         desc: &PipelineCacheDescriptor<'_>,
diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs
index 413524ab0..7c085ec47 100644
--- a/wgpu/src/backend/wgpu_core.rs
+++ b/wgpu/src/backend/wgpu_core.rs
@@ -24,6 +24,7 @@ use std::{
     slice,
     sync::Arc,
 };
+use wgc::error::ContextErrorSource;
 use wgc::{
     command::bundle_ffi::*, device::DeviceLostClosure, id::CommandEncoderId, id::TextureViewId,
     pipeline::CreateShaderModuleError,
@@ -267,16 +268,18 @@ impl ContextWgpuCore {
         self.0.generate_report()
     }
 
-    fn handle_error(
+    #[cold]
+    #[inline(never)]
+    fn handle_error_inner(
         &self,
         sink_mutex: &Mutex<ErrorSinkRaw>,
-        source: impl Error + WasmNotSendSync + 'static,
+        source: ContextErrorSource,
         label: Label<'_>,
         fn_ident: &'static str,
     ) {
         let error = wgc::error::ContextError {
             fn_ident,
-            source: Box::new(source),
+            source,
             label: label.unwrap_or_default().to_string(),
         };
         let mut sink = sink_mutex.lock();
@@ -299,16 +302,29 @@ impl ContextWgpuCore {
         });
     }
 
+    #[inline]
+    fn handle_error(
+        &self,
+        sink_mutex: &Mutex<ErrorSinkRaw>,
+        source: impl Error + WasmNotSendSync + 'static,
+        label: Label<'_>,
+        fn_ident: &'static str,
+    ) {
+        self.handle_error_inner(sink_mutex, Box::new(source), label, fn_ident)
+    }
+
+    #[inline]
     fn handle_error_nolabel(
         &self,
         sink_mutex: &Mutex<ErrorSinkRaw>,
         source: impl Error + WasmNotSendSync + 'static,
         fn_ident: &'static str,
     ) {
-        self.handle_error(sink_mutex, source, None, fn_ident)
+        self.handle_error_inner(sink_mutex, Box::new(source), None, fn_ident)
     }
 
     #[track_caller]
+    #[cold]
     fn handle_error_fatal(
         &self,
         cause: impl Error + WasmNotSendSync + 'static,
@@ -317,6 +333,7 @@ impl ContextWgpuCore {
         panic!("Error in {operation}: {f}", f = self.format_error(&cause));
     }
 
+    #[inline(never)]
     fn format_error(&self, err: &(impl Error + 'static)) -> String {
         let mut output = String::new();
         let mut level = 1;


Test patch:
diff --git a/naga/tests/out/hlsl/image.hlsl b/naga/tests/out/hlsl/image.hlsl
index 1b41aa56e..5ad6d3d2c 100644
--- a/naga/tests/out/hlsl/image.hlsl
+++ b/naga/tests/out/hlsl/image.hlsl
@@ -3,9 +3,9 @@ Texture2DMS<uint4> image_multisampled_src : register(t3);
 Texture2DMS<float> image_depth_multisampled_src : register(t4);
 RWTexture2D<uint4> image_storage_src : register(u1);
 Texture2DArray<uint4> image_array_src : register(t5);
-RWTexture1D<uint4> image_dup_src : register(u6);
+RWTexture1D<uint> image_dup_src : register(u6);
 Texture1D<uint4> image_1d_src : register(t7);
-RWTexture1D<uint4> image_dst : register(u2);
+RWTexture1D<uint> image_dst : register(u2);
 Texture1D<float4> image_1d : register(t0);
 Texture2D<float4> image_2d : register(t1);
 Texture2D<uint4> image_2d_u32_ : register(t2);
diff --git a/tests/tests/bind_groups.rs b/tests/tests/bind_groups.rs
index fab1c065f..607e852a7 100644
--- a/tests/tests/bind_groups.rs
+++ b/tests/tests/bind_groups.rs
@@ -22,7 +22,7 @@ fn try_sampler_nonfiltering_layout(
     let sampler = ctx.device.create_sampler(descriptor);
 
     let create_bind_group = || {
-        ctx.device.create_bind_group(&wgpu::BindGroupDescriptor {
+        let _ = ctx.device.create_bind_group(&wgpu::BindGroupDescriptor {
             label,
             layout: &bind_group_layout,
             entries: &[wgpu::BindGroupEntry {
diff --git a/tests/tests/buffer.rs b/tests/tests/buffer.rs
index 80bb4b0c5..b3a48f178 100644
--- a/tests/tests/buffer.rs
+++ b/tests/tests/buffer.rs
@@ -220,7 +220,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_LAYOUT: GpuTestConfiguration = GpuTestConfigu
         wgpu_test::fail(
             &ctx.device,
             || {
-                ctx.device
+                let _ = ctx.device
                     .create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
                         label: None,
                         layout: Some(&pipeline_layout),
diff --git a/tests/tests/device.rs b/tests/tests/device.rs
index 4a636289b..0430f097f 100644
--- a/tests/tests/device.rs
+++ b/tests/tests/device.rs
@@ -295,7 +295,8 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device
+                let _ = ctx
+                    .device
                     .create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
             },
             Some("device with '' label is invalid"),
@@ -305,7 +306,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device.create_buffer(&wgpu::BufferDescriptor {
+                let _ = ctx.device.create_buffer(&wgpu::BufferDescriptor {
                     label: None,
                     size: 256,
                     usage: wgpu::BufferUsages::MAP_WRITE | wgpu::BufferUsages::COPY_SRC,
@@ -319,7 +320,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device.create_texture(&wgpu::TextureDescriptor {
+                let _ = ctx.device.create_texture(&wgpu::TextureDescriptor {
                     label: None,
                     size: wgpu::Extent3d {
                         width: 512,
@@ -458,7 +459,8 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device
+                let _ = ctx
+                    .device
                     .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
                         label: None,
                         entries: &[],
@@ -471,7 +473,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device.create_bind_group(&wgpu::BindGroupDescriptor {
+                let _ = ctx.device.create_bind_group(&wgpu::BindGroupDescriptor {
                     label: None,
                     layout: &bind_group_layout,
                     entries: &[wgpu::BindGroupEntry {
@@ -489,7 +491,8 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device
+                let _ = ctx
+                    .device
                     .create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
                         label: None,
                         bind_group_layouts: &[],
@@ -503,7 +506,8 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device
+                let _ = ctx
+                    .device
                     .create_shader_module(wgpu::ShaderModuleDescriptor {
                         label: None,
                         source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed("")),
@@ -516,7 +520,8 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || unsafe {
-                ctx.device
+                let _ = ctx
+                    .device
                     .create_shader_module_spirv(&wgpu::ShaderModuleDescriptorSpirV {
                         label: None,
                         source: std::borrow::Cow::Borrowed(&[]),
@@ -529,7 +534,8 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device
+                let _ = ctx
+                    .device
                     .create_render_pipeline(&wgpu::RenderPipelineDescriptor {
                         label: None,
                         layout: None,
@@ -554,7 +560,8 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device
+                let _ = ctx
+                    .device
                     .create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
                         label: None,
                         layout: None,
@@ -571,7 +578,8 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
         fail(
             &ctx.device,
             || {
-                ctx.device
+                let _ = ctx
+                    .device
                     .create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
                         label: None,
                         layout: None,
@@ -852,7 +860,7 @@ static DIFFERENT_BGL_ORDER_BW_SHADER_AND_API: GpuTestConfiguration = GpuTestConf
 
         // fail(&ctx.device, || {
         // }, "");
-        ctx.device.create_bind_group(&wgpu::BindGroupDescriptor {
+        let _ = ctx.device.create_bind_group(&wgpu::BindGroupDescriptor {
             label: None,
             layout: &render_pipeline.get_bind_group_layout(0),
             entries: &[
diff --git a/tests/tests/pipeline.rs b/tests/tests/pipeline.rs
index 3cf8d13df..4c3888a21 100644
--- a/tests/tests/pipeline.rs
+++ b/tests/tests/pipeline.rs
@@ -58,7 +58,8 @@ static NO_TARGETLESS_RENDER: GpuTestConfiguration = GpuTestConfiguration::new()
                 // tries to compile code in an unsupported multisample count. Failing to validate here
                 // has historically resulted in requesting the back end to compile code.
                 for power_of_two in [1, 2, 4, 8, 16, 32, 64] {
-                    ctx.device
+                    let _ = ctx
+                        .device
                         .create_render_pipeline(&wgpu::RenderPipelineDescriptor {
                             label: None,
                             layout: None,
diff --git a/tests/tests/regression/issue_5553.rs b/tests/tests/regression/issue_5553.rs
index 6debb0348..01ffb59d1 100644
--- a/tests/tests/regression/issue_5553.rs
+++ b/tests/tests/regression/issue_5553.rs
@@ -24,7 +24,8 @@ static ALLOW_INPUT_NOT_CONSUMED: GpuTestConfiguration =
                 push_constant_ranges: &[],
             });
 
-        ctx.device
+        let _ = ctx
+            .device
             .create_render_pipeline(&RenderPipelineDescriptor {
                 label: Some("Pipeline"),
                 layout: Some(&pipeline_layout),