Skip to content

Commit 347758f

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 162255 b: refs/heads/auto c: 8bb5ef9 h: refs/heads/master i: 162253: 7d74a37 162251: ddc5ba4 162247: 882ff4a 162239: bb17b9e v: v3
1 parent fa1f02b commit 347758f

File tree

12 files changed

+31
-33
lines changed

12 files changed

+31
-33
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 7d8eabb226718ac70531571478b27a1c9fd74e83
13+
refs/heads/auto: 8bb5ef9df5aeb7e46a9ad9350aaf9086d05f0556
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc_driver/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,13 @@ pub fn handle_options(mut args: Vec<String>) -> Option<getopts::Matches> {
378378
// Don't handle -W help here, because we might first load plugins.
379379

380380
let r = matches.opt_strs("Z");
381-
if r.iter().any(|x| x.as_slice() == "help") {
381+
if r.iter().any(|x| *x == "help") {
382382
describe_debug_flags();
383383
return None;
384384
}
385385

386386
let cg_flags = matches.opt_strs("C");
387-
if cg_flags.iter().any(|x| x.as_slice() == "help") {
387+
if cg_flags.iter().any(|x| *x == "help") {
388388
describe_codegen_flags();
389389
return None;
390390
}

branches/auto/src/librustc_trans/back/link.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub fn find_crate_name(sess: Option<&Session>,
140140
if let Some(sess) = sess {
141141
if let Some(ref s) = sess.opts.crate_name {
142142
if let Some((attr, ref name)) = attr_crate_name {
143-
if s.as_slice() != name.get() {
143+
if *s != name.get() {
144144
let msg = format!("--crate-name and #[crate_name] are \
145145
required to match, but `{}` != `{}`",
146146
s, name);
@@ -249,7 +249,7 @@ pub fn sanitize(s: &str) -> String {
249249
let mut tstr = String::new();
250250
for c in c.escape_unicode() { tstr.push(c) }
251251
result.push('$');
252-
result.push_str(tstr.as_slice().slice_from(1));
252+
result.push_str(tstr.slice_from(1));
253253
}
254254
}
255255
}
@@ -669,7 +669,7 @@ fn link_rlib<'a>(sess: &'a Session,
669669
fn write_rlib_bytecode_object_v1<T: Writer>(writer: &mut T,
670670
bc_data_deflated: &[u8])
671671
-> ::std::io::IoResult<()> {
672-
let bc_data_deflated_size: u64 = bc_data_deflated.as_slice().len() as u64;
672+
let bc_data_deflated_size: u64 = bc_data_deflated.len() as u64;
673673

674674
try! { writer.write(RLIB_BYTECODE_OBJECT_MAGIC) };
675675
try! { writer.write_le_u32(1) };
@@ -910,10 +910,10 @@ fn link_args(cmd: &mut Command,
910910
let args = sess.opts.cg.link_args.as_ref().unwrap_or(&empty_vec);
911911
let mut args = args.iter().chain(used_link_args.iter());
912912
if !dylib
913-
&& (t.options.relocation_model.as_slice() == "pic"
914-
|| sess.opts.cg.relocation_model.as_ref()
915-
.unwrap_or(&empty_str).as_slice() == "pic")
916-
&& !args.any(|x| x.as_slice() == "-static") {
913+
&& (t.options.relocation_model == "pic"
914+
|| *sess.opts.cg.relocation_model.as_ref()
915+
.unwrap_or(&empty_str) == "pic")
916+
&& !args.any(|x| *x == "-static") {
917917
cmd.arg("-pie");
918918
}
919919
}

branches/auto/src/librustc_trans/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
143143

144144
// Internalize everything but the reachable symbols of the current module
145145
let cstrs: Vec<::std::c_str::CString> =
146-
reachable.iter().map(|s| s.as_slice().to_c_str()).collect();
146+
reachable.iter().map(|s| s.to_c_str()).collect();
147147
let arr: Vec<*const i8> = cstrs.iter().map(|c| c.as_ptr()).collect();
148148
let ptr = arr.as_ptr();
149149
unsafe {

branches/auto/src/librustc_trans/back/write.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ unsafe extern "C" fn diagnostic_handler(info: DiagnosticInfoRef, user: *mut c_vo
363363
let pass_name = pass_name.as_str().expect("got a non-UTF8 pass name from LLVM");
364364
let enabled = match cgcx.remark {
365365
AllPasses => true,
366-
SomePasses(ref v) => v.iter().any(|s| s.as_slice() == pass_name),
366+
SomePasses(ref v) => v.iter().any(|s| *s == pass_name),
367367
};
368368

369369
if enabled {
@@ -421,7 +421,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
421421
// If we're verifying or linting, add them to the function pass
422422
// manager.
423423
let addpass = |pass: &str| {
424-
pass.as_slice().with_c_str(|s| llvm::LLVMRustAddPass(fpm, s))
424+
pass.with_c_str(|s| llvm::LLVMRustAddPass(fpm, s))
425425
};
426426
if !config.no_verify { assert!(addpass("verify")); }
427427

@@ -433,7 +433,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
433433
}
434434

435435
for pass in config.passes.iter() {
436-
pass.as_slice().with_c_str(|s| {
436+
pass.with_c_str(|s| {
437437
if !llvm::LLVMRustAddPass(mpm, s) {
438438
cgcx.handler.warn(format!("unknown pass {}, ignoring",
439439
*pass).as_slice());

branches/auto/src/librustc_trans/save/recorder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl<'a> FmtStrs<'a> {
163163
let values = values.iter().map(|s| {
164164
// Never take more than 1020 chars
165165
if s.len() > 1020 {
166-
s.as_slice().slice_to(1020)
166+
s.slice_to(1020)
167167
} else {
168168
s.as_slice()
169169
}

branches/auto/src/librustc_trans/trans/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub fn trans_inline_asm<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ia: &ast::InlineAsm)
122122
};
123123

124124
let r = ia.asm.get().with_c_str(|a| {
125-
constraints.as_slice().with_c_str(|c| {
125+
constraints.with_c_str(|c| {
126126
InlineAsmCall(bcx,
127127
a,
128128
c,

branches/auto/src/librustc_trans/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2739,7 +2739,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
27392739
format!("Illegal null byte in export_name \
27402740
value: `{}`", sym).as_slice());
27412741
}
2742-
let g = sym.as_slice().with_c_str(|buf| {
2742+
let g = sym.with_c_str(|buf| {
27432743
llvm::LLVMAddGlobal(ccx.llmod(), llty, buf)
27442744
});
27452745

branches/auto/src/librustc_trans/trans/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
774774
let comment_text = format!("{} {}", "#",
775775
sanitized.replace("\n", "\n\t# "));
776776
self.count_insn("inlineasm");
777-
let asm = comment_text.as_slice().with_c_str(|c| {
777+
let asm = comment_text.with_c_str(|c| {
778778
unsafe {
779779
llvm::LLVMConstInlineAsm(Type::func(&[], &Type::void(self.ccx)).to_ref(),
780780
c, noname(), False, False)

branches/auto/src/librustc_trans/trans/context.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,12 @@ unsafe fn create_context_and_module(sess: &Session, mod_name: &str) -> (ContextR
222222
sess.target
223223
.target
224224
.data_layout
225-
.as_slice()
226225
.with_c_str(|buf| {
227226
llvm::LLVMSetDataLayout(llmod, buf);
228227
});
229228
sess.target
230229
.target
231230
.llvm_target
232-
.as_slice()
233231
.with_c_str(|buf| {
234232
llvm::LLVMRustSetNormalizedTarget(llmod, buf);
235233
});

branches/auto/src/librustc_trans/trans/debuginfo.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,8 @@ pub fn create_global_var_metadata(cx: &CrateContext,
824824
namespace_node.mangled_name_of_contained_item(var_name.as_slice());
825825
let var_scope = namespace_node.scope;
826826

827-
var_name.as_slice().with_c_str(|var_name| {
828-
linkage_name.as_slice().with_c_str(|linkage_name| {
827+
var_name.with_c_str(|var_name| {
828+
linkage_name.with_c_str(|linkage_name| {
829829
unsafe {
830830
llvm::LLVMDIBuilderCreateStaticVariable(DIB(cx),
831831
var_scope,
@@ -1323,7 +1323,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
13231323
let containing_scope = namespace_node.scope;
13241324
(linkage_name, containing_scope)
13251325
} else {
1326-
(function_name.as_slice().to_string(), file_metadata)
1326+
(function_name.clone(), file_metadata)
13271327
};
13281328

13291329
// Clang sets this parameter to the opening brace of the function's block,
@@ -1332,8 +1332,8 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
13321332

13331333
let is_local_to_unit = is_node_local_to_unit(cx, fn_ast_id);
13341334

1335-
let fn_metadata = function_name.as_slice().with_c_str(|function_name| {
1336-
linkage_name.as_slice().with_c_str(|linkage_name| {
1335+
let fn_metadata = function_name.with_c_str(|function_name| {
1336+
linkage_name.with_c_str(|linkage_name| {
13371337
unsafe {
13381338
llvm::LLVMDIBuilderCreateFunction(
13391339
DIB(cx),
@@ -1554,7 +1554,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
15541554
path_bytes.insert(1, prefix[1]);
15551555
}
15561556

1557-
path_bytes.as_slice().to_c_str()
1557+
path_bytes.to_c_str()
15581558
}
15591559
_ => fallback_path(cx)
15601560
}
@@ -1589,7 +1589,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
15891589
});
15901590

15911591
fn fallback_path(cx: &CrateContext) -> CString {
1592-
cx.link_meta().crate_name.as_slice().to_c_str()
1592+
cx.link_meta().crate_name.to_c_str()
15931593
}
15941594
}
15951595

@@ -1796,7 +1796,7 @@ fn pointer_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
17961796
let pointer_llvm_type = type_of::type_of(cx, pointer_type);
17971797
let (pointer_size, pointer_align) = size_and_align_of(cx, pointer_llvm_type);
17981798
let name = compute_debuginfo_type_name(cx, pointer_type, false);
1799-
let ptr_metadata = name.as_slice().with_c_str(|name| {
1799+
let ptr_metadata = name.with_c_str(|name| {
18001800
unsafe {
18011801
llvm::LLVMDIBuilderCreatePointerType(
18021802
DIB(cx),
@@ -2488,8 +2488,8 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
24882488
.borrow()
24892489
.get_unique_type_id_as_string(unique_type_id);
24902490

2491-
let enum_metadata = enum_name.as_slice().with_c_str(|enum_name| {
2492-
unique_type_id_str.as_slice().with_c_str(|unique_type_id_str| {
2491+
let enum_metadata = enum_name.with_c_str(|enum_name| {
2492+
unique_type_id_str.with_c_str(|unique_type_id_str| {
24932493
unsafe {
24942494
llvm::LLVMDIBuilderCreateUnionType(
24952495
DIB(cx),
@@ -2616,7 +2616,7 @@ fn set_members_of_composite_type(cx: &CrateContext,
26162616
ComputedMemberOffset => machine::llelement_offset(cx, composite_llvm_type, i)
26172617
};
26182618

2619-
member_description.name.as_slice().with_c_str(|member_name| {
2619+
member_description.name.with_c_str(|member_name| {
26202620
unsafe {
26212621
llvm::LLVMDIBuilderCreateMemberType(
26222622
DIB(cx),
@@ -2656,7 +2656,7 @@ fn create_struct_stub(cx: &CrateContext,
26562656
.get_unique_type_id_as_string(unique_type_id);
26572657
let metadata_stub = unsafe {
26582658
struct_type_name.with_c_str(|name| {
2659-
unique_type_id_str.as_slice().with_c_str(|unique_type_id| {
2659+
unique_type_id_str.with_c_str(|unique_type_id| {
26602660
// LLVMDIBuilderCreateStructType() wants an empty array. A null
26612661
// pointer will lead to hard to trace and debug LLVM assertions
26622662
// later on in llvm/lib/IR/Value.cpp.

branches/auto/src/librustc_trans/trans/glue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ pub fn declare_tydesc<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>)
496496
let llalign = llalign_of(ccx, llty);
497497
let name = mangle_internal_name_by_type_and_seq(ccx, t, "tydesc");
498498
debug!("+++ declare_tydesc {} {}", ppaux::ty_to_string(ccx.tcx(), t), name);
499-
let gvar = name.as_slice().with_c_str(|buf| {
499+
let gvar = name.with_c_str(|buf| {
500500
unsafe {
501501
llvm::LLVMAddGlobal(ccx.llmod(), ccx.tydesc_type().to_ref(), buf)
502502
}

0 commit comments

Comments
 (0)