mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Add and use IndexVec::append
This commit is contained in:
parent
80eb5a8e91
commit
0a34ce49ce
@ -188,6 +188,11 @@ impl<I: Idx, T> IndexVec<I, T> {
|
|||||||
let min_new_len = elem.index() + 1;
|
let min_new_len = elem.index() + 1;
|
||||||
self.raw.resize_with(min_new_len, fill_value);
|
self.raw.resize_with(min_new_len, fill_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn append(&mut self, other: &mut Self) {
|
||||||
|
self.raw.append(&mut other.raw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `IndexVec` is often used as a map, so it provides some map-like APIs.
|
/// `IndexVec` is often used as a map, so it provides some map-like APIs.
|
||||||
|
@ -726,7 +726,7 @@ impl<'tcx> Inliner<'tcx> {
|
|||||||
|
|
||||||
// Insert all of the (mapped) parts of the callee body into the caller.
|
// Insert all of the (mapped) parts of the callee body into the caller.
|
||||||
caller_body.local_decls.extend(callee_body.drain_vars_and_temps());
|
caller_body.local_decls.extend(callee_body.drain_vars_and_temps());
|
||||||
caller_body.source_scopes.extend(&mut callee_body.source_scopes.drain(..));
|
caller_body.source_scopes.append(&mut callee_body.source_scopes);
|
||||||
if self
|
if self
|
||||||
.tcx
|
.tcx
|
||||||
.sess
|
.sess
|
||||||
@ -740,7 +740,7 @@ impl<'tcx> Inliner<'tcx> {
|
|||||||
// still getting consistent results from the mir-opt tests.
|
// still getting consistent results from the mir-opt tests.
|
||||||
caller_body.var_debug_info.append(&mut callee_body.var_debug_info);
|
caller_body.var_debug_info.append(&mut callee_body.var_debug_info);
|
||||||
}
|
}
|
||||||
caller_body.basic_blocks_mut().extend(callee_body.basic_blocks_mut().drain(..));
|
caller_body.basic_blocks_mut().append(callee_body.basic_blocks_mut());
|
||||||
|
|
||||||
caller_body[callsite.block].terminator = Some(Terminator {
|
caller_body[callsite.block].terminator = Some(Terminator {
|
||||||
source_info: callsite.source_info,
|
source_info: callsite.source_info,
|
||||||
|
Loading…
Reference in New Issue
Block a user