Skip to content

Commit 47c57a1

Browse files
killerswanbrson
authored andcommitted
Propagating unsafe::slice 1
1 parent 4e406d7 commit 47c57a1

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/cargo/cargo.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ fn install_named_specific(c: cargo, wd: str, src: str, name: str) {
573573
error("Can't find package " + src + "/" + name);
574574
}
575575

576-
fn cmd_install(c: cargo, argv: [str]) {
576+
fn cmd_install(c: cargo, argv: [str]) unsafe {
577577
// cargo install <pkg>
578578
if vec::len(argv) < 3u {
579579
cmd_usage();
@@ -596,8 +596,9 @@ fn cmd_install(c: cargo, argv: [str]) {
596596
let uuid = rest(target, 5u);
597597
let idx = str::index(uuid, '/' as u8);
598598
if idx != -1 {
599-
let source = str::slice(uuid, 0u, idx as uint);
600-
uuid = str::slice(uuid, idx as uint + 1u, str::byte_len(uuid));
599+
let source = str::unsafe::slice(uuid, 0u, idx as uint);
600+
uuid = str::unsafe::slice(uuid, idx as uint + 1u,
601+
str::byte_len(uuid));
601602
install_uuid_specific(c, wd, source, uuid);
602603
} else {
603604
install_uuid(c, wd, uuid);
@@ -606,8 +607,9 @@ fn cmd_install(c: cargo, argv: [str]) {
606607
let name = target;
607608
let idx = str::index(name, '/' as u8);
608609
if idx != -1 {
609-
let source = str::slice(name, 0u, idx as uint);
610-
name = str::slice(name, idx as uint + 1u, str::byte_len(name));
610+
let source = str::unsafe::slice(name, 0u, idx as uint);
611+
name = str::unsafe::slice(name, idx as uint + 1u,
612+
str::byte_len(name));
611613
install_named_specific(c, wd, source, name);
612614
} else {
613615
install_named(c, wd, name);

src/fuzzer/fuzzer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,10 @@ fn check_variants_T<T: copy>(
283283
}
284284
}
285285

286-
fn last_part(filename: str) -> str {
286+
fn last_part(filename: str) -> str unsafe {
287287
let ix = str::rindex(filename, 47u8 /* '/' */);
288288
assert ix >= 0;
289-
str::slice(filename, ix as uint + 1u, str::byte_len(filename) - 3u)
289+
str::unsafe::slice(filename, ix as uint + 1u, str::byte_len(filename) - 3u)
290290
}
291291

292292
enum happiness { passed, cleanly_rejected(str), known_bug(str), failed(str), }

src/libstd/json.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,17 @@ fn from_str_float(s: str) -> (option<json>, str) {
228228

229229
fn from_str_bool(s: str) -> (option<json>, str) {
230230
if (str::starts_with(s, "true")) {
231-
(some(boolean(true)), str::slice(s, 4u, str::byte_len(s)))
231+
(some(boolean(true)), str::char_slice(s, 4u, str::char_len(s)))
232232
} else if (str::starts_with(s, "false")) {
233-
(some(boolean(false)), str::slice(s, 5u, str::byte_len(s)))
233+
(some(boolean(false)), str::char_slice(s, 5u, str::char_len(s)))
234234
} else {
235235
(none, s)
236236
}
237237
}
238238

239239
fn from_str_null(s: str) -> (option<json>, str) {
240240
if (str::starts_with(s, "null")) {
241-
(some(null), str::slice(s, 4u, str::byte_len(s)))
241+
(some(null), str::char_slice(s, 4u, str::char_len(s)))
242242
} else {
243243
(none, s)
244244
}

0 commit comments

Comments
 (0)