Rename IndexVec::last
→ last_index
As I've been trying to replace a `Vec` with an `IndexVec`, having `last` exist on both but returning very different types makes the transition a bit awkward -- the errors are later, where you get things like "there's no `ty` method on `mir::Field`" rather than a more localized error like "hey, there's no `last` on `IndexVec`". So I propose renaming `last` to `last_index` to help distinguish `Vec::last`, which returns an element, and `IndexVec::last_index`, which returns an index. (Similarly, `Iterator::last` also returns an element, not an index.)
This commit is contained in:
parent
acd27bb557
commit
843c5e361e
4 changed files with 5 additions and 5 deletions
|
@ -707,7 +707,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
|
|||
}
|
||||
|
||||
fn assign(&mut self, dest: Local, rvalue: Rvalue<'tcx>, span: Span) {
|
||||
let last = self.promoted.basic_blocks.last().unwrap();
|
||||
let last = self.promoted.basic_blocks.last_index().unwrap();
|
||||
let data = &mut self.promoted[last];
|
||||
data.statements.push(Statement {
|
||||
source_info: SourceInfo::outermost(span),
|
||||
|
@ -800,7 +800,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
|
|||
self.visit_operand(arg, loc);
|
||||
}
|
||||
|
||||
let last = self.promoted.basic_blocks.last().unwrap();
|
||||
let last = self.promoted.basic_blocks.last_index().unwrap();
|
||||
let new_target = self.new_block();
|
||||
|
||||
*self.promoted[last].terminator_mut() = Terminator {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue