Skip to content

[core] Doc fixes related to mapping callback management.#9512

Open
jimblandy wants to merge 1 commit intogfx-rs:trunkfrom
jimblandy:map-callback-docs
Open

[core] Doc fixes related to mapping callback management.#9512
jimblandy wants to merge 1 commit intogfx-rs:trunkfrom
jimblandy:map-callback-docs

Conversation

@jimblandy
Copy link
Copy Markdown
Member

Add a few comments to tricky corners involved in ensuring that mapping callbacks are always invoked, never dropped.

Add a few comments to tricky corners involved in ensuring that mapping
callbacks are always invoked, never dropped.
@jimblandy jimblandy added the area: documentation Documentation for crate items, public or private label May 6, 2026
Comment thread wgpu-core/src/resource.rs
Comment on lines +447 to +450
/// to the same buffer. The cycle is intentional — it keeps the buffer alive
/// while it sits in `LifetimeTracker::ready_to_map` with no other owner —
/// and is broken by `Buffer::map` when it moves the `BufferPendingMapping`
/// out of [`Buffer::map_state`].
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// to the same buffer. The cycle is intentional — it keeps the buffer alive
/// while it sits in `LifetimeTracker::ready_to_map` with no other owner —
/// and is broken by `Buffer::map` when it moves the `BufferPendingMapping`
/// out of [`Buffer::map_state`].
/// to the same buffer. The cycle is intentional, and is broken by
/// `Buffer::map` when it moves the `BufferPendingMapping` out of
/// [`Buffer::map_state`]. TODO: clarify the purpose of this

As we discussed offline, I'm not sure this fully captures what's going on here, I think we should revisit it.

@andyleiserson andyleiserson self-assigned this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: documentation Documentation for crate items, public or private

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants