Skip to content

Commit 619db9d

Browse files
committed
---
yaml --- r: 273262 b: refs/heads/beta c: 56417b3 h: refs/heads/master
1 parent fa2933e commit 619db9d

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: f9c06abc211f76004f3f558753d5d992ab32d223
26+
refs/heads/beta: 56417b373253932a19e811d001f63ef99f9d4d13
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc/mir/tcx.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use mir::repr::*;
1717
use middle::subst::{Subst, Substs};
1818
use middle::ty::{self, AdtDef, Ty, TyCtxt};
19+
use middle::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
1920
use rustc_front::hir;
2021

2122
#[derive(Copy, Clone, Debug)]
@@ -77,6 +78,29 @@ impl<'tcx> LvalueTy<'tcx> {
7778
}
7879
}
7980

81+
impl<'tcx> TypeFoldable<'tcx> for LvalueTy<'tcx> {
82+
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
83+
match *self {
84+
LvalueTy::Ty { ty } => LvalueTy::Ty { ty: ty.fold_with(folder) },
85+
LvalueTy::Downcast { adt_def, substs, variant_index } => {
86+
let substs = substs.fold_with(folder);
87+
LvalueTy::Downcast {
88+
adt_def: adt_def,
89+
substs: folder.tcx().mk_substs(substs),
90+
variant_index: variant_index
91+
}
92+
}
93+
}
94+
}
95+
96+
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
97+
match *self {
98+
LvalueTy::Ty { ty } => ty.visit_with(visitor),
99+
LvalueTy::Downcast { substs, .. } => substs.visit_with(visitor)
100+
}
101+
}
102+
}
103+
80104
impl<'tcx> Mir<'tcx> {
81105
pub fn operand_ty(&self,
82106
tcx: &TyCtxt<'tcx>,

branches/beta/src/librustc_trans/trans/mir/lvalue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
114114
mir::Lvalue::Projection(ref projection) => {
115115
let tr_base = self.trans_lvalue(bcx, &projection.base);
116116
let projected_ty = tr_base.ty.projection_ty(tcx, &projection.elem);
117+
let projected_ty = bcx.monomorphize(&projected_ty);
117118
let (llprojected, llextra) = match projection.elem {
118119
mir::ProjectionElem::Deref => {
119120
let base_ty = tr_base.ty.to_ty(tcx);

0 commit comments

Comments
 (0)