Skip to content

Commit f5593e3

Browse files
committed
Spell out the type of the result from map_pass_err.
Without these changes, rust-analyzer cannot determine the type of `cmd_buf`.
1 parent c1934dc commit f5593e3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

wgpu-core/src/command/compute.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
309309
let (device_guard, mut token) = hub.devices.read(&mut token);
310310

311311
let (mut cmd_buf_guard, mut token) = hub.command_buffers.write(&mut token);
312-
let cmd_buf = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id)
312+
// Spell out the type, to placate rust-analyzer.
313+
// https://github.com/rust-lang/rust-analyzer/issues/12247
314+
let cmd_buf: &mut CommandBuffer<A> = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id)
313315
.map_pass_err(init_scope)?;
314316
// will be reset to true if recording is done without errors
315317
cmd_buf.status = CommandEncoderStatus::Error;

wgpu-core/src/command/render.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
10501050
let (trackers, query_reset_state, pending_discard_init_fixups) = {
10511051
let (mut cmb_guard, mut token) = hub.command_buffers.write(&mut token);
10521052

1053-
let cmd_buf = CommandBuffer::get_encoder_mut(&mut *cmb_guard, encoder_id)
1053+
// Spell out the type, to placate rust-analyzer.
1054+
// https://github.com/rust-lang/rust-analyzer/issues/12247
1055+
let cmd_buf: &mut CommandBuffer<A> = CommandBuffer::get_encoder_mut(&mut *cmb_guard, encoder_id)
10541056
.map_pass_err(init_scope)?;
10551057
// close everything while the new command encoder is filled
10561058
cmd_buf.encoder.close();

0 commit comments

Comments
 (0)