Spell out the type of the result from map_pass_err.

Without these changes, rust-analyzer cannot determine the type of
`cmd_buf`.
This commit is contained in:
Jim Blandy 2022-05-13 14:29:44 -07:00
parent 8e5ac75d45
commit 284ed4654e
2 changed files with 10 additions and 4 deletions

View File

@ -309,8 +309,11 @@ 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)
.map_pass_err(init_scope)?;
// 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;
let raw = cmd_buf.encoder.open();

View File

@ -1050,8 +1050,11 @@ 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)
.map_pass_err(init_scope)?;
// 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();
// will be reset to true if recording is done without errors