Update these ranges to reflect that the list they refer to has been reversed. Afterwards, the ranges will still be indexed in the same order, but the first range will refer to the same-length range at the end of the target list instead of at the beginning, and subsequent ranges will proceed backwards from there. ```ignore use cranelift_codegen::ranges::Ranges; let mut ranges = Ranges::default();
(&mut self, target_len: usize)
| 116 | /// assert_eq!(ranges.get(1), 0..2); |
| 117 | /// ``` |
| 118 | pub fn reverse_target(&mut self, target_len: usize) { |
| 119 | let target_len = u32::try_from(target_len).unwrap(); |
| 120 | // The last endpoint added should be the same as the current |
| 121 | // length of the target list. |
| 122 | debug_assert_eq!(target_len, *self.ranges.last().unwrap_or(&0)); |
| 123 | for end in self.ranges.iter_mut() { |
| 124 | *end = target_len - *end; |
| 125 | } |
| 126 | // Put the endpoints back in ascending order, but that means |
| 127 | // now our indexes are backwards. |
| 128 | self.ranges.reverse(); |
| 129 | self.reverse_index(); |
| 130 | } |
| 131 | } |
no test coverage detected