exp-stuff-dirty
This commit is contained in:
parent
0e7915d11f
commit
f1c5f34f76
34 changed files with 65 additions and 141 deletions
|
@ -1079,6 +1079,8 @@ pub enum LocalInfo<'tcx> {
|
|||
/// A temporary created during the creation of an aggregate
|
||||
/// (e.g. a temporary for `foo` in `MyStruct { my_field: foo }`)
|
||||
AggregateTemp,
|
||||
/// A temporary created during the pass `Derefer` to avoid it's retagging
|
||||
Temp,
|
||||
}
|
||||
|
||||
impl<'tcx> LocalDecl<'tcx> {
|
||||
|
@ -1178,6 +1180,10 @@ impl<'tcx> LocalDecl<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn temp(mut self) {
|
||||
self.local_info = Some(Box::new(LocalInfo::Temp));
|
||||
}
|
||||
|
||||
/// Converts `self` into same `LocalDecl` except tagged as internal.
|
||||
#[inline]
|
||||
pub fn internal(mut self) -> Self {
|
||||
|
|
|
@ -78,6 +78,15 @@ impl<'tcx> MirPatch<'tcx> {
|
|||
Location { block: bb, statement_index: offset }
|
||||
}
|
||||
|
||||
pub fn new_local_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
|
||||
let index = self.next_local;
|
||||
self.next_local += 1;
|
||||
let mut new_decl = LocalDecl::new(ty, span);
|
||||
new_decl.local_info = Some(Box::new(LocalInfo::Temp));
|
||||
self.new_locals.push(new_decl);
|
||||
Local::new(index as usize)
|
||||
}
|
||||
|
||||
pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
|
||||
let index = self.next_local;
|
||||
self.next_local += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue