gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
11.46k stars 855 forks source link

[naga] Clarify `Debug` form of `arena::Range`. #5873

Closed jimblandy closed 4 days ago

jimblandy commented 4 days ago

Change the std::fmt::Debug impl for naga::arena::Range to print a start-inclusive, end-exclusive range.

teoxoy commented 4 days ago
  • It is not consistent with Naga's constructor function Range::new_from_bounds, which takes an inclusive end value, or with Range::first_and_last, which returns an inclusive end value. Both of these need to represent ranges' end points as Handles, but exclusive end values might not be valid Handle values. I think this divergence is tolerable.

I think the divergence makes sense in this case.


This change looks consistent with the way we index in the Arena as well.

https://github.com/gfx-rs/wgpu/blob/a5d57db2694e73bda6dbfdf691d6b7fab267d554/naga/src/arena/mod.rs#L284