1
Fork 0

Rollup merge of #86362 - ptrojahn:insert_vars_and_temps, r=jackh726

Avoid cloning LocalDecls
This commit is contained in:
Mara Bos 2021-08-31 17:54:53 +02:00 committed by GitHub
commit 175c8cb851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View file

@ -426,6 +426,11 @@ impl<'tcx> Body<'tcx> {
(arg_count + 1..local_count).map(Local::new)
}
#[inline]
pub fn drain_vars_and_temps<'a>(&'a mut self) -> impl Iterator<Item = LocalDecl<'tcx>> + 'a {
self.local_decls.drain(self.arg_count + 1..)
}
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
/// invalidating statement indices in `Location`s.
pub fn make_statement_nop(&mut self, location: Location) {