@@ -22,6 +22,7 @@ use middle::trans::common::gensym_name;
22
22
use middle:: ty;
23
23
use util:: ppaux;
24
24
25
+ use std:: c_str:: ToCStr ;
25
26
use std:: char;
26
27
use std:: hash:: Streaming ;
27
28
use std:: hash;
@@ -76,9 +77,9 @@ pub fn WriteOutputFile(sess: Session,
76
77
OptLevel : c_int ,
77
78
EnableSegmentedStacks : bool ) {
78
79
unsafe {
79
- do Triple . as_c_str |Triple | {
80
- do Feature . as_c_str |Feature | {
81
- do Output . as_c_str |Output | {
80
+ do Triple . to_c_str ( ) . with_ref |Triple | {
81
+ do Feature . to_c_str ( ) . with_ref |Feature | {
82
+ do Output . to_c_str ( ) . with_ref |Output | {
82
83
let result = llvm:: LLVMRustWriteOutputFile (
83
84
PM ,
84
85
M ,
@@ -105,6 +106,7 @@ pub mod jit {
105
106
use lib:: llvm:: { ModuleRef , ContextRef , ExecutionEngineRef } ;
106
107
use metadata:: cstore;
107
108
109
+ use std:: c_str:: ToCStr ;
108
110
use std:: cast;
109
111
use std:: local_data;
110
112
use std:: unstable:: intrinsics;
@@ -146,7 +148,7 @@ pub mod jit {
146
148
147
149
debug ! ( "linking: %s" , path) ;
148
150
149
- do path. as_c_str |buf_t| {
151
+ do path. to_c_str ( ) . with_ref |buf_t| {
150
152
if !llvm:: LLVMRustLoadCrate ( manager, buf_t) {
151
153
llvm_err ( sess, ~"Could not link") ;
152
154
}
@@ -165,7 +167,7 @@ pub mod jit {
165
167
// Next, we need to get a handle on the _rust_main function by
166
168
// looking up it's corresponding ValueRef and then requesting that
167
169
// the execution engine compiles the function.
168
- let fun = do "_rust_main" . as_c_str |entry| {
170
+ let fun = do "_rust_main" . to_c_str ( ) . with_ref |entry| {
169
171
llvm:: LLVMGetNamedFunction ( m, entry)
170
172
} ;
171
173
if fun. is_null ( ) {
@@ -230,6 +232,7 @@ pub mod write {
230
232
231
233
use back:: passes;
232
234
235
+ use std:: c_str:: ToCStr ;
233
236
use std:: libc:: { c_int, c_uint} ;
234
237
use std:: path:: Path ;
235
238
use std:: run;
@@ -263,14 +266,14 @@ pub mod write {
263
266
output_type_bitcode => {
264
267
if opts. optimize != session:: No {
265
268
let filename = output. with_filetype ( "no-opt.bc" ) ;
266
- do filename. to_str ( ) . as_c_str |buf| {
269
+ do filename. to_c_str ( ) . with_ref |buf| {
267
270
llvm:: LLVMWriteBitcodeToFile ( llmod, buf) ;
268
271
}
269
272
}
270
273
}
271
274
_ => {
272
275
let filename = output. with_filetype ( "bc" ) ;
273
- do filename. to_str ( ) . as_c_str |buf| {
276
+ do filename. to_c_str ( ) . with_ref |buf| {
274
277
llvm:: LLVMWriteBitcodeToFile ( llmod, buf) ;
275
278
}
276
279
}
@@ -333,7 +336,7 @@ pub mod write {
333
336
// Always output the bitcode file with --save-temps
334
337
335
338
let filename = output. with_filetype ( "opt.bc" ) ;
336
- do filename. to_str ( ) . as_c_str |buf| {
339
+ do filename. to_c_str ( ) . with_ref |buf| {
337
340
llvm:: LLVMWriteBitcodeToFile ( llmod, buf)
338
341
} ;
339
342
// Save the assembly file if -S is used
@@ -391,13 +394,13 @@ pub mod write {
391
394
392
395
if output_type == output_type_llvm_assembly {
393
396
// Given options "-S --emit-llvm": output LLVM assembly
394
- do output. to_str ( ) . as_c_str |buf_o| {
397
+ do output. to_c_str ( ) . with_ref |buf_o| {
395
398
llvm:: LLVMRustAddPrintModulePass ( pm. llpm , llmod, buf_o) ;
396
399
}
397
400
} else {
398
401
// If only a bitcode file is asked for by using the
399
402
// '--emit-llvm' flag, then output it here
400
- do output. to_str ( ) . as_c_str |buf| {
403
+ do output. to_c_str ( ) . with_ref |buf| {
401
404
llvm:: LLVMWriteBitcodeToFile ( llmod, buf) ;
402
405
}
403
406
}
0 commit comments