about summary refs log tree commit diff
path: root/src/librustc_trans/back/write.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustc_trans/back/write.rs')
-rw-r--r--src/librustc_trans/back/write.rs88
1 files changed, 44 insertions, 44 deletions
diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs
index 60b5b32e89f..5be66d42920 100644
--- a/src/librustc_trans/back/write.rs
+++ b/src/librustc_trans/back/write.rs
@@ -46,13 +46,13 @@ pub fn llvm_err(handler: &diagnostic::Handler, msg: String) -> ! {
     unsafe {
         let cstr = llvm::LLVMRustGetLastError();
         if cstr == ptr::null() {
-            handler.fatal(msg.as_slice());
+            handler.fatal(msg[]);
         } else {
             let err = CString::new(cstr, true);
             let err = String::from_utf8_lossy(err.as_bytes());
             handler.fatal(format!("{}: {}",
-                                  msg.as_slice(),
-                                  err.as_slice()).as_slice());
+                                  msg[],
+                                  err[])[]);
         }
     }
 }
@@ -103,13 +103,13 @@ impl SharedEmitter {
             match diag.code {
                 Some(ref code) => {
                     handler.emit_with_code(None,
-                                           diag.msg.as_slice(),
-                                           code.as_slice(),
+                                           diag.msg[],
+                                           code[],
                                            diag.lvl);
                 },
                 None => {
                     handler.emit(None,
-                                 diag.msg.as_slice(),
+                                 diag.msg[],
                                  diag.lvl);
                 },
             }
@@ -164,8 +164,8 @@ fn get_llvm_opt_level(optimize: config::OptLevel) -> llvm::CodeGenOptLevel {
 
 fn create_target_machine(sess: &Session) -> TargetMachineRef {
     let reloc_model_arg = match sess.opts.cg.relocation_model {
-        Some(ref s) => s.as_slice(),
-        None => sess.target.target.options.relocation_model.as_slice()
+        Some(ref s) => s[],
+        None => sess.target.target.options.relocation_model[]
     };
     let reloc_model = match reloc_model_arg {
         "pic" => llvm::RelocPIC,
@@ -176,7 +176,7 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
             sess.err(format!("{} is not a valid relocation mode",
                              sess.opts
                                  .cg
-                                 .relocation_model).as_slice());
+                                 .relocation_model)[]);
             sess.abort_if_errors();
             unreachable!();
         }
@@ -197,8 +197,8 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
     let fdata_sections = ffunction_sections;
 
     let code_model_arg = match sess.opts.cg.code_model {
-        Some(ref s) => s.as_slice(),
-        None => sess.target.target.options.code_model.as_slice()
+        Some(ref s) => s[],
+        None => sess.target.target.options.code_model[]
     };
 
     let code_model = match code_model_arg {
@@ -211,19 +211,19 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
             sess.err(format!("{} is not a valid code model",
                              sess.opts
                                  .cg
-                                 .code_model).as_slice());
+                                 .code_model)[]);
             sess.abort_if_errors();
             unreachable!();
         }
     };
 
-    let triple = sess.target.target.llvm_target.as_slice();
+    let triple = sess.target.target.llvm_target[];
 
     let tm = unsafe {
         triple.with_c_str(|t| {
             let cpu = match sess.opts.cg.target_cpu {
-                Some(ref s) => s.as_slice(),
-                None => sess.target.target.options.cpu.as_slice()
+                Some(ref s) => s[],
+                None => sess.target.target.options.cpu[]
             };
             cpu.with_c_str(|cpu| {
                 target_feature(sess).with_c_str(|features| {
@@ -350,13 +350,13 @@ unsafe extern "C" fn inline_asm_handler(diag: SMDiagnosticRef,
     match cgcx.lto_ctxt {
         Some((sess, _)) => {
             sess.codemap().with_expn_info(ExpnId::from_llvm_cookie(cookie), |info| match info {
-                Some(ei) => sess.span_err(ei.call_site, msg.as_slice()),
-                None     => sess.err(msg.as_slice()),
+                Some(ei) => sess.span_err(ei.call_site, msg[]),
+                None     => sess.err(msg[]),
             });
         }
 
         None => {
-            cgcx.handler.err(msg.as_slice());
+            cgcx.handler.err(msg[]);
             cgcx.handler.note("build without -C codegen-units for more exact errors");
         }
     }
@@ -380,8 +380,8 @@ unsafe extern "C" fn diagnostic_handler(info: DiagnosticInfoRef, user: *mut c_vo
                 cgcx.handler.note(format!("optimization {} for {} at {}: {}",
                                           opt.kind.describe(),
                                           pass_name,
-                                          if loc.is_empty() { "[unknown]" } else { loc.as_slice() },
-                                          llvm::twine_to_string(opt.message)).as_slice());
+                                          if loc.is_empty() { "[unknown]" } else { loc[] },
+                                          llvm::twine_to_string(opt.message))[]);
             }
         }
 
@@ -413,7 +413,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
 
     if config.emit_no_opt_bc {
         let ext = format!("{}.no-opt.bc", name_extra);
-        output_names.with_extension(ext.as_slice()).with_c_str(|buf| {
+        output_names.with_extension(ext[]).with_c_str(|buf| {
             llvm::LLVMWriteBitcodeToFile(llmod, buf);
         })
     }
@@ -445,7 +445,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
                 pass.with_c_str(|s| {
                     if !llvm::LLVMRustAddPass(mpm, s) {
                         cgcx.handler.warn(format!("unknown pass {}, ignoring",
-                                                  *pass).as_slice());
+                                                  *pass)[]);
                     }
                 })
             }
@@ -467,7 +467,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
 
                     if config.emit_lto_bc {
                         let name = format!("{}.lto.bc", name_extra);
-                        output_names.with_extension(name.as_slice()).with_c_str(|buf| {
+                        output_names.with_extension(name[]).with_c_str(|buf| {
                             llvm::LLVMWriteBitcodeToFile(llmod, buf);
                         })
                     }
@@ -501,7 +501,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
 
     if config.emit_bc {
         let ext = format!("{}.bc", name_extra);
-        output_names.with_extension(ext.as_slice()).with_c_str(|buf| {
+        output_names.with_extension(ext[]).with_c_str(|buf| {
             llvm::LLVMWriteBitcodeToFile(llmod, buf);
         })
     }
@@ -509,7 +509,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
     time(config.time_passes, "codegen passes", (), |()| {
         if config.emit_ir {
             let ext = format!("{}.ll", name_extra);
-            output_names.with_extension(ext.as_slice()).with_c_str(|output| {
+            output_names.with_extension(ext[]).with_c_str(|output| {
                 with_codegen(tm, llmod, config.no_builtins, |cpm| {
                     llvm::LLVMRustPrintModule(cpm, llmod, output);
                 })
@@ -517,14 +517,14 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
         }
 
         if config.emit_asm {
-            let path = output_names.with_extension(format!("{}.s", name_extra).as_slice());
+            let path = output_names.with_extension(format!("{}.s", name_extra)[]);
             with_codegen(tm, llmod, config.no_builtins, |cpm| {
                 write_output_file(cgcx.handler, tm, cpm, llmod, &path, llvm::AssemblyFileType);
             });
         }
 
         if config.emit_obj {
-            let path = output_names.with_extension(format!("{}.o", name_extra).as_slice());
+            let path = output_names.with_extension(format!("{}.o", name_extra)[]);
             with_codegen(tm, llmod, config.no_builtins, |cpm| {
                 write_output_file(cgcx.handler, tm, cpm, llmod, &path, llvm::ObjectFileType);
             });
@@ -638,7 +638,7 @@ pub fn run_passes(sess: &Session,
 
     // Process the work items, optionally using worker threads.
     if sess.opts.cg.codegen_units == 1 {
-        run_work_singlethreaded(sess, trans.reachable.as_slice(), work_items);
+        run_work_singlethreaded(sess, trans.reachable[], work_items);
     } else {
         run_work_multithreaded(sess, work_items, sess.opts.cg.codegen_units);
     }
@@ -666,7 +666,7 @@ pub fn run_passes(sess: &Session,
                 // 2) Multiple codegen units, with `-o some_name`.  We have
                 //    no good solution for this case, so warn the user.
                 sess.warn(format!("ignoring -o because multiple .{} files were produced",
-                                  ext).as_slice());
+                                  ext)[]);
             } else {
                 // 3) Multiple codegen units, but no `-o some_name`.  We
                 //    just leave the `foo.0.x` files in place.
@@ -699,20 +699,20 @@ pub fn run_passes(sess: &Session,
             };
 
         let pname = get_cc_prog(sess);
-        let mut cmd = Command::new(pname.as_slice());
+        let mut cmd = Command::new(pname[]);
 
-        cmd.args(sess.target.target.options.pre_link_args.as_slice());
+        cmd.args(sess.target.target.options.pre_link_args[]);
         cmd.arg("-nostdlib");
 
         for index in range(0, trans.modules.len()) {
-            cmd.arg(crate_output.with_extension(format!("{}.o", index).as_slice()));
+            cmd.arg(crate_output.with_extension(format!("{}.o", index)[]));
         }
 
         cmd.arg("-r")
            .arg("-o")
            .arg(windows_output_path.as_ref().unwrap_or(output_path));
 
-        cmd.args(sess.target.target.options.post_link_args.as_slice());
+        cmd.args(sess.target.target.options.post_link_args[]);
 
         if (sess.opts.debugging_opts & config::PRINT_LINK_ARGS) != 0 {
             println!("{}", &cmd);
@@ -725,14 +725,14 @@ pub fn run_passes(sess: &Session,
             Ok(status) => {
                 if !status.success() {
                     sess.err(format!("linking of {} with `{}` failed",
-                                     output_path.display(), cmd).as_slice());
+                                     output_path.display(), cmd)[]);
                     sess.abort_if_errors();
                 }
             },
             Err(e) => {
                 sess.err(format!("could not exec the linker `{}`: {}",
                                  pname,
-                                 e).as_slice());
+                                 e)[]);
                 sess.abort_if_errors();
             },
         }
@@ -817,12 +817,12 @@ pub fn run_passes(sess: &Session,
         for i in range(0, trans.modules.len()) {
             if modules_config.emit_obj {
                 let ext = format!("{}.o", i);
-                remove(sess, &crate_output.with_extension(ext.as_slice()));
+                remove(sess, &crate_output.with_extension(ext[]));
             }
 
             if modules_config.emit_bc && !keep_numbered_bitcode {
                 let ext = format!("{}.bc", i);
-                remove(sess, &crate_output.with_extension(ext.as_slice()));
+                remove(sess, &crate_output.with_extension(ext[]));
             }
         }
 
@@ -948,7 +948,7 @@ fn run_work_multithreaded(sess: &Session,
 
 pub fn run_assembler(sess: &Session, outputs: &OutputFilenames) {
     let pname = get_cc_prog(sess);
-    let mut cmd = Command::new(pname.as_slice());
+    let mut cmd = Command::new(pname[]);
 
     cmd.arg("-c").arg("-o").arg(outputs.path(config::OutputTypeObject))
                            .arg(outputs.temp_path(config::OutputTypeAssembly));
@@ -959,18 +959,18 @@ pub fn run_assembler(sess: &Session, outputs: &OutputFilenames) {
             if !prog.status.success() {
                 sess.err(format!("linking with `{}` failed: {}",
                                  pname,
-                                 prog.status).as_slice());
-                sess.note(format!("{}", &cmd).as_slice());
+                                 prog.status)[]);
+                sess.note(format!("{}", &cmd)[]);
                 let mut note = prog.error.clone();
-                note.push_all(prog.output.as_slice());
-                sess.note(str::from_utf8(note.as_slice()).unwrap());
+                note.push_all(prog.output[]);
+                sess.note(str::from_utf8(note[]).unwrap());
                 sess.abort_if_errors();
             }
         },
         Err(e) => {
             sess.err(format!("could not exec the linker `{}`: {}",
                              pname,
-                             e).as_slice());
+                             e)[]);
             sess.abort_if_errors();
         }
     }
@@ -1003,7 +1003,7 @@ unsafe fn configure_llvm(sess: &Session) {
         if sess.print_llvm_passes() { add("-debug-pass=Structure"); }
 
         for arg in sess.opts.cg.llvm_args.iter() {
-            add((*arg).as_slice());
+            add((*arg)[]);
         }
     }