Propagating unsafe::slice 3
This commit is contained in:
parent
6156bc56cb
commit
fceec03da0
5 changed files with 12 additions and 11 deletions
|
@ -562,9 +562,9 @@ fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: str) -> str {
|
|||
fn link_binary(sess: session,
|
||||
obj_filename: str,
|
||||
out_filename: str,
|
||||
lm: link_meta) unsafe {
|
||||
lm: link_meta) {
|
||||
// Converts a library file name into a gcc -l argument
|
||||
fn unlib(config: @session::config, filename: str) -> str {
|
||||
fn unlib(config: @session::config, filename: str) -> str unsafe {
|
||||
let rmlib = fn@(filename: str) -> str {
|
||||
if config.os == session::os_macos ||
|
||||
(config.os == session::os_linux ||
|
||||
|
|
|
@ -108,7 +108,7 @@ fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines {
|
|||
ret @{name: lo.filename, lines: lines};
|
||||
}
|
||||
|
||||
fn get_line(fm: filemap, line: int) -> str {
|
||||
fn get_line(fm: filemap, line: int) -> str unsafe {
|
||||
let begin: uint = fm.lines[line].byte - fm.start_pos.byte;
|
||||
let end: uint;
|
||||
if line as uint < vec::len(fm.lines) - 1u {
|
||||
|
@ -118,11 +118,11 @@ fn get_line(fm: filemap, line: int) -> str {
|
|||
// parsed. If we just slice the rest of the string, we'll print out
|
||||
// the remainder of the file, which is undesirable.
|
||||
end = str::byte_len(*fm.src);
|
||||
let rest = str::slice(*fm.src, begin, end);
|
||||
let rest = str::unsafe::slice(*fm.src, begin, end);
|
||||
let newline = str::index(rest, '\n' as u8);
|
||||
if newline != -1 { end = begin + (newline as uint); }
|
||||
}
|
||||
ret str::slice(*fm.src, begin, end);
|
||||
ret str::unsafe::slice(*fm.src, begin, end);
|
||||
}
|
||||
|
||||
fn get_filemap(cm: codemap, filename: str) -> filemap {
|
||||
|
|
|
@ -579,7 +579,8 @@ fn all_whitespace(s: str, begin: uint, end: uint) -> bool {
|
|||
ret true;
|
||||
}
|
||||
|
||||
fn trim_whitespace_prefix_and_push_line(&lines: [str], s: str, col: uint) unsafe {
|
||||
fn trim_whitespace_prefix_and_push_line(&lines: [str],
|
||||
s: str, col: uint) unsafe {
|
||||
let s1;
|
||||
if all_whitespace(s, 0u, col) {
|
||||
if col < str::byte_len(s) {
|
||||
|
|
|
@ -22,7 +22,7 @@ fn load_errors(testfile: str) -> [expected_error] {
|
|||
ret error_patterns;
|
||||
}
|
||||
|
||||
fn parse_expected(line_num: uint, line: str) -> [expected_error] {
|
||||
fn parse_expected(line_num: uint, line: str) -> [expected_error] unsafe {
|
||||
let error_tag = "//!";
|
||||
let idx0 = str::find(line, error_tag);
|
||||
if idx0 < 0 { ret []; }
|
||||
|
@ -41,11 +41,11 @@ fn parse_expected(line_num: uint, line: str) -> [expected_error] {
|
|||
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
|
||||
let start_kind = idx;
|
||||
while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
|
||||
let kind = str::to_lower(str::slice(line, start_kind, idx));
|
||||
let kind = str::to_lower(str::unsafe::slice(line, start_kind, idx));
|
||||
|
||||
// Extract msg:
|
||||
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
|
||||
let msg = str::slice(line, idx, len);
|
||||
let msg = str::unsafe::slice(line, idx, len);
|
||||
|
||||
#debug("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
|
||||
|
||||
|
|
|
@ -104,12 +104,12 @@ fn parse_name_directive(line: str, directive: str) -> bool {
|
|||
}
|
||||
|
||||
fn parse_name_value_directive(line: str,
|
||||
directive: str) -> option<str> {
|
||||
directive: str) -> option<str> unsafe {
|
||||
let keycolon = directive + ":";
|
||||
if str::find(line, keycolon) >= 0 {
|
||||
let colon = str::find(line, keycolon) as uint;
|
||||
let value =
|
||||
str::slice(line, colon + str::byte_len(keycolon),
|
||||
str::unsafe::slice(line, colon + str::byte_len(keycolon),
|
||||
str::byte_len(line));
|
||||
#debug("%s: %s", directive, value);
|
||||
option::some(value)
|
||||
|
|
Loading…
Reference in a new issue