Propagating unsafe::slice 1
This commit is contained in:
parent
4e406d7fdd
commit
47c57a17dc
@ -573,7 +573,7 @@ fn install_named_specific(c: cargo, wd: str, src: str, name: str) {
|
||||
error("Can't find package " + src + "/" + name);
|
||||
}
|
||||
|
||||
fn cmd_install(c: cargo, argv: [str]) {
|
||||
fn cmd_install(c: cargo, argv: [str]) unsafe {
|
||||
// cargo install <pkg>
|
||||
if vec::len(argv) < 3u {
|
||||
cmd_usage();
|
||||
@ -596,8 +596,9 @@ fn cmd_install(c: cargo, argv: [str]) {
|
||||
let uuid = rest(target, 5u);
|
||||
let idx = str::index(uuid, '/' as u8);
|
||||
if idx != -1 {
|
||||
let source = str::slice(uuid, 0u, idx as uint);
|
||||
uuid = str::slice(uuid, idx as uint + 1u, str::byte_len(uuid));
|
||||
let source = str::unsafe::slice(uuid, 0u, idx as uint);
|
||||
uuid = str::unsafe::slice(uuid, idx as uint + 1u,
|
||||
str::byte_len(uuid));
|
||||
install_uuid_specific(c, wd, source, uuid);
|
||||
} else {
|
||||
install_uuid(c, wd, uuid);
|
||||
@ -606,8 +607,9 @@ fn cmd_install(c: cargo, argv: [str]) {
|
||||
let name = target;
|
||||
let idx = str::index(name, '/' as u8);
|
||||
if idx != -1 {
|
||||
let source = str::slice(name, 0u, idx as uint);
|
||||
name = str::slice(name, idx as uint + 1u, str::byte_len(name));
|
||||
let source = str::unsafe::slice(name, 0u, idx as uint);
|
||||
name = str::unsafe::slice(name, idx as uint + 1u,
|
||||
str::byte_len(name));
|
||||
install_named_specific(c, wd, source, name);
|
||||
} else {
|
||||
install_named(c, wd, name);
|
||||
|
@ -283,10 +283,10 @@ fn check_variants_T<T: copy>(
|
||||
}
|
||||
}
|
||||
|
||||
fn last_part(filename: str) -> str {
|
||||
fn last_part(filename: str) -> str unsafe {
|
||||
let ix = str::rindex(filename, 47u8 /* '/' */);
|
||||
assert ix >= 0;
|
||||
str::slice(filename, ix as uint + 1u, str::byte_len(filename) - 3u)
|
||||
str::unsafe::slice(filename, ix as uint + 1u, str::byte_len(filename) - 3u)
|
||||
}
|
||||
|
||||
enum happiness { passed, cleanly_rejected(str), known_bug(str), failed(str), }
|
||||
|
@ -228,9 +228,9 @@ fn from_str_float(s: str) -> (option<json>, str) {
|
||||
|
||||
fn from_str_bool(s: str) -> (option<json>, str) {
|
||||
if (str::starts_with(s, "true")) {
|
||||
(some(boolean(true)), str::slice(s, 4u, str::byte_len(s)))
|
||||
(some(boolean(true)), str::char_slice(s, 4u, str::char_len(s)))
|
||||
} else if (str::starts_with(s, "false")) {
|
||||
(some(boolean(false)), str::slice(s, 5u, str::byte_len(s)))
|
||||
(some(boolean(false)), str::char_slice(s, 5u, str::char_len(s)))
|
||||
} else {
|
||||
(none, s)
|
||||
}
|
||||
@ -238,7 +238,7 @@ fn from_str_bool(s: str) -> (option<json>, str) {
|
||||
|
||||
fn from_str_null(s: str) -> (option<json>, str) {
|
||||
if (str::starts_with(s, "null")) {
|
||||
(some(null), str::slice(s, 4u, str::byte_len(s)))
|
||||
(some(null), str::char_slice(s, 4u, str::char_len(s)))
|
||||
} else {
|
||||
(none, s)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user