mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-08 13:20:11 +00:00

coverage: Simplify the `coverageinfo` query The `coverageinfo` query walks through a `mir::Body`'s statements to find the total number of coverage counter IDs and coverage expression IDs that have been used, as this information is needed by coverage codegen. This PR makes 3 nice simplifications to that query: - Extract a common iterator over coverage statements, shared by both coverage-related queries - Simplify the query's visitor from two passes to just one pass - Explicitly track the highest seen IDs in the visitor, and only convert to a count right at the end I also updated some related comments. Some had been invalidated by these changes, while others had already been invalidated by previous coverage changes.