rustc: Throw out some more regions when normalizing types
This commit is contained in:
parent
51b9674ed7
commit
16a0f72f8c
@ -3110,35 +3110,50 @@ fn ty_params_to_tys(tcx: ty::ctxt, tps: ~[ast::ty_param]) -> ~[t] {
|
|||||||
|
|
||||||
/// Returns an equivalent type with all the typedefs and self regions removed.
|
/// Returns an equivalent type with all the typedefs and self regions removed.
|
||||||
fn normalize_ty(cx: ctxt, t: t) -> t {
|
fn normalize_ty(cx: ctxt, t: t) -> t {
|
||||||
|
fn normalize_mt(cx: ctxt, mt: mt) -> mt {
|
||||||
|
{ ty: normalize_ty(cx, mt.ty), mutbl: mt.mutbl }
|
||||||
|
}
|
||||||
|
fn normalize_vstore(vstore: vstore) -> vstore {
|
||||||
|
match vstore {
|
||||||
|
vstore_fixed(*) | vstore_uniq | vstore_box => vstore,
|
||||||
|
vstore_slice(_) => vstore_slice(re_static)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
alt cx.normalized_cache.find(t) {
|
alt cx.normalized_cache.find(t) {
|
||||||
some(t) { return t; }
|
some(t) { return t; }
|
||||||
none { }
|
none { }
|
||||||
}
|
}
|
||||||
|
|
||||||
let t = alt get(t).struct {
|
let t = match get(t).struct {
|
||||||
ty_rptr(region, mt) {
|
ty_evec(mt, vstore) =>
|
||||||
|
// This type has a vstore. Get rid of it
|
||||||
|
mk_evec(cx, normalize_mt(cx, mt), normalize_vstore(vstore)),
|
||||||
|
|
||||||
|
ty_rptr(region, mt) =>
|
||||||
// This type has a region. Get rid of it
|
// This type has a region. Get rid of it
|
||||||
mk_rptr(cx, re_static, mt)
|
mk_rptr(cx, re_static, normalize_mt(cx, mt)),
|
||||||
}
|
|
||||||
ty_enum(did, r) {
|
ty_enum(did, r) =>
|
||||||
alt r.self_r {
|
match r.self_r {
|
||||||
some(_) {
|
some(_) =>
|
||||||
// This enum has a self region. Get rid of it
|
// This enum has a self region. Get rid of it
|
||||||
mk_enum(cx, did, {self_r: none, self_ty: none, tps: r.tps})
|
mk_enum(cx, did, {self_r: none, self_ty: none, tps: r.tps}),
|
||||||
}
|
none =>
|
||||||
none { t }
|
t
|
||||||
}
|
},
|
||||||
}
|
|
||||||
ty_class(did, r) {
|
ty_class(did, r) =>
|
||||||
alt r.self_r {
|
match r.self_r {
|
||||||
some(_) {
|
some(_) =>
|
||||||
// Ditto.
|
// Ditto.
|
||||||
mk_class(cx, did, {self_r: none, self_ty: none, tps: r.tps})
|
mk_class(cx, did, {self_r: none, self_ty: none, tps: r.tps}),
|
||||||
}
|
none =>
|
||||||
none { t }
|
t
|
||||||
}
|
},
|
||||||
}
|
|
||||||
_ { t }
|
_ =>
|
||||||
|
t
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME #2187: This also reduced int types to their compatible machine
|
// FIXME #2187: This also reduced int types to their compatible machine
|
||||||
|
Loading…
Reference in New Issue
Block a user