Skip to content

Commit dfab092

Browse files
promote_consts: make assign take a Local
1 parent 66d2f34 commit dfab092

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustc_mir/transform/promote_consts.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
171171
})
172172
}
173173

174-
fn assign(&mut self, dest: Lvalue<'tcx>, rvalue: Rvalue<'tcx>, span: Span) {
174+
fn assign(&mut self, dest: Local, rvalue: Rvalue<'tcx>, span: Span) {
175175
let last = self.promoted.basic_blocks().last().unwrap();
176176
let data = &mut self.promoted[last];
177177
data.statements.push(Statement {
178178
source_info: SourceInfo {
179179
span: span,
180180
scope: ARGUMENT_VISIBILITY_SCOPE
181181
},
182-
kind: StatementKind::Assign(dest, rvalue)
182+
kind: StatementKind::Assign(Lvalue::Local(dest), rvalue)
183183
});
184184
}
185185

@@ -272,7 +272,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
272272

273273
// Inject the Rvalue or Call into the promoted MIR.
274274
if stmt_idx < no_stmts {
275-
self.assign(Lvalue::Local(new_temp), rvalue.unwrap(), source_info.span);
275+
self.assign(new_temp, rvalue.unwrap(), source_info.span);
276276
} else {
277277
let last = self.promoted.basic_blocks().last().unwrap();
278278
let new_target = self.new_block();
@@ -327,7 +327,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
327327
statement_index: usize::MAX
328328
});
329329

330-
self.assign(Lvalue::Local(RETURN_POINTER), rvalue, span);
330+
self.assign(RETURN_POINTER, rvalue, span);
331331
self.source.promoted.push(self.promoted);
332332
}
333333
}

0 commit comments

Comments
 (0)