Skip to content

Commit 064cf55

Browse files
committed
Normalize associated types in various parts of adt
1 parent dfd557b commit 064cf55

File tree

1 file changed

+9
-8
lines changed
  • src/librustc_trans/trans

1 file changed

+9
-8
lines changed

src/librustc_trans/trans/adt.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@ use std::rc::Rc;
5151
use llvm::{ValueRef, True, IntEQ, IntNE};
5252
use back::abi::FAT_PTR_ADDR;
5353
use middle::subst;
54-
use middle::subst::Subst;
54+
use middle::ty::{mod, Ty, UnboxedClosureTyper};
55+
use middle::ty::Disr;
56+
use syntax::ast;
57+
use syntax::attr;
58+
use syntax::attr::IntType;
5559
use trans::_match;
5660
use trans::build::*;
5761
use trans::cleanup;
5862
use trans::cleanup::CleanupMethods;
5963
use trans::common::*;
6064
use trans::datum;
6165
use trans::machine;
66+
use trans::monomorphize;
6267
use trans::type_::Type;
6368
use trans::type_of;
64-
use middle::ty::{self, Ty, UnboxedClosureTyper};
65-
use middle::ty::Disr;
66-
use syntax::ast;
67-
use syntax::attr;
68-
use syntax::attr::IntType;
6969
use util::ppaux::ty_to_string;
7070

7171
type Hint = attr::ReprAttr;
@@ -159,7 +159,8 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
159159
ty::ty_struct(def_id, substs) => {
160160
let fields = ty::lookup_struct_fields(cx.tcx(), def_id);
161161
let mut ftys = fields.iter().map(|field| {
162-
ty::lookup_field_type(cx.tcx(), def_id, field.id, substs)
162+
let fty = ty::lookup_field_type(cx.tcx(), def_id, field.id, substs);
163+
monomorphize::normalize_associated_type(cx.tcx(), &fty)
163164
}).collect::<Vec<_>>();
164165
let packed = ty::lookup_packed(cx.tcx(), def_id);
165166
let dtor = ty::ty_dtor(cx.tcx(), def_id).has_drop_flag();
@@ -432,7 +433,7 @@ fn get_cases<'tcx>(tcx: &ty::ctxt<'tcx>,
432433
-> Vec<Case<'tcx>> {
433434
ty::enum_variants(tcx, def_id).iter().map(|vi| {
434435
let arg_tys = vi.args.iter().map(|&raw_ty| {
435-
raw_ty.subst(tcx, substs)
436+
monomorphize::apply_param_substs(tcx, substs, &raw_ty)
436437
}).collect();
437438
Case { discr: vi.disr_val, tys: arg_tys }
438439
}).collect()

0 commit comments

Comments
 (0)