docs/review-checklist.md
This is a collection of notes on things to watch out for when reviewing pull requests submitted to wgpu and Naga.
Ideally, we want to keep items off this list entirely:
Using Rust effectively can turn some mistakes into compile-time errors. For example, in Naga, using exhaustive matching ensures that changes to the IR will cause compile-time errors in any code that hasn't been updated.
Refactoring can gather together all the code responsible for
enforcing some invariant in one place, making it clear whether a
change preserves it or not. For example, Naga localizes all handle
validation to naga::valid::Validator::validate_module_handles,
allowing the rest of the validator to assume that all handles are
valid.
Offering custom abstractions can help contributors avoid
implementing a weaker abstraction by themselves. For example,
because HandleSet and HandleVec are used throughout Naga,
contributors are less likely to write code that uses a BitSet or
Vec on handle indices, which would invite bugs by erasing the
handle types.
This checklist gathers up the concerns that we haven't found a satisfying way to address in a more robust way.
HashMap and
HashSet is fine, as long as you don't iterate over it.insert's
return value?Capability flag for it?If your change adds or removes Handles from the IR:
valid::handles?compact?back::pipeline_constants::adjust_expr?If your change adds a new operation:
proc::typifier?valid::expression?proc::constant_evaluator?Namer to generate a fresh identifier?Namer?Namer?