@@ -456,7 +456,6 @@ pub fn set_glue_inlining(f: ValueRef, t: ty::t) {
456
456
// Double-check that we never ask LLVM to declare the same symbol twice. It
457
457
// silently mangles such symbols, breaking our linkage model.
458
458
pub fn note_unique_llvm_symbol( ccx : @crate_ctxt , +sym : ~str ) {
459
- // XXX: Bad copy.
460
459
if ccx. all_llvm_symbols . contains_key ( & sym) {
461
460
ccx. sess . bug ( ~"duplicate LLVM symbol: " + sym);
462
461
}
@@ -628,7 +627,10 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
628
627
for vec:: each( fn_ty. sig. inputs) |a| {
629
628
let llfldp_a = GEP_enum ( cx, a_tup, tid, v_id,
630
629
/*bad*/ copy tps, j) ;
631
- // XXX: Is "None" right here?
630
+ // This assumes the self type is absent (it passes
631
+ // None for the self_ty_opt arg of substs_tps).
632
+ // I think that's ok since you can't have an enum
633
+ // inside a trait.
632
634
let ty_subst = ty:: subst_tps ( ccx. tcx , tps, None , a. ty ) ;
633
635
cx = f ( cx, llfldp_a, ty_subst) ;
634
636
j += 1 u;
@@ -1038,8 +1040,7 @@ pub fn load_if_immediate(cx: block, v: ValueRef, t: ty::t) -> ValueRef {
1038
1040
pub fn trans_trace( bcx : block , sp_opt : Option < span > , +trace_str : ~str ) {
1039
1041
if !bcx. sess ( ) . trace ( ) { return ; }
1040
1042
let _icx = bcx. insn_ctxt ( "trans_trace" ) ;
1041
- // XXX: Bad copy.
1042
- add_comment ( bcx, copy trace_str) ;
1043
+ add_comment ( bcx, trace_str) ;
1043
1044
let V_trace_str = C_cstr ( bcx. ccx ( ) , trace_str) ;
1044
1045
let { V_filename , V_line } = match sp_opt {
1045
1046
Some ( sp) => {
@@ -1551,7 +1552,7 @@ pub fn new_fn_ctxt_w_id(ccx: @crate_ctxt,
1551
1552
llfndecl: ValueRef,
1552
1553
id: ast::node_id,
1553
1554
impl_id: Option<ast::def_id>,
1554
- + param_substs: Option<param_substs>,
1555
+ param_substs: Option<@ param_substs>,
1555
1556
sp: Option<span>) -> fn_ctxt {
1556
1557
let llbbs = mk_standard_basic_blocks(llfndecl);
1557
1558
return @fn_ctxt_ {
@@ -1740,7 +1741,7 @@ pub fn trans_closure(ccx: @crate_ctxt,
1740
1741
body : & ast:: blk ,
1741
1742
llfndecl : ValueRef ,
1742
1743
ty_self : self_arg ,
1743
- + param_substs : Option < param_substs > ,
1744
+ param_substs : Option < @ param_substs > ,
1744
1745
id : ast:: node_id ,
1745
1746
impl_id : Option < ast:: def_id > ,
1746
1747
maybe_load_env : fn ( fn_ctxt ) ,
@@ -1804,7 +1805,7 @@ pub fn trans_fn(ccx: @crate_ctxt,
1804
1805
body : & ast:: blk ,
1805
1806
llfndecl : ValueRef ,
1806
1807
ty_self : self_arg ,
1807
- + param_substs : Option < param_substs > ,
1808
+ param_substs : Option < @ param_substs > ,
1808
1809
id : ast:: node_id ,
1809
1810
impl_id : Option < ast:: def_id > ) {
1810
1811
let do_time = ccx. sess . trans_stats ( ) ;
@@ -1813,8 +1814,8 @@ pub fn trans_fn(ccx: @crate_ctxt,
1813
1814
debug ! ( "trans_fn(ty_self=%?)" , ty_self) ;
1814
1815
let _icx = ccx. insn_ctxt ( "trans_fn" ) ;
1815
1816
ccx. stats . n_fns += 1 ;
1816
- // XXX: Bad copy of ` path`.
1817
- trans_closure ( ccx, copy path, decl, body, llfndecl, ty_self,
1817
+ let the_path_str = path_str ( ccx . sess , path) ;
1818
+ trans_closure ( ccx, path, decl, body, llfndecl, ty_self,
1818
1819
param_substs, id, impl_id,
1819
1820
|fcx| {
1820
1821
if ccx. sess . opts . extra_debuginfo {
@@ -1824,7 +1825,7 @@ pub fn trans_fn(ccx: @crate_ctxt,
1824
1825
|_bcx| { } ) ;
1825
1826
if do_time {
1826
1827
let end = time:: get_time ( ) ;
1827
- log_fn_time ( ccx, path_str ( ccx . sess , path ) , start, end) ;
1828
+ log_fn_time ( ccx, the_path_str , start, end) ;
1828
1829
}
1829
1830
}
1830
1831
@@ -1834,7 +1835,7 @@ pub fn trans_enum_variant(ccx: @crate_ctxt,
1834
1835
args : ~[ ast:: variant_arg ] ,
1835
1836
disr : int ,
1836
1837
is_degen : bool ,
1837
- + param_substs : Option < param_substs > ,
1838
+ param_substs : Option < @ param_substs > ,
1838
1839
llfndecl : ValueRef ) {
1839
1840
let _icx = ccx. insn_ctxt ( "trans_enum_variant" ) ;
1840
1841
// Translate variant arguments to function arguments.
@@ -1850,9 +1851,8 @@ pub fn trans_enum_variant(ccx: @crate_ctxt,
1850
1851
id : varg. id ,
1851
1852
}
1852
1853
} ;
1853
- // XXX: Bad copy of `param_substs`.
1854
1854
let fcx = new_fn_ctxt_w_id ( ccx, ~[ ] , llfndecl, variant. node . id , None ,
1855
- copy param_substs, None ) ;
1855
+ param_substs, None ) ;
1856
1856
// XXX: Bad copy.
1857
1857
let raw_llargs = create_llargs_for_fn_args ( fcx, no_self, copy fn_args) ;
1858
1858
let ty_param_substs = match param_substs {
@@ -1897,7 +1897,7 @@ pub fn trans_enum_variant(ccx: @crate_ctxt,
1897
1897
pub fn trans_tuple_struct(ccx: @crate_ctxt,
1898
1898
fields: ~[@ast::struct_field],
1899
1899
ctor_id: ast::node_id,
1900
- + param_substs: Option<param_substs>,
1900
+ param_substs: Option<@ param_substs>,
1901
1901
llfndecl: ValueRef) {
1902
1902
let _icx = ccx.insn_ctxt(" trans_tuple_struct");
1903
1903
@@ -1951,7 +1951,7 @@ pub fn trans_struct_dtor(ccx: @crate_ctxt,
1951
1951
+path: path,
1952
1952
body: &ast::blk,
1953
1953
dtor_id: ast::node_id,
1954
- + psubsts: Option<param_substs>,
1954
+ psubsts: Option<@ param_substs>,
1955
1955
hash_id: Option<mono_id>,
1956
1956
parent_id: ast::def_id)
1957
1957
-> ValueRef {
@@ -1968,7 +1968,7 @@ pub fn trans_struct_dtor(ccx: @crate_ctxt,
1968
1968
let lldty = type_of_dtor(ccx, class_ty);
1969
1969
1970
1970
// XXX: Bad copies.
1971
- let s = get_dtor_symbol(ccx, copy path, dtor_id, copy psubsts);
1971
+ let s = get_dtor_symbol(ccx, copy path, dtor_id, psubsts);
1972
1972
1973
1973
/* Register the dtor as a function. It has external linkage */
1974
1974
let lldecl = decl_internal_cdecl_fn(ccx.llmod, s, lldty);
@@ -2296,7 +2296,7 @@ pub fn item_path(ccx: @crate_ctxt, i: @ast::item) -> path {
2296
2296
pub fn get_dtor_symbol(ccx: @crate_ctxt,
2297
2297
+path: path,
2298
2298
id: ast::node_id,
2299
- + substs: Option<param_substs>)
2299
+ substs: Option<@ param_substs>)
2300
2300
-> ~str {
2301
2301
let t = ty::node_id_to_type(ccx.tcx, id);
2302
2302
match ccx.item_symbols.find(&id) {
0 commit comments