Skip to content

Commit d9ddb64

Browse files
committed
re-name stuff
1 parent 4d4b0f1 commit d9ddb64

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

compiler/rustc_middle/src/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ pub enum LocalInfo<'tcx> {
10801080
/// (e.g. a temporary for `foo` in `MyStruct { my_field: foo }`)
10811081
AggregateTemp,
10821082
/// A temporary created during the pass `Derefer` to avoid it's retagging
1083-
Temp,
1083+
DerefTemp,
10841084
}
10851085

10861086
impl<'tcx> LocalDecl<'tcx> {

compiler/rustc_middle/src/mir/patch.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,22 @@ impl<'tcx> MirPatch<'tcx> {
7878
Location { block: bb, statement_index: offset }
7979
}
8080

81-
pub fn new_local_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
81+
pub fn new_local_with_info(
82+
&mut self,
83+
ty: Ty<'tcx>,
84+
span: Span,
85+
local_info: Option<Box<LocalInfo<'tcx>>>,
86+
) -> Local {
8287
let index = self.next_local;
8388
self.next_local += 1;
8489
let mut new_decl = LocalDecl::new(ty, span);
85-
new_decl.local_info = Some(Box::new(LocalInfo::Temp));
90+
new_decl.local_info = local_info;
8691
self.new_locals.push(new_decl);
8792
Local::new(index as usize)
8893
}
8994

9095
pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
91-
let index = self.next_local;
92-
self.next_local += 1;
93-
self.new_locals.push(LocalDecl::new(ty, span));
94-
Local::new(index as usize)
96+
self.new_local_with_info(ty, span, None)
9597
}
9698

9799
pub fn new_internal(&mut self, ty: Ty<'tcx>, span: Span) -> Local {

compiler/rustc_mir_transform/src/add_retag.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn may_be_reference(ty: Ty<'_>) -> bool {
6161
fn is_not_temp<'tcx>(local_decl: &LocalDecl<'tcx>) -> bool {
6262
if let Some(local_info) = &local_decl.local_info {
6363
match local_info.as_ref() {
64-
LocalInfo::Temp => return false,
64+
LocalInfo::DerefTemp => return false,
6565
_ => (),
6666
};
6767
}

compiler/rustc_mir_transform/src/deref_separator.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> {
3333
for (idx, (p_ref, p_elem)) in place.iter_projections().enumerate() {
3434
if p_elem == ProjectionElem::Deref && !p_ref.projection.is_empty() {
3535
let ty = p_ref.ty(&self.local_decls, self.tcx).ty;
36-
let temp =
37-
self.patcher.new_local_temp(ty, self.local_decls[p_ref.local].source_info.span);
36+
let temp = self.patcher.new_local_with_info(
37+
ty,
38+
self.local_decls[p_ref.local].source_info.span,
39+
Some(Box::new(LocalInfo::DerefTemp)),
40+
);
3841

3942
self.patcher.add_statement(loc, StatementKind::StorageLive(temp));
4043

0 commit comments

Comments
 (0)