Skip to content

Commit 58f31e8

Browse files
nikomatsakisalexcrichton
authored andcommitted
Simplify MonoId not to include parameters which, given coherence, are purely derived
1 parent 2d695a3 commit 58f31e8

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

src/librustc/middle/trans/monomorphize.rs

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,7 @@ pub fn monomorphic_fn(ccx: &CrateContext,
5555
let _icx = push_ctxt("monomorphic_fn");
5656

5757
let substs_iter = real_substs.self_ty.iter().chain(real_substs.tps.iter());
58-
let param_ids: Vec<MonoParamId> = match vtables {
59-
Some(ref vts) => {
60-
debug!("make_mono_id vtables={} psubsts={}",
61-
vts.repr(ccx.tcx()), real_substs.tps.repr(ccx.tcx()));
62-
let vts_iter = self_vtables.iter().chain(vts.iter());
63-
vts_iter.zip(substs_iter).map(|(vtable, subst)| MonoParamId {
64-
subst: *subst,
65-
// Do we really need the vtables to be hashed? Isn't the type enough?
66-
vtables: vtable.iter().map(|vt| make_vtable_id(ccx, vt)).collect()
67-
}).collect()
68-
}
69-
None => substs_iter.map(|subst| MonoParamId {
70-
subst: *subst,
71-
vtables: Vec::new()
72-
}).collect()
73-
};
74-
58+
let param_ids: Vec<ty::t> = substs_iter.map(|t| *t).collect();
7559
let hash_id = MonoId {
7660
def: fn_id,
7761
params: param_ids
@@ -317,33 +301,22 @@ pub fn monomorphic_fn(ccx: &CrateContext,
317301
#[deriving(PartialEq, Eq, Hash)]
318302
pub struct MonoParamId {
319303
pub subst: ty::t,
320-
// Do we really need the vtables to be hashed? Isn't the type enough?
321-
pub vtables: Vec<MonoId>
322304
}
323305

324306
#[deriving(PartialEq, Eq, Hash)]
325307
pub struct MonoId {
326308
pub def: ast::DefId,
327-
pub params: Vec<MonoParamId>
309+
pub params: Vec<ty::t>
328310
}
329311

330-
pub fn make_vtable_id(ccx: &CrateContext,
312+
pub fn make_vtable_id(_ccx: &CrateContext,
331313
origin: &typeck::vtable_origin)
332314
-> MonoId {
333315
match origin {
334-
&typeck::vtable_static(impl_id, ref substs, ref sub_vtables) => {
316+
&typeck::vtable_static(impl_id, ref substs, _) => {
335317
MonoId {
336318
def: impl_id,
337-
// FIXME(NDM) -- this is pretty bogus. It ignores self-type,
338-
// and vtables are not necessary, AND they are not guaranteed
339-
// to be same length as the number of TPS ANYHOW!
340-
params: sub_vtables.iter().zip(substs.tps.iter()).map(|(vtable, subst)| {
341-
MonoParamId {
342-
subst: *subst,
343-
// Do we really need the vtables to be hashed? Isn't the type enough?
344-
vtables: vtable.iter().map(|vt| make_vtable_id(ccx, vt)).collect()
345-
}
346-
}).collect()
319+
params: substs.tps.iter().map(|subst| *subst).collect()
347320
}
348321
}
349322

0 commit comments

Comments
 (0)