Skip to content

Commit

Permalink
Spell out the type of the result from map_pass_err.
Browse files Browse the repository at this point in the history
Without these changes, rust-analyzer cannot determine the type of
`cmd_buf`.
  • Loading branch information
jimblandy committed May 14, 2022
1 parent c1934dc commit f5593e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion wgpu-core/src/command/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let (device_guard, mut token) = hub.devices.read(&mut token);

let (mut cmd_buf_guard, mut token) = hub.command_buffers.write(&mut token);
let cmd_buf = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id)
// Spell out the type, to placate rust-analyzer.
// https://github.com/rust-lang/rust-analyzer/issues/12247
let cmd_buf: &mut CommandBuffer<A> = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id)
.map_pass_err(init_scope)?;
// will be reset to true if recording is done without errors
cmd_buf.status = CommandEncoderStatus::Error;
Expand Down
4 changes: 3 additions & 1 deletion wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let (trackers, query_reset_state, pending_discard_init_fixups) = {
let (mut cmb_guard, mut token) = hub.command_buffers.write(&mut token);

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

0 comments on commit f5593e3

Please sign in to comment.