Skip to content

Commit 8a74be6

Browse files
committed
Add source information the const propagation of places
1 parent 5950496 commit 8a74be6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/librustc_mir/transform/const_prop.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,14 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> {
233233
}
234234
}
235235

236-
fn eval_place(&mut self, place: &Place<'tcx>) -> Option<Const<'tcx>> {
236+
fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option<Const<'tcx>> {
237237
match *place {
238238
Place::Local(loc) => self.places[loc].clone(),
239239
Place::Projection(ref proj) => match proj.elem {
240240
ProjectionElem::Field(field, _) => {
241241
trace!("field proj on {:?}", proj.base);
242-
let (base, ty, span) = self.eval_place(&proj.base)?;
243-
let valty = self.use_ecx(span, |this| {
242+
let (base, ty, span) = self.eval_place(&proj.base, source_info)?;
243+
let valty = self.use_ecx(source_info, |this| {
244244
this.ecx.read_field(base, None, field, ty)
245245
})?;
246246
Some((valty.value, valty.ty, span))
@@ -254,7 +254,8 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> {
254254
fn eval_operand(&mut self, op: &Operand<'tcx>, source_info: SourceInfo) -> Option<Const<'tcx>> {
255255
match *op {
256256
Operand::Constant(ref c) => self.eval_constant(c, source_info),
257-
Operand::Move(ref place) | Operand::Copy(ref place) => self.eval_place(place),
257+
| Operand::Move(ref place)
258+
| Operand::Copy(ref place) => self.eval_place(place, source_info),
258259
}
259260
}
260261

0 commit comments

Comments
 (0)