@@ -181,7 +181,7 @@ impl<'self> Drop for StatRecorder<'self> {
181181}
182182
183183pub fn decl_fn ( llmod : ModuleRef , name : & str , cc : lib:: llvm:: CallConv , ty : Type ) -> ValueRef {
184- let llfn: ValueRef = do name. to_c_str ( ) . with_ref |buf| {
184+ let llfn: ValueRef = do name. with_c_str |buf| {
185185 unsafe {
186186 llvm:: LLVMGetOrInsertFunction ( llmod, buf, ty. to_ref ( ) )
187187 }
@@ -221,7 +221,7 @@ pub fn get_extern_const(externs: &mut ExternMap, llmod: ModuleRef,
221221 None => ( )
222222 }
223223 unsafe {
224- let c = do name. to_c_str ( ) . with_ref |buf| {
224+ let c = do name. with_c_str |buf| {
225225 llvm:: LLVMAddGlobal ( llmod, ty. to_ref ( ) , buf)
226226 } ;
227227 externs. insert ( name, c) ;
@@ -523,7 +523,7 @@ pub fn get_res_dtor(ccx: @mut CrateContext,
523523// Structural comparison: a rather involved form of glue.
524524pub fn maybe_name_value ( cx : & CrateContext , v : ValueRef , s : & str ) {
525525 if cx. sess . opts . save_temps {
526- do s. to_c_str ( ) . with_ref |buf| {
526+ do s. with_c_str |buf| {
527527 unsafe {
528528 llvm:: LLVMSetValueName ( v, buf)
529529 }
@@ -1136,7 +1136,7 @@ pub fn new_block(cx: @mut FunctionContext,
11361136 opt_node_info : Option < NodeInfo > )
11371137 -> @mut Block {
11381138 unsafe {
1139- let llbb = do name. to_c_str ( ) . with_ref |buf| {
1139+ let llbb = do name. with_c_str |buf| {
11401140 llvm:: LLVMAppendBasicBlockInContext ( cx. ccx . llcx , cx. llfn , buf)
11411141 } ;
11421142 let bcx = @mut Block :: new ( llbb,
@@ -1553,7 +1553,7 @@ pub struct BasicBlocks {
15531553pub fn mk_staticallocas_basic_block ( llfn : ValueRef ) -> BasicBlockRef {
15541554 unsafe {
15551555 let cx = task_llcx ( ) ;
1556- do "static_allocas" . to_c_str ( ) . with_ref | buf| {
1556+ do "static_allocas" . with_c_str | buf| {
15571557 llvm:: LLVMAppendBasicBlockInContext ( cx, llfn, buf)
15581558 }
15591559 }
@@ -1562,7 +1562,7 @@ pub fn mk_staticallocas_basic_block(llfn: ValueRef) -> BasicBlockRef {
15621562pub fn mk_return_basic_block ( llfn : ValueRef ) -> BasicBlockRef {
15631563 unsafe {
15641564 let cx = task_llcx ( ) ;
1565- do "return ".to_c_str().with_ref |buf| {
1565+ do "return ".with_c_str |buf| {
15661566 llvm::LLVMAppendBasicBlockInContext(cx, llfn, buf)
15671567 }
15681568 }
@@ -2328,7 +2328,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
23282328 } ;
23292329 decl_cdecl_fn ( ccx. llmod , main_name, llfty)
23302330 } ;
2331- let llbb = do "top" . to_c_str ( ) . with_ref |buf| {
2331+ let llbb = do "top" . with_c_str |buf| {
23322332 unsafe {
23332333 llvm:: LLVMAppendBasicBlockInContext ( ccx. llcx , llfn, buf)
23342334 }
@@ -2338,7 +2338,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
23382338 llvm:: LLVMPositionBuilderAtEnd ( bld, llbb) ;
23392339
23402340 let crate_map = ccx. crate_map ;
2341- let opaque_crate_map = do "crate_map" . to_c_str ( ) . with_ref |buf| {
2341+ let opaque_crate_map = do "crate_map" . with_c_str |buf| {
23422342 llvm:: LLVMBuildPointerCast ( bld, crate_map, Type :: i8p ( ) . to_ref ( ) , buf)
23432343 } ;
23442344
@@ -2356,7 +2356,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
23562356 } ;
23572357
23582358 let args = {
2359- let opaque_rust_main = do "rust_main" . to_c_str ( ) . with_ref |buf| {
2359+ let opaque_rust_main = do "rust_main" . with_c_str |buf| {
23602360 llvm:: LLVMBuildPointerCast ( bld, rust_main, Type :: i8p ( ) . to_ref ( ) , buf)
23612361 } ;
23622362
@@ -2438,7 +2438,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
24382438
24392439 unsafe {
24402440 let llty = llvm:: LLVMTypeOf ( v) ;
2441- let g = do sym. to_c_str ( ) . with_ref |buf| {
2441+ let g = do sym. with_c_str |buf| {
24422442 llvm:: LLVMAddGlobal ( ccx. llmod , llty, buf)
24432443 } ;
24442444
@@ -2471,7 +2471,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
24712471
24722472 match ( attr:: first_attr_value_str_by_name ( i. attrs , "link_section" ) ) {
24732473 Some ( sect) => unsafe {
2474- do sect. to_c_str ( ) . with_ref |buf| {
2474+ do sect. with_c_str |buf| {
24752475 llvm:: LLVMSetSection ( v, buf) ;
24762476 }
24772477 } ,
@@ -2512,7 +2512,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
25122512 }
25132513 ast:: foreign_item_static( * ) => {
25142514 let ident = token:: ident_to_str ( & ni. ident ) ;
2515- let g = do ident. to_c_str ( ) . with_ref |buf| {
2515+ let g = do ident. with_c_str |buf| {
25162516 unsafe {
25172517 let ty = type_of ( ccx, ty) ;
25182518 llvm:: LLVMAddGlobal ( ccx. llmod , ty. to_ref ( ) , buf)
@@ -2619,7 +2619,7 @@ pub fn trans_constant(ccx: &mut CrateContext, it: @ast::item) {
26192619 let s = mangle_exported_name ( ccx, p, ty:: mk_int ( ) ) . to_managed ( ) ;
26202620 let disr_val = vi[ i] . disr_val ;
26212621 note_unique_llvm_symbol ( ccx, s) ;
2622- let discrim_gvar = do s. to_c_str ( ) . with_ref |buf| {
2622+ let discrim_gvar = do s. with_c_str |buf| {
26232623 unsafe {
26242624 llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
26252625 }
@@ -2814,7 +2814,7 @@ pub fn decl_gc_metadata(ccx: &mut CrateContext, llmod_id: &str) {
28142814 }
28152815
28162816 let gc_metadata_name = ~"_gc_module_metadata_" + llmod_id;
2817- let gc_metadata = do gc_metadata_name. to_c_str ( ) . with_ref |buf| {
2817+ let gc_metadata = do gc_metadata_name. with_c_str |buf| {
28182818 unsafe {
28192819 llvm:: LLVMAddGlobal ( ccx. llmod , Type :: i32 ( ) . to_ref ( ) , buf)
28202820 }
@@ -2829,7 +2829,7 @@ pub fn decl_gc_metadata(ccx: &mut CrateContext, llmod_id: &str) {
28292829pub fn create_module_map ( ccx : & mut CrateContext ) -> ValueRef {
28302830 let elttype = Type :: struct_ ( [ ccx. int_type , ccx. int_type ] , false ) ;
28312831 let maptype = Type :: array ( & elttype, ( ccx. module_data . len ( ) + 1 ) as u64 ) ;
2832- let map = do "_rust_mod_map" . to_c_str ( ) . with_ref |buf| {
2832+ let map = do "_rust_mod_map" . with_c_str |buf| {
28332833 unsafe {
28342834 llvm:: LLVMAddGlobal ( ccx. llmod , maptype. to_ref ( ) , buf)
28352835 }
@@ -2877,7 +2877,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
28772877 let sym_name = ~"_rust_crate_map_" + mapname;
28782878 let arrtype = Type :: array ( & int_type, n_subcrates as u64 ) ;
28792879 let maptype = Type :: struct_ ( [ Type :: i32 ( ) , Type :: i8p ( ) , int_type, arrtype] , false ) ;
2880- let map = do sym_name. to_c_str ( ) . with_ref |buf| {
2880+ let map = do sym_name. with_c_str |buf| {
28812881 unsafe {
28822882 llvm:: LLVMAddGlobal ( llmod, maptype. to_ref ( ) , buf)
28832883 }
@@ -2896,7 +2896,7 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
28962896 cdata. name,
28972897 cstore:: get_crate_vers( cstore, i) ,
28982898 cstore:: get_crate_hash( cstore, i) ) ;
2899- let cr = do nm. to_c_str ( ) . with_ref |buf| {
2899+ let cr = do nm. with_c_str |buf| {
29002900 unsafe {
29012901 llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
29022902 }
@@ -2959,21 +2959,21 @@ pub fn write_metadata(cx: &mut CrateContext, crate: &ast::Crate) {
29592959 let encode_parms = crate_ctxt_to_encode_parms ( cx, encode_inlined_item) ;
29602960 let llmeta = C_bytes ( encoder:: encode_metadata ( encode_parms, crate ) ) ;
29612961 let llconst = C_struct ( [ llmeta] ) ;
2962- let mut llglobal = do "rust_metadata" . to_c_str ( ) . with_ref |buf| {
2962+ let mut llglobal = do "rust_metadata" . with_c_str |buf| {
29632963 unsafe {
29642964 llvm:: LLVMAddGlobal ( cx. llmod , val_ty ( llconst) . to_ref ( ) , buf)
29652965 }
29662966 } ;
29672967 unsafe {
29682968 llvm:: LLVMSetInitializer ( llglobal, llconst) ;
2969- do cx. sess . targ_cfg . target_strs . meta_sect_name . to_c_str ( ) . with_ref |buf| {
2969+ do cx. sess . targ_cfg . target_strs . meta_sect_name . with_c_str |buf| {
29702970 llvm:: LLVMSetSection ( llglobal, buf)
29712971 } ;
29722972 lib:: llvm:: SetLinkage ( llglobal, lib:: llvm:: InternalLinkage ) ;
29732973
29742974 let t_ptr_i8 = Type :: i8p ( ) ;
29752975 llglobal = llvm:: LLVMConstBitCast ( llglobal, t_ptr_i8. to_ref ( ) ) ;
2976- let llvm_used = do "llvm.used" . to_c_str ( ) . with_ref |buf| {
2976+ let llvm_used = do "llvm.used" . with_c_str |buf| {
29772977 llvm:: LLVMAddGlobal ( cx. llmod , Type :: array ( & t_ptr_i8, 1 ) . to_ref ( ) , buf)
29782978 } ;
29792979 lib:: llvm:: SetLinkage ( llvm_used, lib:: llvm:: AppendingLinkage ) ;
@@ -2987,7 +2987,7 @@ fn mk_global(ccx: &CrateContext,
29872987 internal : bool )
29882988 -> ValueRef {
29892989 unsafe {
2990- let llglobal = do name. to_c_str ( ) . with_ref |buf| {
2990+ let llglobal = do name. with_c_str |buf| {
29912991 llvm:: LLVMAddGlobal ( ccx. llmod , val_ty ( llval) . to_ref ( ) , buf)
29922992 } ;
29932993 llvm:: LLVMSetInitializer ( llglobal, llval) ;
0 commit comments