Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4cedcbd

Browse files
committedMar 17, 2016
---
yaml --- r: 282022 b: refs/heads/stable c: 56417b3 h: refs/heads/master
1 parent c8d89c4 commit 4cedcbd

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
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 3c795e08d6f4a532f12f3f8e1837db5e0647f8b0
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: f9c06abc211f76004f3f558753d5d992ab32d223
32+
refs/heads/stable: 56417b373253932a19e811d001f63ef99f9d4d13
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

‎branches/stable/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/stable/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)
Please sign in to comment.