diff options
Diffstat (limited to 'src/librustc_trans/back/write.rs')
| -rw-r--r-- | src/librustc_trans/back/write.rs | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index 98e2b4b9ddd..f27f7dc5719 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -47,14 +47,14 @@ pub fn llvm_err(handler: &diagnostic::Handler, msg: String) -> ! { unsafe { let cstr = llvm::LLVMRustGetLastError(); if cstr == ptr::null() { - handler.fatal(msg[]); + handler.fatal(msg.index(&FullRange)); } else { let err = ffi::c_str_to_bytes(&cstr); let err = String::from_utf8_lossy(err.as_slice()).to_string(); libc::free(cstr as *mut _); handler.fatal(format!("{}: {}", - msg[], - err[])[]); + msg.index(&FullRange), + err.index(&FullRange)).index(&FullRange)); } } } @@ -104,13 +104,13 @@ impl SharedEmitter { match diag.code { Some(ref code) => { handler.emit_with_code(None, - diag.msg[], - code[], + diag.msg.index(&FullRange), + code.index(&FullRange), diag.lvl); }, None => { handler.emit(None, - diag.msg[], + diag.msg.index(&FullRange), diag.lvl); }, } @@ -165,8 +165,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[], - None => sess.target.target.options.relocation_model[] + Some(ref s) => s.index(&FullRange), + None => sess.target.target.options.relocation_model.index(&FullRange) }; let reloc_model = match reloc_model_arg { "pic" => llvm::RelocPIC, @@ -177,7 +177,7 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef { sess.err(format!("{} is not a valid relocation mode", sess.opts .cg - .relocation_model)[]); + .relocation_model).index(&FullRange)); sess.abort_if_errors(); unreachable!(); } @@ -198,8 +198,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[], - None => sess.target.target.options.code_model[] + Some(ref s) => s.index(&FullRange), + None => sess.target.target.options.code_model.index(&FullRange) }; let code_model = match code_model_arg { @@ -212,13 +212,13 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef { sess.err(format!("{} is not a valid code model", sess.opts .cg - .code_model)[]); + .code_model).index(&FullRange)); sess.abort_if_errors(); unreachable!(); } }; - let triple = sess.target.target.llvm_target[]; + let triple = sess.target.target.llvm_target.index(&FullRange); let tm = unsafe { let triple = CString::from_slice(triple.as_bytes()); @@ -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[]), - None => sess.err(msg[]), + Some(ei) => sess.span_err(ei.call_site, msg.index(&FullRange)), + None => sess.err(msg.index(&FullRange)), }); } None => { - cgcx.handler.err(msg[]); + cgcx.handler.err(msg.index(&FullRange)); cgcx.handler.note("build without -C codegen-units for more exact errors"); } } @@ -381,8 +381,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[] }, - llvm::twine_to_string(opt.message))[]); + if loc.is_empty() { "[unknown]" } else { loc.index(&FullRange) }, + llvm::twine_to_string(opt.message)).index(&FullRange)); } } @@ -518,14 +518,14 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext, } if config.emit_asm { - let path = output_names.with_extension(format!("{}.s", name_extra)[]); + let path = output_names.with_extension(format!("{}.s", name_extra).index(&FullRange)); 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)[]); + let path = output_names.with_extension(format!("{}.o", name_extra).index(&FullRange)); with_codegen(tm, llmod, config.no_builtins, |cpm| { write_output_file(cgcx.handler, tm, cpm, llmod, &path, llvm::ObjectFileType); }); @@ -639,7 +639,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[], work_items); + run_work_singlethreaded(sess, trans.reachable.index(&FullRange), work_items); } else { run_work_multithreaded(sess, work_items, sess.opts.cg.codegen_units); } @@ -667,7 +667,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)[]); + ext).index(&FullRange)); } else { // 3) Multiple codegen units, but no `-o some_name`. We // just leave the `foo.0.x` files in place. @@ -700,20 +700,20 @@ pub fn run_passes(sess: &Session, }; let pname = get_cc_prog(sess); - let mut cmd = Command::new(pname[]); + let mut cmd = Command::new(pname.index(&FullRange)); - cmd.args(sess.target.target.options.pre_link_args[]); + cmd.args(sess.target.target.options.pre_link_args.index(&FullRange)); cmd.arg("-nostdlib"); for index in range(0, trans.modules.len()) { - cmd.arg(crate_output.with_extension(format!("{}.o", index)[])); + cmd.arg(crate_output.with_extension(format!("{}.o", index).index(&FullRange))); } cmd.arg("-r") .arg("-o") .arg(windows_output_path.as_ref().unwrap_or(output_path)); - cmd.args(sess.target.target.options.post_link_args[]); + cmd.args(sess.target.target.options.post_link_args.index(&FullRange)); if (sess.opts.debugging_opts & config::PRINT_LINK_ARGS) != 0 { println!("{}", &cmd); @@ -726,14 +726,14 @@ pub fn run_passes(sess: &Session, Ok(status) => { if !status.success() { sess.err(format!("linking of {} with `{}` failed", - output_path.display(), cmd)[]); + output_path.display(), cmd).index(&FullRange)); sess.abort_if_errors(); } }, Err(e) => { sess.err(format!("could not exec the linker `{}`: {}", pname, - e)[]); + e).index(&FullRange)); sess.abort_if_errors(); }, } @@ -818,12 +818,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[])); + remove(sess, &crate_output.with_extension(ext.index(&FullRange))); } if modules_config.emit_bc && !keep_numbered_bitcode { let ext = format!("{}.bc", i); - remove(sess, &crate_output.with_extension(ext[])); + remove(sess, &crate_output.with_extension(ext.index(&FullRange))); } } @@ -949,7 +949,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[]); + let mut cmd = Command::new(pname.index(&FullRange)); cmd.arg("-c").arg("-o").arg(outputs.path(config::OutputTypeObject)) .arg(outputs.temp_path(config::OutputTypeAssembly)); @@ -960,18 +960,18 @@ pub fn run_assembler(sess: &Session, outputs: &OutputFilenames) { if !prog.status.success() { sess.err(format!("linking with `{}` failed: {}", pname, - prog.status)[]); - sess.note(format!("{}", &cmd)[]); + prog.status).index(&FullRange)); + sess.note(format!("{}", &cmd).index(&FullRange)); let mut note = prog.error.clone(); - note.push_all(prog.output[]); - sess.note(str::from_utf8(note[]).unwrap()); + note.push_all(prog.output.index(&FullRange)); + sess.note(str::from_utf8(note.index(&FullRange)).unwrap()); sess.abort_if_errors(); } }, Err(e) => { sess.err(format!("could not exec the linker `{}`: {}", pname, - e)[]); + e).index(&FullRange)); sess.abort_if_errors(); } } @@ -1004,7 +1004,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)[]); + add((*arg).index(&FullRange)); } } |
