Skip to content

Commit 7746829

Browse files
committed
Use fully qualified syntax for some calls.
Without this change, rust-analyzer cannot determine the type of cmd_buf.
1 parent c1934dc commit 7746829

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

wgpu-core/src/command/compute.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +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)
313-
.map_pass_err(init_scope)?;
312+
let result = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id);
313+
// Call using fully qualified syntax, to placate rust-analyzer.
314+
let cmd_buf = MapPassErr::<&mut CommandBuffer<A>, _>::map_pass_err(result, init_scope)?;
314315
// will be reset to true if recording is done without errors
315316
cmd_buf.status = CommandEncoderStatus::Error;
316317
let raw = cmd_buf.encoder.open();

wgpu-core/src/command/render.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +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)
1054-
.map_pass_err(init_scope)?;
1053+
let result = CommandBuffer::get_encoder_mut(&mut *cmb_guard, encoder_id);
1054+
// Call using fully qualified syntax, to placate rust-analyzer.
1055+
let cmd_buf = MapPassErr::<&mut CommandBuffer<A>, _>::map_pass_err(result, init_scope)?;
10551056
// close everything while the new command encoder is filled
10561057
cmd_buf.encoder.close();
10571058
// will be reset to true if recording is done without errors

0 commit comments

Comments
 (0)