rustc: Strip cnames before generating glue to avoid duplicates
This commit is contained in:
parent
142ff3bb4e
commit
3ec3b02ed0
@ -1370,9 +1370,11 @@ fn get_derived_tydesc(&@block_ctxt cx, &ty::t t, bool escapes,
|
||||
ret rslt(cx, v);
|
||||
}
|
||||
|
||||
fn get_tydesc(&@block_ctxt cx, &ty::t t, bool escapes,
|
||||
fn get_tydesc(&@block_ctxt cx, &ty::t orig_t, bool escapes,
|
||||
&mutable option::t[@tydesc_info] static_ti) -> result {
|
||||
|
||||
auto t = ty::strip_cname(cx.fcx.lcx.ccx.tcx, orig_t);
|
||||
|
||||
// Is the supplied type a type param? If so, return the passed-in tydesc.
|
||||
alt (ty::type_param(cx.fcx.lcx.ccx.tcx, t)) {
|
||||
case (some(?id)) { ret rslt(cx, cx.fcx.lltydescs.(id)); }
|
||||
@ -1390,8 +1392,10 @@ fn get_tydesc(&@block_ctxt cx, &ty::t t, bool escapes,
|
||||
ret rslt(cx, info.tydesc);
|
||||
}
|
||||
|
||||
fn get_static_tydesc(&@block_ctxt cx, &ty::t t, &uint[] ty_params)
|
||||
fn get_static_tydesc(&@block_ctxt cx, &ty::t orig_t, &uint[] ty_params)
|
||||
-> @tydesc_info {
|
||||
auto t = ty::strip_cname(cx.fcx.lcx.ccx.tcx, orig_t);
|
||||
|
||||
alt (cx.fcx.lcx.ccx.tydescs.find(t)) {
|
||||
case (some(?info)) { ret info; }
|
||||
case (none) {
|
||||
|
@ -108,6 +108,7 @@ export sequence_is_interior;
|
||||
export struct;
|
||||
export sort_methods;
|
||||
export stmt_node_id;
|
||||
export strip_cname;
|
||||
export sty;
|
||||
export substitute_type_params;
|
||||
export t;
|
||||
@ -855,10 +856,14 @@ fn fold_ty(&ctxt cx, fold_mode fld, t ty_0) -> t {
|
||||
|
||||
|
||||
// Type utilities
|
||||
|
||||
fn rename(&ctxt cx, t typ, str new_cname) -> t {
|
||||
ret gen_ty_full(cx, struct(cx, typ), some[str](new_cname));
|
||||
}
|
||||
|
||||
fn strip_cname(&ctxt cx, t typ) -> t {
|
||||
ret gen_ty_full(cx, struct(cx, typ), none);
|
||||
}
|
||||
|
||||
// Returns a type with the structural part taken from `struct_ty` and the
|
||||
// canonical name from `cname_ty`.
|
||||
|
Loading…
Reference in New Issue
Block a user