RenderPassDescriptor: make label lifetime match doc, and make names descriptive. #2654
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Lifetime names like
<'a, 'b>
mean that the reader must look at how they are used to understand them. By changing them to'tex
(lifetime of borrows of the texture views the documentation describes) and'desc
(everything else), and mentioning them in the documentation, it's more obvious which role each one plays.For consistency, I also changed
begin_render_pass()
,RenderPassColorAttachment
, andRenderPassDepthStencilAttachment
to use matching lifetime names.Also, this made it clear that the
Label
had the wrong lifetime -- the docs say that the texture views have a different lifetime from “everything else”, but theLabel
in fact had the same lifetime as the texture views, so I changed it to the'desc
(formerly'b
) lifetime. (On review of change history, this mismatch was previously introduced in commit 632f828.) This change is definitely safe because I followed the data flow down toBasePass::new
which promptly callsto_string()
on the label, thus converting it to owned data.Testing
As this only weakens lifetimes (which cannot change run-time behavior or stop a program from compiling) and renames them (which is not an API surface change) it should not have any effect other than allowing some programs with short-lived labels to compile when they would not have otherwise. That said, I ran
cargo nextest run --no-fail-fast
and all tests passed except forexample/shadow
which always fails on my machine.